<?php

namespace App\Models;

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

class Area extends Model
{
    use HasFactory;

    protected $table = 'areas';
    protected $fillable = ['codigo', 'nombre', 'descripcion', 'color', 'activo'];
    protected $casts = ['activo' => 'boolean'];

    public function sistemas(): HasMany { return $this->hasMany(Sistema::class); }
    public function equipos(): HasMany { return $this->hasMany(Equipo::class); }
    public function planes(): HasMany { return $this->hasMany(PlanMantenimiento::class); }
}
