<?php

namespace App\Models;

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

class PlateRgmDetail extends Model
{
    use HasFactory;

    protected $table = 'plate_rgm_details';

    protected $fillable = [
        'plate_name',
        'marca',
        'referencia',
        'modelo',
        'serial_chasis',
        'motor',
        'acreedor',
        'deudor',
        'monto',
        'fecha_inscripcion',
        'tiene_restriccion',
        'tipo_garantia',
        'last_scraped_at'
    ];

    protected $casts = [
        'tiene_restriccion' => 'boolean',
        'last_scraped_at' => 'datetime',
    ];

    /**
     * Relación con el modelo Plate (si aplica)
     */
    public function plate()
    {
        return $this->belongsTo(Plate::class, 'plate_name', 'plate_name');
    }
}
