import { DocBuilderRoot } from "./docBuilderRoot.js";
import { RulesBuilderUtil } from "../utils/rulesBuilderUtil.js";
export class DocBuilderAssignmentRules extends DocBuilderRoot {
    docType = "AssignmentRules";
    placeholder = "<!-- Assignment Rule description -->";
    promptKey = "PROMPT_DESCRIBE_ASSIGNMENT_RULES";
    xmlRootKey = "assignmentRule";
    static buildIndexTable(prefix, assignmentRulesDescriptions, filterObject = null) {
        const filteredAssignmentRules = filterObject ? assignmentRulesDescriptions.filter(assignmentRule => assignmentRule.impactedObjects.includes(filterObject)) : assignmentRulesDescriptions;
        if (filteredAssignmentRules.length === 0) {
            return [];
        }
        const lines = [];
        lines.push(...[
            filterObject ? "## Related Assignment Rules" : "## Assignment Rules",
            "",
            "| Assignment Rule | Is Active |",
            "|     :----       |  :--: | "
        ]);
        for (const assignmentRule of filteredAssignmentRules) {
            const assignmentRuleNameCell = `[${assignmentRule.name}](${prefix}${assignmentRule.name}.md)`;
            lines.push(...[
                `| ${assignmentRuleNameCell} | ${assignmentRule.active} |`
            ]);
        }
        lines.push("");
        return lines;
    }
    async buildInitialMarkdownLines() {
        const ruleBuilderUtil = new RulesBuilderUtil();
        await ruleBuilderUtil.buildInitialMarkDownLinesForRules(this.parsedXmlObject);
        const assignmentRuleTableLines = [...ruleBuilderUtil.globalRuleTableLines];
        return [
            '<!-- Assignment Rule description -->',
            '## Assignment Rules list',
            ...assignmentRuleTableLines,
            '',
        ];
    }
}
//# sourceMappingURL=docBuilderAssignmentRules.js.map