<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

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

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Event Sourcing & CQRS Lock');
        $manager = new \PpPhp\Core\Platform\Event\Sourcing\Verification\EventSourcingRuntimeLockManager(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $lock = $manager->lock(); $this->line('Status: ' . $lock->status()); $this->line('Score: ' . $lock->score() . '%'); $this->line('Report: storage/reports/r0100/r0100-event-sourcing-cqrs-runtime-report.json'); $this->line('File: storage/reports/r0100/r0100-event-sourcing-cqrs-runtime-lock.json'); return $lock->locked() ? 0 : 1;
        return 0;
    }
}
