<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class DistributedQueueListCommand extends AbstractCommand
{
    public function name(): string { return 'distributed:queue:list'; }
    public function description(): string { return 'PPphp Distributed Queue List'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Distributed Queue List');
        $manager = \PpPhp\Core\Platform\Event\Distributed\Queue\DistributedQueueCoordinator::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); foreach ($manager->summary()['queues'] as $queue) { $this->line('- ' . $queue['queueName'] . ' status=' . $queue['status'] . ' pending=' . $queue['pending'] . ' reserved=' . $queue['reserved']); }
        return 0;
    }
}
