"use strict";
/**
 * P4-AIR-02: Per-Framework Report Templates -- barrel export
 *
 * Eight shipping templates covering SOC 2, HIPAA (breach + security),
 * EU AI Act Annex IV, DORA ICT major incident, PCI DSS, GDPR, and
 * ISO 42001.
 *
 * Each template implements the ReportTemplate interface and is registered
 * in a compile-time map keyed by templateId.
 *
 * Spec: P4-AIR-02 AC 4-6
 *
 * @connexum/ai-governance
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.REPORT_TEMPLATE_REGISTRY = exports.ISO_42001_AMS_TEMPLATE = exports.GDPR_DATA_SUBJECT_RIGHTS_TEMPLATE = exports.PCI_DSS_ANNUAL_ATTESTATION_TEMPLATE = exports.DORA_ICT_MAJOR_INCIDENT_TEMPLATE = exports.EU_AI_ACT_ANNEX_IV_TEMPLATE = exports.HIPAA_SECURITY_INCIDENT_TEMPLATE = exports.HIPAA_BREACH_NOTIFICATION_TEMPLATE = exports.SOC2_TYPE_II_TEMPLATE = exports.FRAMEWORK_PROMPT_REGISTRY = exports.GDPR_PROMPT_SPEC = exports.PCI_DSS_PROMPT_SPEC = exports.DORA_PROMPT_SPEC = exports.EU_AI_ACT_PROMPT_SPEC = exports.ISO27001_PROMPT_SPEC = exports.SOC2_PROMPT_SPEC = exports.HITECH_PROMPT_SPEC = exports.HIPAA_PROMPT_SPEC = void 0;
exports.validateEvidence = validateEvidence;
// ---------------------------------------------------------------------------
// Per-framework narrative prompt specs (P4-AIR-02)
// ---------------------------------------------------------------------------
var index_js_1 = require("./prompts/index.js");
Object.defineProperty(exports, "HIPAA_PROMPT_SPEC", { enumerable: true, get: function () { return index_js_1.HIPAA_PROMPT_SPEC; } });
Object.defineProperty(exports, "HITECH_PROMPT_SPEC", { enumerable: true, get: function () { return index_js_1.HITECH_PROMPT_SPEC; } });
Object.defineProperty(exports, "SOC2_PROMPT_SPEC", { enumerable: true, get: function () { return index_js_1.SOC2_PROMPT_SPEC; } });
Object.defineProperty(exports, "ISO27001_PROMPT_SPEC", { enumerable: true, get: function () { return index_js_1.ISO27001_PROMPT_SPEC; } });
Object.defineProperty(exports, "EU_AI_ACT_PROMPT_SPEC", { enumerable: true, get: function () { return index_js_1.EU_AI_ACT_PROMPT_SPEC; } });
Object.defineProperty(exports, "DORA_PROMPT_SPEC", { enumerable: true, get: function () { return index_js_1.DORA_PROMPT_SPEC; } });
Object.defineProperty(exports, "PCI_DSS_PROMPT_SPEC", { enumerable: true, get: function () { return index_js_1.PCI_DSS_PROMPT_SPEC; } });
Object.defineProperty(exports, "GDPR_PROMPT_SPEC", { enumerable: true, get: function () { return index_js_1.GDPR_PROMPT_SPEC; } });
Object.defineProperty(exports, "FRAMEWORK_PROMPT_REGISTRY", { enumerable: true, get: function () { return index_js_1.FRAMEWORK_PROMPT_REGISTRY; } });
// ---------------------------------------------------------------------------
// Individual template exports
// ---------------------------------------------------------------------------
var soc2_type_ii_js_1 = require("./soc2-type-ii.js");
Object.defineProperty(exports, "SOC2_TYPE_II_TEMPLATE", { enumerable: true, get: function () { return soc2_type_ii_js_1.SOC2_TYPE_II_TEMPLATE; } });
var hipaa_breach_notification_js_1 = require("./hipaa-breach-notification.js");
Object.defineProperty(exports, "HIPAA_BREACH_NOTIFICATION_TEMPLATE", { enumerable: true, get: function () { return hipaa_breach_notification_js_1.HIPAA_BREACH_NOTIFICATION_TEMPLATE; } });
var hipaa_security_incident_js_1 = require("./hipaa-security-incident.js");
Object.defineProperty(exports, "HIPAA_SECURITY_INCIDENT_TEMPLATE", { enumerable: true, get: function () { return hipaa_security_incident_js_1.HIPAA_SECURITY_INCIDENT_TEMPLATE; } });
var eu_ai_act_annex_iv_js_1 = require("./eu-ai-act-annex-iv.js");
Object.defineProperty(exports, "EU_AI_ACT_ANNEX_IV_TEMPLATE", { enumerable: true, get: function () { return eu_ai_act_annex_iv_js_1.EU_AI_ACT_ANNEX_IV_TEMPLATE; } });
var dora_ict_major_incident_js_1 = require("./dora-ict-major-incident.js");
Object.defineProperty(exports, "DORA_ICT_MAJOR_INCIDENT_TEMPLATE", { enumerable: true, get: function () { return dora_ict_major_incident_js_1.DORA_ICT_MAJOR_INCIDENT_TEMPLATE; } });
var pci_dss_annual_attestation_js_1 = require("./pci-dss-annual-attestation.js");
Object.defineProperty(exports, "PCI_DSS_ANNUAL_ATTESTATION_TEMPLATE", { enumerable: true, get: function () { return pci_dss_annual_attestation_js_1.PCI_DSS_ANNUAL_ATTESTATION_TEMPLATE; } });
var gdpr_data_subject_rights_js_1 = require("./gdpr-data-subject-rights.js");
Object.defineProperty(exports, "GDPR_DATA_SUBJECT_RIGHTS_TEMPLATE", { enumerable: true, get: function () { return gdpr_data_subject_rights_js_1.GDPR_DATA_SUBJECT_RIGHTS_TEMPLATE; } });
var iso_42001_ams_js_1 = require("./iso-42001-ams.js");
Object.defineProperty(exports, "ISO_42001_AMS_TEMPLATE", { enumerable: true, get: function () { return iso_42001_ams_js_1.ISO_42001_AMS_TEMPLATE; } });
// ---------------------------------------------------------------------------
// Registry -- all 8 templates keyed by templateId
// ---------------------------------------------------------------------------
const soc2_type_ii_js_2 = require("./soc2-type-ii.js");
const hipaa_breach_notification_js_2 = require("./hipaa-breach-notification.js");
const hipaa_security_incident_js_2 = require("./hipaa-security-incident.js");
const eu_ai_act_annex_iv_js_2 = require("./eu-ai-act-annex-iv.js");
const dora_ict_major_incident_js_2 = require("./dora-ict-major-incident.js");
const pci_dss_annual_attestation_js_2 = require("./pci-dss-annual-attestation.js");
const gdpr_data_subject_rights_js_2 = require("./gdpr-data-subject-rights.js");
const iso_42001_ams_js_2 = require("./iso-42001-ams.js");
const narrative_types_js_1 = require("../narrative-types.js");
exports.REPORT_TEMPLATE_REGISTRY = new Map([
    [soc2_type_ii_js_2.SOC2_TYPE_II_TEMPLATE.templateId, soc2_type_ii_js_2.SOC2_TYPE_II_TEMPLATE],
    [hipaa_breach_notification_js_2.HIPAA_BREACH_NOTIFICATION_TEMPLATE.templateId, hipaa_breach_notification_js_2.HIPAA_BREACH_NOTIFICATION_TEMPLATE],
    [hipaa_security_incident_js_2.HIPAA_SECURITY_INCIDENT_TEMPLATE.templateId, hipaa_security_incident_js_2.HIPAA_SECURITY_INCIDENT_TEMPLATE],
    [eu_ai_act_annex_iv_js_2.EU_AI_ACT_ANNEX_IV_TEMPLATE.templateId, eu_ai_act_annex_iv_js_2.EU_AI_ACT_ANNEX_IV_TEMPLATE],
    [dora_ict_major_incident_js_2.DORA_ICT_MAJOR_INCIDENT_TEMPLATE.templateId, dora_ict_major_incident_js_2.DORA_ICT_MAJOR_INCIDENT_TEMPLATE],
    [pci_dss_annual_attestation_js_2.PCI_DSS_ANNUAL_ATTESTATION_TEMPLATE.templateId, pci_dss_annual_attestation_js_2.PCI_DSS_ANNUAL_ATTESTATION_TEMPLATE],
    [gdpr_data_subject_rights_js_2.GDPR_DATA_SUBJECT_RIGHTS_TEMPLATE.templateId, gdpr_data_subject_rights_js_2.GDPR_DATA_SUBJECT_RIGHTS_TEMPLATE],
    [iso_42001_ams_js_2.ISO_42001_AMS_TEMPLATE.templateId, iso_42001_ams_js_2.ISO_42001_AMS_TEMPLATE],
]);
// ---------------------------------------------------------------------------
// validateEvidence -- pre-LLM guard (AC 16)
// ---------------------------------------------------------------------------
/**
 * Verify that every required audit event type for a template has at least
 * one occurrence in the supplied event set.
 *
 * Throws MissingEvidenceError (fail-closed) before any LLM call is made.
 * Callers should invoke this immediately after loading events from the
 * audit chain and before passing events to AuditNarrativeGenerator.
 *
 * @param templateId - Identifies the template whose requirements to check
 * @param events     - Events retrieved from the audit chain for the window
 * @throws MissingEvidenceError if any required type has zero occurrences
 */
function validateEvidence(templateId, events) {
    const template = exports.REPORT_TEMPLATE_REGISTRY.get(templateId);
    if (!template) {
        throw new Error(`Unknown templateId: "${templateId}"`);
    }
    const presentTypes = new Set(events.map((e) => e.type));
    // Support prefix wildcards: 'security:incident:*' matches any type starting
    // with 'security:incident:'
    const missing = [];
    for (const required of template.requiredAuditEventTypes) {
        const isWildcard = required.endsWith(':*');
        if (isWildcard) {
            const prefix = required.slice(0, -1); // strip trailing '*'
            const found = [...presentTypes].some((t) => t.startsWith(prefix));
            if (!found)
                missing.push(required);
        }
        else {
            if (!presentTypes.has(required))
                missing.push(required);
        }
    }
    if (missing.length > 0) {
        throw new narrative_types_js_1.MissingEvidenceError(missing, template.framework);
    }
}
//# sourceMappingURL=index.js.map