<?php

namespace App\Models;

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

class OrdenLog extends Model
{
    protected $table = 'ordenes_logs';
    protected $fillable = ['orden_id', 'usuario_id', 'accion', 'estado_anterior', 'estado_nuevo', 'detalle', 'metadata'];
    protected $casts = ['metadata' => 'array'];

    public function orden(): BelongsTo { return $this->belongsTo(OrdenTrabajo::class, 'orden_id'); }
    public function usuario(): BelongsTo { return $this->belongsTo(User::class, 'usuario_id'); }
}
