<?php
/**
 * EventSession Model
 *
 * @package RadiusTheme\RadiusBooking\Models
 * @since   1.2.0
 */

namespace RadiusTheme\RadiusBooking\Models;

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

use RadiusTheme\RadiusBooking\Abstracts\BaseModel;

/**
 * Class EventSession
 */
class EventSession extends BaseModel {

	protected string $table = 'radius_booking_event_sessions';

	protected array $fillable = array(
		'event_id',
		'name',
		'description',
		'session_date',
		'start_time',
		'end_time',
		'speaker',
		'capacity',
		'location_override',
		'sort_order',
	);

	protected array $casts = array(
		'event_id'   => 'integer',
		'capacity'   => 'integer',
		'sort_order' => 'integer',
	);

	public function event() {
		return $this->belongsTo( Event::class, 'event_id' );
	}

	public function get_id() {
		return $this->attributes['id'] ?? null;
	}
}
