<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class WorkerRecoveryListCommand extends AbstractCommand
{
    public function name(): string { return 'worker:recover:list'; }
    public function description(): string { return 'PPphp Worker Recovery List'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Worker Recovery List');
        $manager = \PpPhp\Core\Platform\Event\Worker\Monitoring\WorkerRecoveryManager::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $summary = $manager->summary(); foreach ($summary['actions'] as $action) { $this->line('- ' . $action['workerId'] . ' ' . $action['action'] . ' success=' . ($action['successful'] ? 'YES' : 'NO') . ' reason=' . $action['reason']); }
        return 0;
    }
}
