<?php

namespace App\Models;

use App\Enums\QueueStatus;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class QueueStatusHistory extends Model
{
    public $timestamps = false;

    protected $fillable = [
        'queue_entry_id', 'event_type', 'from_status', 'to_status', 'old_token_number',
        'new_token_number', 'reason', 'changed_by_user_id', 'created_at',
    ];

    protected function casts(): array
    {
        return [
            'from_status' => QueueStatus::class,
            'to_status' => QueueStatus::class,
            'old_token_number' => 'integer',
            'new_token_number' => 'integer',
            'created_at' => 'datetime',
        ];
    }

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