<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class BpmnImportCommand extends AbstractCommand
{
    public function name(): string { return 'workflow:bpmn:import'; }
    public function description(): string { return 'PPphp BPMN Import'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp BPMN Import');
        $xml = '<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"><bpmn:process id="console_bpmn" name="Console BPMN" isExecutable="true"><bpmn:startEvent id="start"/><bpmn:task id="task"/><bpmn:endEvent id="end"/><bpmn:sequenceFlow id="f1" sourceRef="start" targetRef="task"/><bpmn:sequenceFlow id="f2" sourceRef="task" targetRef="end"/></bpmn:process></bpmn:definitions>'; $model = \PpPhp\Core\Platform\Workflow\Bpmn\BpmnRuntime::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath())->importXml($xml); $this->line('Imported: ' . $model->processId());
        return 0;
    }
}
