<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class WorkflowStartCommand extends AbstractCommand
{
    public function name(): string { return 'workflow:start'; }
    public function description(): string { return 'PPphp Workflow Start'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Workflow Start');
        $runtime = \PpPhp\Core\Platform\Workflow\WorkflowRuntime::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $runtime->register(\PpPhp\Core\Platform\Workflow\WorkflowDefinition::create('console_workflow', 'Console Workflow', [\PpPhp\Core\Platform\Workflow\WorkflowActivity::create('console_start', 'Console Start', 'system')->toArray()], [])); $instance = $runtime->start('console_workflow', ['source' => 'console']); $this->line('Started: ' . ($instance ? 'YES' : 'NO')); if ($instance) { $this->line('Instance: ' . $instance->instanceId()); }
        return 0;
    }
}
