<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;
use PpPhp\Core\Platform\Event\Queue\DeferredQueueManager;

final class QueueClearCommand extends AbstractCommand
{
    public function name(): string { return 'queue:clear'; }
    public function description(): string { return 'Clear deferred queue.'; }

    public function handle(array $arguments = []): int
    {
        $manager = new DeferredQueueManager();
        $manager->enqueue('queue.clear.sample');
        $manager->clear();
        $this->title('PPphp Deferred Queue Clear');
        $this->line('Size: ' . $manager->statistics()->size());
        return 0;
    }
}
