<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class EventSourcingRuntimeVerifyCommand extends AbstractCommand
{
    public function name(): string { return 'eventsourcing:verify'; }
    public function description(): string { return 'PPphp Event Sourcing & CQRS Verification'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Event Sourcing & CQRS Verification');
        $manager = new \PpPhp\Core\Platform\Event\Sourcing\Verification\EventSourcingRuntimeLockManager(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $report = $manager->verify(); foreach ($report->checks() as $check) { $this->line('[' . (($check['passed'] ?? false) ? 'PASS' : 'FAIL') . '] ' . ($check['check'] ?? 'unknown')); } $this->line('Score: ' . $report->score() . '%'); return $report->passed() ? 0 : 1;
        return 0;
    }
}
