<?php

namespace App\Models;

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

class Agent extends Model
{
    use HasFactory, BelongsToTenant;

    protected $fillable = [
        'tenant_id',
        'name',
        'interface', // Mudamos de extension para interface
        'status',
        'pause_reason',
        'last_status_change',
        'total_calls_answered',
        'total_ring_no_answer'
    ];

    // Cast para garantir que last_status_change seja tratado como data Carbon
    protected $casts = [
        'last_status_change' => 'datetime',
    ];

    // Opcional, mas recomendado: Relacionamento inverso
    public function tenant()
    {
        return $this->belongsTo(Tenant::class);
    }
}
