/**
 * VL Workflow Engine
 * JS port of the Go workflow executor (spec v3.16)
 *
 * Usage:
 *   const { Engine } = require('vl-workflow-engine');
 *   const engine = new Engine(workflowJSON);
 *   const errors = engine.validate();
 *   const ctx = await engine.execute(params, adapters);
 */

const { Engine } = require('./lib/engine');
const { ExpressionEvaluator, toBool, toFloat } = require('./lib/expression');
const { Registry, parseServiceSignature, parseVariableDeclaration, parseParamDeclaration } = require('./lib/registry');
const { ParallelExecutor, ParallelError } = require('./lib/parallel');
const {
  WorkflowType, StepType, getStepType, ExecutionStatus, WriteMode, LoopMode,
  ParallelErrorStrategy, RunEventType, SUPPORTED_VERSIONS, isV310OrLater,
  RESERVED_NEXT_KEYWORDS,
  LLMError, buildErrorMap, ExecutionContext, ChildExecutionContext
} = require('./lib/types');
const { applyOutputMapping, emitEvent, LoopBreakSignal } = require('./lib/executor');

module.exports = {
  // Core
  Engine,
  // Expression
  ExpressionEvaluator, toBool, toFloat,
  // Registry
  Registry, parseServiceSignature, parseVariableDeclaration, parseParamDeclaration,
  // Parallel
  ParallelExecutor, ParallelError,
  // Types & Constants
  WorkflowType, StepType, getStepType, ExecutionStatus, WriteMode, LoopMode,
  ParallelErrorStrategy, RunEventType, SUPPORTED_VERSIONS, isV310OrLater,
  LLMError, buildErrorMap, ExecutionContext, ChildExecutionContext,
  RESERVED_NEXT_KEYWORDS,
  // Executor helpers (for custom step handlers)
  applyOutputMapping, emitEvent, LoopBreakSignal
};
