<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class ClassSchedule extends Model
{
    use SoftDeletes;

    protected $table = 'class_schedules';

    protected $fillable = [
        'venue_id',
        'course_id',
        'day_of_week',
        'start_time',
        'end_time',
        'classroom',
        'class_title',
        'coach_id',
        'coach_display_name',
        'location',
        'level',
        'note',
        'sort_order',
        'is_active',
    ];

    protected function casts(): array
    {
        return [
            'venue_id' => 'int',
            'course_id' => 'int',
            'day_of_week' => 'int',
            'coach_id' => 'int',
            'sort_order' => 'int',
            'is_active' => 'bool',
        ];
    }

    public function venue(): BelongsTo
    {
        return $this->belongsTo(Venue::class, 'venue_id');
    }

    public function course(): BelongsTo
    {
        return $this->belongsTo(ClassCourse::class, 'course_id');
    }

    public function coach(): BelongsTo
    {
        return $this->belongsTo(Coach::class, 'coach_id');
    }
}
