/**
 * 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
 */
// ---------------------------------------------------------------------------
// Per-framework narrative prompt specs (P4-AIR-02)
// ---------------------------------------------------------------------------
export { HIPAA_PROMPT_SPEC, HITECH_PROMPT_SPEC, SOC2_PROMPT_SPEC, ISO27001_PROMPT_SPEC, EU_AI_ACT_PROMPT_SPEC, DORA_PROMPT_SPEC, PCI_DSS_PROMPT_SPEC, GDPR_PROMPT_SPEC, FRAMEWORK_PROMPT_REGISTRY, } from './prompts/index.js';
// ---------------------------------------------------------------------------
// Individual template exports
// ---------------------------------------------------------------------------
export { SOC2_TYPE_II_TEMPLATE } from './soc2-type-ii.js';
export { HIPAA_BREACH_NOTIFICATION_TEMPLATE } from './hipaa-breach-notification.js';
export { HIPAA_SECURITY_INCIDENT_TEMPLATE } from './hipaa-security-incident.js';
export { EU_AI_ACT_ANNEX_IV_TEMPLATE } from './eu-ai-act-annex-iv.js';
export { DORA_ICT_MAJOR_INCIDENT_TEMPLATE } from './dora-ict-major-incident.js';
export { PCI_DSS_ANNUAL_ATTESTATION_TEMPLATE } from './pci-dss-annual-attestation.js';
export { GDPR_DATA_SUBJECT_RIGHTS_TEMPLATE } from './gdpr-data-subject-rights.js';
export { ISO_42001_AMS_TEMPLATE } from './iso-42001-ams.js';
// ---------------------------------------------------------------------------
// Registry -- all 8 templates keyed by templateId
// ---------------------------------------------------------------------------
import { SOC2_TYPE_II_TEMPLATE } from './soc2-type-ii.js';
import { HIPAA_BREACH_NOTIFICATION_TEMPLATE } from './hipaa-breach-notification.js';
import { HIPAA_SECURITY_INCIDENT_TEMPLATE } from './hipaa-security-incident.js';
import { EU_AI_ACT_ANNEX_IV_TEMPLATE } from './eu-ai-act-annex-iv.js';
import { DORA_ICT_MAJOR_INCIDENT_TEMPLATE } from './dora-ict-major-incident.js';
import { PCI_DSS_ANNUAL_ATTESTATION_TEMPLATE } from './pci-dss-annual-attestation.js';
import { GDPR_DATA_SUBJECT_RIGHTS_TEMPLATE } from './gdpr-data-subject-rights.js';
import { ISO_42001_AMS_TEMPLATE } from './iso-42001-ams.js';
import { MissingEvidenceError } from '../narrative-types.js';
export const REPORT_TEMPLATE_REGISTRY = new Map([
    [SOC2_TYPE_II_TEMPLATE.templateId, SOC2_TYPE_II_TEMPLATE],
    [HIPAA_BREACH_NOTIFICATION_TEMPLATE.templateId, HIPAA_BREACH_NOTIFICATION_TEMPLATE],
    [HIPAA_SECURITY_INCIDENT_TEMPLATE.templateId, HIPAA_SECURITY_INCIDENT_TEMPLATE],
    [EU_AI_ACT_ANNEX_IV_TEMPLATE.templateId, EU_AI_ACT_ANNEX_IV_TEMPLATE],
    [DORA_ICT_MAJOR_INCIDENT_TEMPLATE.templateId, DORA_ICT_MAJOR_INCIDENT_TEMPLATE],
    [PCI_DSS_ANNUAL_ATTESTATION_TEMPLATE.templateId, PCI_DSS_ANNUAL_ATTESTATION_TEMPLATE],
    [GDPR_DATA_SUBJECT_RIGHTS_TEMPLATE.templateId, GDPR_DATA_SUBJECT_RIGHTS_TEMPLATE],
    [ISO_42001_AMS_TEMPLATE.templateId, 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
 */
export function validateEvidence(templateId, events) {
    const template = 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 MissingEvidenceError(missing, template.framework);
    }
}
//# sourceMappingURL=index.js.map