<?php

namespace App\Models;

use App\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Call extends Model
{
    use HasFactory, BelongsToTenant;

    // Configuração para UUID
    public $incrementing = false;
    protected $keyType = 'string';

    protected $fillable = [
        'id', 'tenant_id', 'queue_id', 'agent_id', 
        'caller_id', 'status', 'wait_time', 'talk_time', 
        'entered_at', 'finished_at'
    ];

    protected $casts = [
        'entered_at' => 'datetime',
        'finished_at' => 'datetime',
    ];

    public function queue()
    {
        return $this->belongsTo(Queue::class);
    }

    public function agent()
    {
        return $this->belongsTo(Agent::class);
    }
}