<?php

declare(strict_types=1);

namespace Kylin\Education\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

/**
 * 班级
 */
class Classroom extends Model
{
    protected $table = 'classrooms';

    protected $fillable = [
        'name',
        'capacity',
        'equipment',
        'available_slots',
        'status',
    ];

    protected $casts = [
        'capacity' => 'integer',
        'available_slots' => 'array',
        'status' => 'boolean',
    ];

    /**
     * 关联排课
     */
    public function schedules(): HasMany
    {
        return $this->hasMany(Schedule::class, 'classroom_id');
    }
}
