<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class Vehiculo extends Model
{
    protected $fillable = [
        'tenant_id',
        'placa',
        'marca',
        'modelo',
        'anio',
        'color',
        'tipo',
        'valor_asegurado',
        'has_extras',
        'extras',
        'kilometraje_actual',
    ];

    protected $casts = [
        'valor_asegurado' => 'decimal:2',
        'anio' => 'integer',
        'kilometraje_actual' => 'integer',
    ];

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

    public function casos(): HasMany
    {
        return $this->hasMany(Caso::class);
    }
}
