"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DAY_SHIFT_0_2_0_LEGACY_H2_PROFILES = exports.DAY_SHIFT_0_2_0_LEGACY_REQUIRED_H2_ORDER = exports.CANONICAL_SPECIFICATION_H2_ORDER = void 0;
exports.detectSpecificationProfile = detectSpecificationProfile;
exports.CANONICAL_SPECIFICATION_H2_ORDER = [
    "Purpose",
    "Problem Statement",
    "Desired Outcome",
    "Non-Goals",
    "Scope",
    "Constraints",
    "Success Criteria",
    "Open Questions"
];
exports.DAY_SHIFT_0_2_0_LEGACY_REQUIRED_H2_ORDER = [
    "Problem",
    "Goals",
    "Non-Goals",
    "Constraints",
    "Risks",
    "Success Criteria"
];
exports.DAY_SHIFT_0_2_0_LEGACY_H2_PROFILES = [
    exports.DAY_SHIFT_0_2_0_LEGACY_REQUIRED_H2_ORDER,
    ["Summary", ...exports.DAY_SHIFT_0_2_0_LEGACY_REQUIRED_H2_ORDER],
    [...exports.DAY_SHIFT_0_2_0_LEGACY_REQUIRED_H2_ORDER, "Open Questions"],
    ["Summary", ...exports.DAY_SHIFT_0_2_0_LEGACY_REQUIRED_H2_ORDER, "Open Questions"]
];
function detectSpecificationProfile(observedH2) {
    if (sameOrderedHeadings(observedH2, exports.CANONICAL_SPECIFICATION_H2_ORDER)) {
        return {
            id: "canonical",
            recognized: true,
            observedH2: [...observedH2],
            expectedH2: exports.CANONICAL_SPECIFICATION_H2_ORDER
        };
    }
    if (exports.DAY_SHIFT_0_2_0_LEGACY_H2_PROFILES.some((profile) => sameOrderedHeadings(observedH2, profile))) {
        return {
            id: "day-shift-0.2.0-legacy",
            recognized: true,
            observedH2: [...observedH2],
            expectedH2: exports.DAY_SHIFT_0_2_0_LEGACY_REQUIRED_H2_ORDER
        };
    }
    return {
        id: "unrecognized",
        recognized: false,
        observedH2: [...observedH2],
        expectedH2: exports.CANONICAL_SPECIFICATION_H2_ORDER
    };
}
function sameOrderedHeadings(observed, expected) {
    return observed.length === expected.length
        && observed.every((heading, index) => heading === expected[index]);
}
