"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WorkflowTerminalActionError = exports.WORKFLOW_COMMENT_CURSOR_POLICY_MODES = void 0;
exports.isWorkflowTerminalActionError = isWorkflowTerminalActionError;
exports.WORKFLOW_COMMENT_CURSOR_POLICY_MODES = {
    preserve: "preserve",
    advanceToScannedInput: "advance_to_scanned_input",
    advanceToPublishedCommentIfSafe: "advance_to_published_comment_if_safe",
};
class WorkflowTerminalActionError extends Error {
    action;
    targetIssueId;
    constructor(input) {
        const causeMessage = input.cause instanceof Error ? input.cause.message : String(input.cause);
        super(`${input.action} terminal action failed for issue ${input.targetIssueId}: ${causeMessage}`, { cause: input.cause });
        this.name = "WorkflowTerminalActionError";
        this.action = input.action;
        this.targetIssueId = input.targetIssueId;
    }
}
exports.WorkflowTerminalActionError = WorkflowTerminalActionError;
function isWorkflowTerminalActionError(error, action) {
    return (error instanceof WorkflowTerminalActionError &&
        (action === undefined || error.action === action));
}
