<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class DisabilityType extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'code',
        'description',
        'is_active',
    ];

    protected $casts = [
        'is_active' => 'boolean',
    ];

    /**
     * Get students with this disability type
     */
    public function students()
    {
        return $this->hasMany(Student::class, 'disability_type_id');
    }

    /**
     * Scope for active disability types only
     */
    public function scopeActive($query)
    {
        return $query->where('is_active', true);
    }
}
