import { DocBuilderRoot } from "./docBuilderRoot.js";
import { RulesBuilderUtil } from "../utils/rulesBuilderUtil.js";
export class DocBuilderAutoResponseRules extends DocBuilderRoot {
    docType = "AutoResponseRules";
    placeholder = "<!-- AutoResponse Rules description -->";
    promptKey = "PROMPT_DESCRIBE_AUTORESPONSE_RULES";
    xmlRootKey = "autoResponseRule";
    static buildIndexTable(prefix, autoResponseRulesDescriptions, filterObject = null) {
        const filteredAutoResponseRules = filterObject ? autoResponseRulesDescriptions.filter(autoResponseRule => autoResponseRule.impactedObjects.includes(filterObject)) : autoResponseRulesDescriptions;
        if (filteredAutoResponseRules.length === 0) {
            return [];
        }
        const lines = [];
        lines.push(...[
            filterObject ? "## Related AutoResponse Rules" : "## AutoResponse Rules",
            "",
            "| AutoResponse Rule | Is Active |",
            "|     :----       |  :--: | "
        ]);
        for (const autoResponseRule of filteredAutoResponseRules) {
            const autoResponseRuleNameCell = `[${autoResponseRule.name}](${prefix}${autoResponseRule.name}.md)`;
            lines.push(...[
                `| ${autoResponseRuleNameCell} | ${autoResponseRule.active} |`
            ]);
        }
        lines.push("");
        return lines;
    }
    async buildInitialMarkdownLines() {
        const ruleBuilderUtil = new RulesBuilderUtil();
        await ruleBuilderUtil.buildInitialMarkDownLinesFoAutoResponseRules(this.parsedXmlObject);
        const autoResponseRuleTableLines = [...ruleBuilderUtil.globalRuleTableLines];
        return [
            `## ${this.metadataName}`,
            '',
            '<!-- AutoResponse Rules description -->',
            '## AutoResponse Rules list',
            ...autoResponseRuleTableLines
        ];
    }
}
//# sourceMappingURL=docBuilderAutoResponseRules.js.map