"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveIssueFollowupRequestLabel = resolveIssueFollowupRequestLabel;
exports.consumeFollowupRequestLabelProjection = consumeFollowupRequestLabelProjection;
const workflow_labels_1 = require("../../platform/ticket-tracker/workflow-labels");
function resolveIssueFollowupRequestLabel(input) {
    const followupLabel = (0, workflow_labels_1.getFollowupRequestLabelName)(input.workflowLabels);
    return (input.issue.labelNames ?? []).includes(followupLabel)
        ? followupLabel
        : null;
}
function consumeFollowupRequestLabelProjection(workflowProjection, followupLabel) {
    workflowProjection.auxiliaryManagedLabels = {
        previous: [
            ...new Set([
                ...(workflowProjection.auxiliaryManagedLabels?.previous ?? []),
                followupLabel,
            ]),
        ],
        next: (workflowProjection.auxiliaryManagedLabels?.next ?? []).filter((label) => label !== followupLabel),
    };
}
