<?php
/**
 * MeetingTypeAvailability Model
 *
 * Represents a weekly availability window for a meeting type.
 * Each meeting type can have multiple windows per day of week.
 *
 * @package RadiusTheme\RadiusBooking\Models
 * @since   1.2.0
 */

namespace RadiusTheme\RadiusBooking\Models;

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

use RadiusTheme\RadiusBooking\Abstracts\BaseModel;

/**
 * Class MeetingTypeAvailability
 *
 * @property int    $id
 * @property int    $meeting_type_id
 * @property int    $day_of_week
 * @property string $start_time
 * @property string $end_time
 * @property bool   $is_enabled
 */
class MeetingTypeAvailability extends BaseModel {

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

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

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

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