/**
 * AU ASIC RG 271 — Internal Dispute Resolution
 *
 * Primary instrument: ASIC RG 271: Internal Dispute Resolution (effective
 * 5 October 2021; replaces RG 165). Backed by ASIC Act s.912A (AFSLs),
 * s.47 (credit licensees); Corporations Act 2001; National Consumer Credit
 * Protection Act 2009.
 *
 * Entities covered: Australian Financial Services Licensees (AFSLs); Australian
 * Credit Licensees (ACLs); unlicensed exempt product providers.
 *
 * AI relevance: AI-decision systems (loan approvals, insurance underwriting,
 * claims, robo-advice) generate complaints that pass through IDR. AI decisions
 * without adequate reasons or unable to be reviewed/explained = RG 271 failure.
 * ASIC 2024-2025 priorities focus on AI-assisted financial decisions.
 *
 * Key AI obligations:
 *   - RG 271.18-27: Any expression of dissatisfaction where response reasonably
 *     expected = complaint. AI-generated complaints cannot be filtered out of IDR.
 *   - Timeframes: Standard 30 days; super 45 days; credit hardship 21 days.
 *   - RG 271.96-107: IDR responses require meaningful reasons — "our model
 *     decided" is insufficient; explanation of AI decision factors required.
 *   - Root cause analysis: Systemic AI failure patterns escalated internally.
 *   - ASIC data reporting: Annual IDR complaint data reported to ASIC.
 *   - Record-keeping: All complaint records retained 7 years.
 *
 * Cross-pack interactions:
 *   - au-asic-rg-271 + au-asic-rg-274: DDO generates IDR feedback loop; out-of-
 *     target distributions + complaints feed through IDR. IDR data is a DDO
 *     outcome monitoring signal for TMD review triggers.
 *   - au-asic-rg-271 + au-privacy-act: Complaint records contain PI. APP 11 +
 *     APP 12 apply with privilege exceptions. Complainant PI cannot be disclosed
 *     to ASIC reporting without de-identification or authorised basis.
 *   - au-asic-rg-271 + au-cps230: APRA-regulated licensees with systemic IDR
 *     failures from AI decisions face operational risk events under CPS 230.
 *     Root cause + APRA notification may run in parallel with ASIC obligations.
 *
 * Authority: Australian Securities and Investments Commission (ASIC)
 * Sovereignty: Australian Federal
 *
 * @connexum/ai-governance
 */
export const AU_ASIC_RG271_CATEGORY_CLASSIFIERS = {
    AU_RG271_COMPLAINANT: {
        references: ['RG 271.18-27 — complaint definition; any expression of dissatisfaction'],
        classifier: (input) => {
            if (/\b(?:idr\s+complaint|financial\s+(?:complaint|dispute)|rg\s*271\s+complaint|expression\s+of\s+dissatisfaction.*(?:financial|afsl|acl))/i.test(input))
                return true;
            return false;
        },
    },
    AU_RG271_AI_DECISION: {
        references: ['RG 271.96-107 — IDR response with meaningful reasons for AI decisions'],
        classifier: (input) => {
            if (/\bRG\s*271\b.*\bAI\s+decision\b/i.test(input))
                return true;
            if (/\bAI\s+decision\b.*\b(?:RG\s*271|IDR)\b/i.test(input))
                return true;
            if (/\b(?:(?:ai|automated|algorithm(?:ic)?)\s+(?:decision|credit\s+refusal|claim\s+denial|advice)\s+(?:complaint|challenged|dispute)|idr.*ai\s+(?:decision|recommendation|assessment))\b/i.test(input))
                return true;
            return false;
        },
    },
    AU_RG271_IDR_DEADLINE: {
        references: ['RG 271.67 — 30-day (standard), 45-day (super), 21-day (credit hardship)'],
        classifier: (input) => {
            if (/\b(?:idr\s+(?:deadline|timeframe|response\s+(?:due|overdue))|rg\s*271\s+(?:30|21|45)\s*day|complaint\s+response\s+(?:deadline|overdue|approaching))/i.test(input))
                return true;
            return false;
        },
    },
    AU_RG271_SYSTEMIC_ISSUE: {
        references: ['RG 271 + AFSL conditions — root cause analysis for systemic AI failures'],
        classifier: (input) => {
            if (/\b(?:systemic\s+(?:ai\s+)?(?:failure|issue|pattern).*idr|root\s+cause\s+analysis.*(?:complaint|ai\s+decision)|multiple\s+(?:ai\s+)?complaints.*same\s+(?:issue|pattern))/i.test(input))
                return true;
            return false;
        },
    },
    AU_RG271_AFCA_REFERRAL: {
        references: ['RG 271 — AFCA referral as IDR failure indicator'],
        classifier: (input) => {
            if (/\b(?:afca\s+(?:referral|escalation|complaint)|escalated\s+to\s+afca|complaint.*afca.*(?:idr\s+failed|not\s+resolved))/i.test(input))
                return true;
            return false;
        },
    },
};
export const AU_ASIC_RG271_PACK = {
    categoryClassifiers: AU_ASIC_RG271_CATEGORY_CLASSIFIERS,
    /**
     * P3.5: Complaints are subject-keyed — each complaint record carries a
     * complainant identifier to satisfy 7-year record-keeping and ASIC data-
     * reporting obligations. Systemic issue category is non-subject-keyed
     * (aggregate pattern analysis).
     */
    subjectKeyedCategories: [
        'AU_RG271_COMPLAINANT',
        'AU_RG271_AI_DECISION',
        'AU_RG271_IDR_DEADLINE',
        'AU_RG271_AFCA_REFERRAL',
    ],
    id: 'au-asic-rg-271',
    name: 'AU ASIC RG 271 — Internal Dispute Resolution',
    version: '1.0.0',
    contentHash: 'abb9db0d60755fe8f8b5077cd8f247b3950e9ca3e1439307afb0573b7f8c6b10',
    description: 'ASIC RG 271 compliance for AI systems generating or processing complaints at AFSL/ACL-licensed financial services firms. Enforces IDR response timeframes (30-day standard, 45-day superannuation, 21-day credit hardship), meaningful-reasons requirement for AI decisions (RG 271.96-107), systemic-issue escalation, 7-year complaint record retention, and annual ASIC IDR data reporting.',
    authority: 'Australian Securities and Investments Commission (ASIC)',
    industries: [
        'banking', 'insurance', 'superannuation', 'fintech',
        'financial-advice', 'credit', 'investment-management', 'payments',
    ],
    requiredModules: [
        {
            name: 'governance-runtime',
            required: true,
            reason: 'IDR timeframe enforcement (30/45/21-day clocks); AI decision reasons validation; systemic-issue escalation gate',
            reference: 'RG 271.67 (timeframes); RG 271.96-107 (reasons); RG 271 root cause',
        },
        {
            name: 'audit-integrity',
            required: true,
            reason: '7-year retention for all complaint records, IDR responses, root cause analyses, ASIC data reports',
            reference: 'RG 271.132 (record-keeping 7 years)',
        },
        {
            name: 'transparency-injector',
            required: true,
            reason: 'AI decision explanation capture; IDR response with meaningful reasons for AI-driven financial decisions',
            reference: 'RG 271.96-107',
        },
        {
            name: 'approval-queue',
            required: true,
            reason: 'Systemic-issue escalation gate; AI-decision IDR approval before response; ASIC annual report approval',
            reference: 'RG 271 + AFSL s.912D',
        },
        {
            name: 'event-bus',
            required: true,
            reason: 'IDR deadline approaching events; AFCA referral events; systemic pattern detection events',
            reference: 'RG 271.67',
        },
        {
            name: 'data-classifier',
            required: true,
            reason: 'Classify AU_RG271_COMPLAINANT, AU_RG271_AI_DECISION, AU_RG271_IDR_DEADLINE, AU_RG271_SYSTEMIC_ISSUE, AU_RG271_AFCA_REFERRAL categories; detect IDR and AI-decision compliance issues in financial services outputs',
            reference: 'RG 271.96-107 (AI decision meaningful reasons); RG 271.67 (timeframes); RG 271.132 (systemic issues)',
        },
    ],
    moduleConfig: {
        'data-classifier': {
            enabledCategories: [
                'AU_RG271_COMPLAINANT',
                'AU_RG271_AI_DECISION',
                'AU_RG271_IDR_DEADLINE',
                'AU_RG271_SYSTEMIC_ISSUE',
                'AU_RG271_AFCA_REFERRAL',
            ],
            idrStandardSlaDays: 30,
            aiDecisionReasonsRequired: true,
            complaintLoggingActive: true,
            systemicIssueEscalationEnabled: true,
            asicAnnualReportingEnabled: true,
            complaintRetentionYears: 7,
        },
        'governance-runtime': {
            idrStandardSlaDays: 30,
            aiDecisionReasonsRequired: true,
            complaintLoggingActive: true,
            systemicIssueEscalationEnabled: true,
            asicAnnualReportingEnabled: true,
            complaintRetentionYears: 7,
        },
        'transparency-injector': {
            aiDecisionExplanationRequired: true,
        },
        'approval-queue': {
            systemicIssueApprovalRequired: true,
            aiDecisionIdrReviewRequired: true,
        },
    },
    providerPolicy: {
        blockedProviders: [],
        requiredCapabilities: [
            'AI-DECISION-EXPLANATION-CAPABLE',
            'COMPLAINT-RECORD-RETENTION-7Y',
            'IDR-TIMEFRAME-TRACKING',
        ],
        blockReasons: {},
    },
    dataPolicy: {
        scanCategories: [
            'AU_RG271_COMPLAINANT',
            'AU_RG271_AI_DECISION',
            'AU_RG271_IDR_DEADLINE',
            'AU_RG271_SYSTEMIC_ISSUE',
            'AU_RG271_AFCA_REFERRAL',
        ],
        categoryActions: {
            AU_RG271_COMPLAINANT: 'LOG',
            AU_RG271_AI_DECISION: 'REQUIRE_APPROVAL',
            AU_RG271_IDR_DEADLINE: 'WARN',
            AU_RG271_SYSTEMIC_ISSUE: 'REQUIRE_APPROVAL',
            AU_RG271_AFCA_REFERRAL: 'LOG',
        },
        encryptionRequired: true,
        encryptionStandard: 'AES-256',
        minimumClassification: 'CONFIDENTIAL',
    },
    retentionPolicy: {
        sovereignty: ['AU'],
        auditLogRetentionDays: 2555, // 7 years
        sessionRetentionDays: 2555,
        incidentRetentionDays: 2555,
        reference: 'RG 271.132 (all complaint records 7y); IDR responses 7y; ASIC data reports 7y',
    },
    incidentPolicy: {
        notificationDeadlineHours: 0, // No mandatory breach notification under RG 271 alone
        reference: 'Corporations Act s.912D — significant breach notification to ASIC; AFCA referral pattern = ASIC surveillance trigger',
        requiredRecipients: ['asic-breach-notification', 'board', 'compliance-officer'],
        formalNotificationRequired: false,
    },
    validators: [
        {
            id: 'au-rg271-idr-30day-sla',
            description: 'IDR response delivered within 30 calendar days (standard complaints)',
            reference: 'RG 271.67',
            check: 'au_rg271_idr_30day_sla_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'au-rg271-ai-decision-reasons',
            description: 'AI-driven complaints receive IDR responses with sufficient reasons enabling complainant understanding',
            reference: 'RG 271.96-107',
            check: 'au_rg271_ai_decision_reasons_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'au-rg271-complaint-log',
            description: 'Every complaint logged from receipt with complainant identifier',
            reference: 'RG 271.18-27',
            check: 'au_rg271_complaint_log_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'au-rg271-systemic-escalation',
            description: 'Systemic AI decision failure patterns escalated to Board or senior management',
            reference: 'RG 271 root cause analysis + AFSL conditions',
            check: 'au_rg271_systemic_escalation_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'au-rg271-asic-reporting',
            description: 'Annual ASIC IDR complaint data report submitted on time',
            reference: 'RG 271 + ASIC data reporting requirements',
            check: 'au_rg271_asic_reporting_active',
            failSeverity: 'MEDIUM',
        },
        {
            id: 'au-rg271-retention-7yr',
            description: 'Complaint records retained 7 years',
            reference: 'RG 271.132',
            check: 'au_rg271_retention_7yr_active',
            failSeverity: 'MEDIUM',
        },
    ],
};
//# sourceMappingURL=au-asic-rg-271.js.map