<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class SagaRegisterCommand extends AbstractCommand
{
    public function name(): string { return 'saga:register'; }
    public function description(): string { return 'PPphp Saga Register'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Saga Register');
        $runtime = \PpPhp\Core\Platform\Event\Sourcing\Saga\SagaRuntime::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $definition = $runtime->register(\PpPhp\Core\Platform\Event\Sourcing\Saga\SagaDefinition::create('console_saga', 'Console Saga', 'ConsoleStarted', [\PpPhp\Core\Platform\Event\Sourcing\Saga\SagaStep::create('console_step', 'ConsoleCommand', 'ConsoleAggregate', ['handled' => true])->toArray()])); $this->line('Registered: ' . $definition->sagaId());
        return 0;
    }
}
