const WORKFLOW_OPAQUE_REF = Symbol.for('takt.workflowOpaqueRef');
export function getWorkflowReference(workflow) {
    return workflow[WORKFLOW_OPAQUE_REF] ?? workflow.name;
}
export function buildWorkflowResumePointEntry(workflow, step, kind) {
    const workflowRef = getWorkflowReference(workflow);
    return {
        workflow: workflow.name,
        ...(workflowRef !== workflow.name ? { workflow_ref: workflowRef } : {}),
        step,
        kind,
    };
}
export function getResumePointWorkflowReference(entry) {
    return entry.workflow_ref ?? entry.workflow;
}
export function workflowEntryMatchesWorkflow(entry, workflow) {
    if (entry.workflow_ref !== undefined) {
        return entry.workflow_ref === getWorkflowReference(workflow);
    }
    return entry.workflow === workflow.name;
}
export function workflowEntriesMatch(left, right) {
    if (left.workflow_ref !== undefined && right.workflow_ref !== undefined) {
        return left.workflow_ref === right.workflow_ref;
    }
    return left.workflow === right.workflow;
}
//# sourceMappingURL=workflow-reference.js.map