<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class DistributedFailoverInspectCommand extends AbstractCommand
{
    public function name(): string { return 'distributed:failover:inspect'; }
    public function description(): string { return 'PPphp Distributed Failover Inspect'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Distributed Failover Inspect');
        $report = \PpPhp\Core\Platform\Event\Distributed\Failover\DistributedFailoverManager::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath())->inspect(); $stats = $report->statistics(); $this->line('Inspected: YES'); $this->line('Failed Nodes: ' . ($stats['failed'] ?? 0)); $this->line('Actions: ' . ($stats['actions'] ?? 0));
        return 0;
    }
}
