<?php

namespace RadiusTheme\RadiusBooking\Models;

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

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

	/**
	 * The attributes that are mass assignable.
	 *
	 * @var array
	 */
	protected array $fillable = array(
		'special_day_id',
		'start_time',
		'end_time',
	);

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

	/**
	 * Establishes a relationship indicating that this model belongs to a specific special day.
	 */
	public function getSpecialDay() {
		return $this->belongsTo( EmployeeSpecialDay::class, 'special_day_id', 'id' );
	}

	/**
	 * Retrieves the locations associated with the special day time period.
	 */
	public function getTimePeriodLocations() {
		return $this->hasMany( EmployeeSpecialDayTimePeriodLocation::class, 'special_day_time_period_id', 'id' );
	}

	/**
	 * Defines a one-to-many relationship with the EmployeeSpecialDayTimePeriodService model.
	 */
	public function getTimePeriodServices() {
		return $this->hasMany( EmployeeSpecialDayTimePeriodService::class, 'special_day_time_period_id', 'id' );
	}
}
