<?php

namespace App\Models;

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

class Componente extends Model
{
    use HasFactory;

    protected $table = 'componentes';
    protected $fillable = ['equipo_id', 'codigo', 'nombre', 'descripcion', 'unidad', 'activo'];
    protected $casts = ['activo' => 'boolean'];

    public function equipo(): BelongsTo { return $this->belongsTo(Equipo::class); }
}
