<?php

namespace RadiusTheme\RadiusBooking\Models;

use RadiusTheme\RadiusBooking\Abstracts\BaseModel;
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
/**
 * Class EmployeeSpecialDay
 *
 * @package RadiusTheme\RadiusBooking\Models
 *
 * @property int    $id
 * @property string $name
 */
class EmployeeSpecialDay extends BaseModel {

	/**
	 * The database table associated with the model.
	 *
	 * @var string
	 */
	protected string $table = 'radius_booking_employees_special_days';

	/**
	 * The attributes that are mass assignable.
	 *
	 * @var array
	 */
	protected array $fillable = array(
		'user_id',
		'name',
		'start_date',
		'end_date',
	);

	/**
	 * Retrieves the value of the 'id' attribute from the attributes array.
	 *
	 * @return mixed The value of the 'id' attribute.
	 */
	public function get_id() {
		return $this->attributes['id'];
	}

	/**
	 * Establishes a one-to-many relationship between the model and the EmployeeSpecialDayTimePeriod model.
	 *
	 * @return \Illuminate\Database\Eloquent\Relations\HasMany Relationship instance linking to EmployeeSpecialDayTimePeriod records.
	 */
	public function getTimePeriod() {
		return $this->hasMany( EmployeeSpecialDayTimePeriod::class, 'special_day_id', 'id' );
	}
}
