<?php

// app/Models/OccurrenceType.php

namespace App\Models;

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

class OccurrenceType extends Model
{
    use HasFactory;

    protected $fillable = [
        'code', 'name', 'description', 'severity',
        'requires_photo', 'requires_signature', 'notification_template', 'is_active',
    ];

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

    public function occurrences()
    {
        return $this->hasMany(Occurrence::class, 'type', 'code');
    }
}
