function defineWorkflow(config) {
  const steps = config.steps.map((step) => ({
    stepId: step.stepId,
    stepName: step.stepName,
    stepType: step.stepType,
    ...step.description !== void 0 && { description: step.description },
    ...step.config !== void 0 && { config: step.config },
    ...step.userTaskConfig !== void 0 && { userTaskConfig: step.userTaskConfig },
    ...step.subWorkflowConfig !== void 0 && { subWorkflowConfig: step.subWorkflowConfig },
    ...step.signalConfig !== void 0 && { signalConfig: step.signalConfig },
    ...step.activities !== void 0 && { activities: step.activities },
    ...step.timeout !== void 0 && { timeout: step.timeout },
    ...step.retryPolicy !== void 0 && { retryPolicy: step.retryPolicy },
    ...step.preConditions !== void 0 && { preConditions: step.preConditions }
  }));
  const transitions = config.transitions.map((t) => ({
    transitionId: t.transitionId,
    fromStepId: t.fromStepId,
    toStepId: t.toStepId,
    trigger: t.trigger,
    ...t.transitionName !== void 0 && { transitionName: t.transitionName },
    ...t.preConditions !== void 0 && { preConditions: t.preConditions },
    ...t.postConditions !== void 0 && { postConditions: t.postConditions },
    ...t.activities !== void 0 && { activities: t.activities },
    ...t.continueOnActivityFailure !== void 0 && { continueOnActivityFailure: t.continueOnActivityFailure },
    ...t.priority !== void 0 && { priority: t.priority }
  }));
  return {
    workflowId: config.workflowId,
    workflowName: config.workflowName,
    description: config.description ?? null,
    version: config.version ?? 1,
    enabled: config.enabled ?? true,
    metadata: config.metadata ?? null,
    definition: {
      steps,
      transitions,
      ...config.triggers !== void 0 && { triggers: config.triggers }
    },
    moduleId: ""
    // Set by generator/factory at registration time
  };
}
export {
  defineWorkflow
};
//# sourceMappingURL=builder.js.map
