"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveRuleAdrs = resolveRuleAdrs;
const architectureValidation_1 = require("./architectureValidation");
function resolveRuleAdrs(ruleId, discoveredAdrs) {
    const metadata = (0, architectureValidation_1.getValidationRuleMetadataById)(ruleId);
    const relatedAdrIds = [...(metadata.relatedAdrs ?? [])]
        .map((id) => id.trim().toUpperCase())
        .filter((id) => id.length > 0)
        .sort((left, right) => left.localeCompare(right));
    if (relatedAdrIds.length === 0) {
        return [];
    }
    return relatedAdrIds.map((adrId) => {
        const found = discoveredAdrs.find((adr) => adr.id.toUpperCase() === adrId);
        if (!found) {
            return {
                id: adrId,
                title: '(not found)',
                found: false,
            };
        }
        return {
            id: found.id,
            title: found.title,
            filePath: found.filePath,
            found: true,
        };
    });
}
//# sourceMappingURL=resolveRuleAdrs.js.map