"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyAcceptedWorkflowUpdateProjectionLabels = applyAcceptedWorkflowUpdateProjectionLabels;
exports.buildSilentAcceptedWorkflowUpdatePublishSpec = buildSilentAcceptedWorkflowUpdatePublishSpec;
exports.buildAcceptedWorkflowUpdateSummary = buildAcceptedWorkflowUpdateSummary;
const display_labels_1 = require("../../workflows/display-labels");
const config_decision_support_1 = require("./config-decision-support");
const config_followup_label_support_1 = require("./config-followup-label-support");
const config_publish_spec_support_1 = require("./config-publish-spec-support");
function applyAcceptedWorkflowUpdateProjectionLabels(input) {
    if (input.followupLabel !== null) {
        (0, config_followup_label_support_1.consumeFollowupRequestLabelProjection)(input.workflowProjection, input.followupLabel);
    }
}
function buildSilentAcceptedWorkflowUpdatePublishSpec(input) {
    return (0, config_publish_spec_support_1.buildServiceRuntimePublishSpec)({
        decisionKind: "workflow_command",
        issue: input.issue,
        responseLanguage: input.responseLanguage,
        workflowState: input.workflowState,
        forcePublish: true,
        ...(input.shouldAppendCanonicalState
            ? { appendCanonicalWorkflowStateComment: true }
            : {}),
        scannedInputCursor: input.scannedInputCursor,
        commentCursorPolicyMode: input.commentCursorPolicyMode,
        workflowProjection: input.workflowProjection,
    });
}
async function buildAcceptedWorkflowUpdateSummary(input) {
    return (0, config_decision_support_1.buildAcceptedMessage)(input.workflowState, input.responseLanguage, input.displayTimeZone, await (0, display_labels_1.tryLoadWorkflowDisplayCatalog)(input.repoRoot, input.responseLanguage));
}
