<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class WorkerRecoveryRunCommand extends AbstractCommand
{
    public function name(): string { return 'worker:recover:run'; }
    public function description(): string { return 'PPphp Worker Recovery Run'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Worker Recovery Run');
        $manager = \PpPhp\Core\Platform\Event\Worker\Monitoring\WorkerRecoveryManager::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $report = $manager->recover(); $stats = $report->statistics(); $this->line('Recovered: ' . ($stats['actions'] ?? 0)); $this->line('Successful: ' . ($stats['successful'] ?? 0));
        return 0;
    }
}
