<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class WorkflowCompensationRegisterCommand extends AbstractCommand
{
    public function name(): string { return 'workflow:compensation:register'; }
    public function description(): string { return 'PPphp Workflow Compensation Register'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Workflow Compensation Register');
        $runtime = \PpPhp\Core\Platform\Workflow\Compensation\WorkflowCompensationRuntime::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $plan = $runtime->registerPlan(\PpPhp\Core\Platform\Workflow\Compensation\WorkflowCompensationPlan::create('console_workflow', [\PpPhp\Core\Platform\Workflow\Compensation\WorkflowCompensationAction::create('console_workflow', 'console_step', 'undo_console_step')->toArray()])); $this->line('Registered: ' . $plan->planId());
        return 0;
    }
}
