<?php
/**
 * MeetingTypeDateOverride Model
 *
 * Represents a date-specific override for a meeting type's availability.
 * Can mark a date as unavailable or provide custom hours for that date.
 *
 * @package RadiusTheme\RadiusBooking\Models
 * @since   1.2.0
 */

namespace RadiusTheme\RadiusBooking\Models;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use RadiusTheme\RadiusBooking\Abstracts\BaseModel;

/**
 * Class MeetingTypeDateOverride
 *
 * @property int    $id
 * @property int    $meeting_type_id
 * @property string $override_date
 * @property bool   $is_unavailable
 * @property string $start_time
 * @property string $end_time
 */
class MeetingTypeDateOverride extends BaseModel {

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

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

	/**
	 * The attributes that should be cast to specific types.
	 *
	 * @var array
	 */
	protected array $casts = array(
		'meeting_type_id' => 'integer',
		'is_unavailable'  => 'boolean',
	);

	/**
	 * Get the meeting type that owns this override.
	 *
	 * @return \RadiusTheme\RadiusBooking\Core\ORM\Relations\BelongsTo
	 */
	public function meetingType() {
		return $this->belongsTo( MeetingType::class, 'meeting_type_id' );
	}
}
