<?php

namespace App\Console\Commands;

use App\Models\AgentThread;
use Illuminate\Console\Command;

class PurgeAgentThreads extends Command
{
    protected $signature   = 'agent:purge-threads';
    protected $description = 'Elimina los hilos de conversación del agente que hayan expirado.';

    public function handle(): int
    {
        $deleted = AgentThread::where('expires_at', '<', now())->delete();

        $this->info("Se eliminaron {$deleted} hilo(s) expirado(s).");

        return self::SUCCESS;
    }
}
