<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

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

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Event Sourcing & CQRS Runtime');
        $manager = new \PpPhp\Core\Platform\Event\Sourcing\Verification\EventSourcingRuntimeLockManager(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $report = $manager->verify(); $this->line('Status: ' . $report->status()); $this->line('Checks: ' . ($report->statistics()['checks'] ?? 0)); $this->line('Passed: ' . ($report->statistics()['passed'] ?? 0)); $this->line('Failed: ' . ($report->statistics()['failed'] ?? 0)); $this->line('Score: ' . $report->score() . '%');
        return 0;
    }
}
