/**
 * Northern Ireland Equality (s.75 NI Act 1998 + Equality NI orders)
 * Compliance Pack
 *
 * Statutes: distinct from the GB Equality Act 2010. Northern Ireland
 *   has its own equality regime:
 *   - Northern Ireland Act 1998 s.75 — statutory equality duty on public
 *     authorities exercising functions in NI
 *   - Equality (Northern Ireland) Order 2003 (SR 2003/520) — disability
 *     and other protected grounds in employment + goods/services
 *   - Disability Discrimination Act 1995 (as it applies in NI) — partly
 *     replaced in GB by Equality Act 2010 but still in force in NI
 *   - Race Relations (Northern Ireland) Order 1997 (SR 1997/869)
 *   - Sex Discrimination (Northern Ireland) Order 1976 (SR 1976/1042)
 *   - Fair Employment and Treatment (Northern Ireland) Order 1998
 *     (FETO) — distinctive Northern Ireland religion/political-opinion
 *     fair-employment regime
 *   - Belfast / Good Friday Agreement (1998) — underpins the s.75
 *     statutory duty as a peace-process commitment
 *
 * Jurisdiction: Northern Ireland
 * Authority:
 *   - Equality Commission for Northern Ireland (ECNI) — primary
 *     enforcement body
 *   - Northern Ireland Human Rights Commission (NIHRC)
 *   - Industrial Tribunals + Fair Employment Tribunal
 *
 * Why this pack (separate from `uk-equality-act`):
 *   - GB Equality Act 2010 does NOT apply in Northern Ireland.
 *   - NI has 7 distinct equality grounds (s.75) — different from GB's 9.
 *   - NI s.75 statutory duty is BROADER than GB's PSED — covers
 *     "equality of opportunity" PLUS "good relations" PLUS distinct
 *     gender-/sexual-orientation/disability layered orders.
 *   - FETO (Fair Employment and Treatment) is unique to NI — covers
 *     religious belief and political opinion in employment with
 *     monitoring requirements that have no GB equivalent.
 *   - Different regulator (ECNI not EHRC).
 *
 * Section 75 NI Act 1998 — statutory equality duty:
 *   - Public authorities must have due regard to the need to promote
 *     equality of opportunity between persons of different:
 *     1. Religious belief
 *     2. Political opinion
 *     3. Racial group
 *     4. Age
 *     5. Marital status
 *     6. Sexual orientation
 *     7. Persons with a disability and persons without
 *     8. Persons with dependants and persons without (8th category, often
 *        treated as a separate "dependants" overlay)
 *     9. Men and women generally (gender)
 *   - PLUS regard to the desirability of promoting good relations between
 *     persons of different religious belief, political opinion, or racial
 *     group.
 *   - Equality scheme + Equality Impact Assessments (EQIAs) mandatory
 *     for public authorities.
 *
 * FETO key distinctive obligations:
 *   - Workforce monitoring by religion + political opinion (annual
 *     return to ECNI)
 *   - Fair-employment article 5 employer obligations
 *   - 3-yearly review of recruitment, training, promotion practices
 *   - Article 55 review obligation
 *
 * AI-specific overlays:
 *   - Algorithmic decision-making affecting NI residents must satisfy
 *     s.75 due-regard obligation (where deploying body is a public
 *     authority or contractor of a public authority)
 *   - Disparate-impact monitoring across the NINE grounds (not 9
 *     protected characteristics)
 *   - FETO monitoring data requires special treatment (heightened
 *     security; restricted-access classification)
 *
 * Out of scope:
 *   - GB Equality Act 2010 (separate pack: `uk-equality-act`)
 *   - UK GDPR Article 22 ADM (separate pack: `uk-gdpr`)
 *   - Belfast/GFA constitutional commitments beyond s.75 implementation
 *
 * @connexum/ai-governance
 */
export const NI_EQUALITY_CATEGORY_CLASSIFIERS = {
    S75_GROUND: {
        references: [
            'Northern Ireland Act 1998 s.75 — nine equality grounds',
        ],
        classifier: (input) => {
            if (/\b(?:religious\s+belief|political\s+opinion|fair\s+employment|feto)\b/i.test(input))
                return true;
            if (/\b(?:catholic|protestant|nationalist|unionist|loyalist|republican|cross[\s-]?community)\b/i.test(input))
                return true;
            if (/\b(?:s\.?\s*75\s+(?:ground|category|duty)|section\s+75\s+ni|ni\s+act\s+1998)\b/i.test(input))
                return true;
            if (/\b(?:dependants?\s+(?:status|ground|category)\s+ni|persons\s+with\s+dependants)\b/i.test(input))
                return true;
            return false;
        },
    },
    EQIA_RECORD: {
        references: [
            'Northern Ireland Act 1998 s.75 — Equality Impact Assessment',
        ],
        classifier: (input) => {
            if (/\b(?:equality\s+impact\s+assessment\s+(?:ni|s\.?\s*75)|eqia\s+(?:ni|s75)|ni\s+equality\s+scheme)\b/i.test(input))
                return true;
            if (/\b(?:s\.?\s*75\s+(?:eqia|equality\s+scheme|consultation)|due\s+regard\s+ni)\b/i.test(input))
                return true;
            return false;
        },
    },
    FETO_MONITORING: {
        references: [
            'Fair Employment and Treatment (NI) Order 1998 — workforce monitoring',
        ],
        classifier: (input) => {
            if (/\b(?:feto\s+(?:monitoring|return|article\s+55|article\s+5)|fair\s+employment\s+monitoring)\b/i.test(input))
                return true;
            if (/\b(?:religion\s+monitoring\s+ni|political\s+opinion\s+monitoring|workforce\s+composition\s+ni)\b/i.test(input))
                return true;
            if (/\b(?:art\.?\s*55\s+review|article\s+55\s+feto|3[\s-]?yearly\s+review\s+feto)\b/i.test(input))
                return true;
            return false;
        },
    },
    ECNI_CORRESPONDENCE: {
        references: [
            'Equality Commission for Northern Ireland enforcement',
        ],
        classifier: (input) => {
            if (/\b(?:ecni\s+(?:investigation|notice|correspondence|complaint|inquiry)|equality\s+commission\s+northern\s+ireland)\b/i.test(input))
                return true;
            if (/\b(?:fair\s+employment\s+tribunal|industrial\s+tribunal\s+ni|fet\s+claim)\b/i.test(input))
                return true;
            return false;
        },
    },
    GOOD_RELATIONS_RECORD: {
        references: [
            'Northern Ireland Act 1998 s.75(2) — good relations duty',
        ],
        classifier: (input) => {
            if (/\b(?:good\s+relations\s+(?:duty|assessment|impact|review)\s+ni|community\s+relations\s+s75)\b/i.test(input))
                return true;
            return false;
        },
    },
    DISPARATE_IMPACT_NI: {
        references: [
            'Northern Ireland disparate-impact monitoring across the s.75 grounds',
        ],
        classifier: (input) => {
            if (/\b(?:disparate\s+impact\s+ni|s\.?\s*75\s+impact\s+(?:metric|score|disparity)|community\s+background\s+disparity)\b/i.test(input))
                return true;
            return false;
        },
    },
    CREDENTIALS: {
        references: ['Cross-pack secrets safety; NI equality artefacts must not embed credentials'],
        classifier: (input) => {
            if (/\b(?:api[_-]?key|apikey)\s*[=:]\s*["']?[A-Za-z0-9_\-\/+]{16,}["']?/i.test(input))
                return true;
            if (/\bpassword\s*[=:]\s*["']?[A-Za-z0-9!@#$%^&*_\-]{8,}["']?/i.test(input))
                return true;
            if (/-----BEGIN\s+(?:RSA\s+)?PRIVATE\s+KEY-----/.test(input))
                return true;
            return false;
        },
    },
};
export const NI_EQUALITY_PACK = {
    categoryClassifiers: NI_EQUALITY_CATEGORY_CLASSIFIERS,
    id: 'ni-equality',
    aliases: [
        'ni-equality-act',
        'northern-ireland-equality',
        'section-75',
        's75-ni',
        'ni-s75',
        'feto',
        'fair-employment-treatment-ni',
        'ecni',
    ],
    name: 'Northern Ireland Equality (s.75 NI Act 1998 + Equality NI Orders + FETO)',
    version: '1.0.0',
    description: 'Northern Ireland equality regime — distinct from the GB Equality Act 2010 (which does NOT apply in NI). Section 75 of the NI Act 1998 imposes a statutory equality duty on public authorities across nine grounds (religious belief, political opinion, racial group, age, marital status, sexual orientation, disability, dependants, gender) PLUS a good-relations duty. Fair Employment and Treatment (NI) Order 1998 (FETO) adds religion/political-opinion workforce monitoring with annual ECNI returns. AI-specific overlays: algorithmic decisions affecting NI residents satisfying s.75 due-regard; disparate-impact monitoring across the nine grounds; FETO monitoring data restricted-access classification. Pairs with `uk-gdpr` (UK-wide personal-data overlay) but does NOT pair with `uk-equality-act` — these are mutually-exclusive regimes (GB vs NI).',
    authority: 'Equality Commission for Northern Ireland (ECNI) + Northern Ireland Human Rights Commission (NIHRC) + Industrial Tribunals + Fair Employment Tribunal',
    industries: ['public-sector', 'technology', 'financial-services', 'healthcare', 'hr-employment', 'education', 'retail', 'media', 'legal', 'housing'],
    requiredModules: [
        {
            name: 'governance-runtime',
            required: true,
            reason: 'Default-deny on AI actions branching on a s.75 ground without documented lawful basis or s.75 due-regard evidence; FETO-specific gate for employment-context decisions affecting religion or political opinion.',
            reference: 'NI Act 1998 s.75; FETO 1998',
        },
        {
            name: 'bias-monitor',
            required: true,
            reason: 'Disparate-impact monitoring across all 9 s.75 grounds; community-background subgroup analysis for FETO returns; alert on statistical disparity exceeding thresholds.',
            reference: 'NI Act 1998 s.75; FETO Article 55 review',
        },
        {
            name: 'data-classifier',
            required: true,
            reason: 'Detect s.75 ground data in inputs and outputs; flag EQIA records, FETO monitoring data (heightened security), ECNI correspondence, good-relations evidence, disparate-impact records.',
            reference: 'NI Act 1998 s.75; FETO monitoring data sensitivity',
        },
        {
            name: 'attestation-manager',
            required: true,
            reason: 'Equality scheme registration; per-EQIA attestation; FETO annual workforce monitoring return tracking; Article 55 3-yearly review attestation; ECNI engagement record.',
            reference: 'NI Act 1998 s.75 equality scheme; FETO Article 55',
        },
        {
            name: 'transparency-injector',
            required: true,
            reason: 'AI-output transparency for affected NI residents; reasonable-adjustment availability disclosure (Disability Discrimination Act NI overlay); EQIA consultation publication for public authorities.',
            reference: 'Disability Discrimination Act 1995 (NI); s.75 consultation',
        },
        {
            name: 'approval-queue',
            required: true,
            reason: 'High-risk consequential decisions affecting s.75 grounds route to T2 fairness review; FETO-related employment decisions sign-off; EQIA approval for material policy changes.',
            reference: 'NI Act 1998 s.75; FETO',
        },
        {
            name: 'audit-integrity',
            required: true,
            reason: 'Tamper-evident audit chain for s.75 ground decisions, FETO monitoring data access, EQIA revisions, ECNI correspondence — required for tribunal disclosure.',
            reference: 'Industrial Tribunal + Fair Employment Tribunal disclosure',
        },
        {
            name: 'event-bus',
            required: true,
            reason: 'Disparity-threshold alerts; FETO Article 55 review reminders; ECNI engagement routing; good-relations event tracking.',
            reference: 'NI Act 1998 s.75; FETO Article 55',
        },
        {
            name: 'session-persistence',
            required: true,
            reason: 'NI tribunal limitation periods: most equality complaints have 3-month tribunal window in NI (similar to GB), but evidence retention should follow Limitation (NI) Order 1989 — 6 years for civil claims.',
            reference: 'Limitation (NI) Order 1989; FETO complaint windows',
        },
        {
            name: 'agent-auth',
            required: true,
            reason: 'FETO monitoring data heightened access controls; restricted-access classification for religion/political-opinion data; named monitoring officer for FETO returns.',
            reference: 'FETO monitoring confidentiality',
        },
    ],
    moduleConfig: {
        'governance-runtime': {
            s75GroundBranchGateRequired: true,
            fetoEmploymentContextGateRequired: true,
        },
        'bias-monitor': {
            s75GroundCoverage: [
                'religious_belief',
                'political_opinion',
                'racial_group',
                'age',
                'marital_status',
                'sexual_orientation',
                'disability',
                'dependants',
                'gender',
            ],
            fetoCommunityBackgroundMonitoringRequired: true,
        },
        'data-classifier': {
            enabledCategories: [
                'S75_GROUND',
                'EQIA_RECORD',
                'FETO_MONITORING',
                'ECNI_CORRESPONDENCE',
                'GOOD_RELATIONS_RECORD',
                'DISPARATE_IMPACT_NI',
                'CREDENTIALS',
            ],
            s75GroundAction: 'WARN',
            fetoMonitoringAction: 'WARN',
            credentialsAction: 'BLOCK',
        },
        'attestation-manager': {
            equalitySchemeRegistrationRequired: true,
            eqiaAttestationRequired: true,
            fetoAnnualReturnTrackingRequired: true,
            article55ReviewTracked: true,
            ecniEngagementRecorded: true,
        },
        'transparency-injector': {
            affectedPersonAiOutputDisclosureRequired: true,
            reasonableAdjustmentDisclosureRequired: true,
            eqiaConsultationPublicationRequired: true, // public authorities only
        },
        'approval-queue': {
            consequentialDecisionFairnessReviewRequired: true,
            fetoEmploymentDecisionSignOffRequired: true,
            eqiaApprovalRequired: true,
            reviewTier: 'T2',
        },
        'audit-integrity': {
            tribunalEvidenceTrackingRequired: true,
        },
        'event-bus': {
            disparityAlertsRequired: true,
            article55RemindersRequired: true,
            ecniEngagementRoutingRequired: true,
        },
        'session-persistence': {
            retentionDaysMinimum: 2190, // 6 years (Limitation NI Order 1989)
        },
        'agent-auth': {
            fetoMonitoringDataAccessControlsRequired: true,
            fetoMonitoringOfficerNamedRequired: true,
        },
    },
    providerPolicy: {
        blockedProviders: ['deepseek', 'baidu', 'alibaba'],
        requiredCapabilities: ['DATA-RESIDENCY-UK-OR-EU', 'PROCESSOR-CONTRACT', 'FETO-MONITORING-COMPATIBLE'],
        blockReasons: {
            deepseek: 'PRC jurisdiction. NI tribunal evidence chain + FETO monitoring data sensitivity exclude PRC routing.',
            baidu: 'PRC jurisdiction. Inadequate evidence chain for NI tribunal disclosure.',
            alibaba: 'PRC jurisdiction. Inadequate evidence chain for NI tribunal disclosure.',
        },
    },
    dataPolicy: {
        scanCategories: [
            'S75_GROUND',
            'EQIA_RECORD',
            'FETO_MONITORING',
            'ECNI_CORRESPONDENCE',
            'GOOD_RELATIONS_RECORD',
            'DISPARATE_IMPACT_NI',
            'CREDENTIALS',
        ],
        categoryActions: {
            S75_GROUND: 'WARN',
            EQIA_RECORD: 'WARN',
            FETO_MONITORING: 'WARN',
            ECNI_CORRESPONDENCE: 'WARN',
            GOOD_RELATIONS_RECORD: 'WARN',
            DISPARATE_IMPACT_NI: 'WARN',
            CREDENTIALS: 'BLOCK',
        },
        encryptionRequired: true,
        encryptionStandard: 'AES-256-GCM',
        minimumClassification: 'RESTRICTED',
    },
    retentionPolicy: {
        auditLogRetentionDays: 2190, // 6 years per Limitation (NI) Order 1989
        sessionRetentionDays: 2190,
        incidentRetentionDays: 2190,
        reference: 'Limitation (NI) Order 1989; FETO Article 55 3-yearly review evidence',
        forceDelete: false,
        requiresLegalHoldSupport: true,
        sovereignty: ['gb-nir', 'gb', 'eu'],
    },
    incidentPolicy: {
        notificationDeadlineHours: 168, // 7-day internal escalation; ECNI investigation cooperation timing varies
        reference: 'ECNI investigation cooperation; FETO Article 55 review cadence',
        requiredRecipients: ['legal-counsel', 'hr-director', 'data-protection-officer', 'feto-monitoring-officer'],
        formalNotificationRequired: false,
    },
    validators: [
        {
            id: 'ni-equality-s75-due-regard',
            description: 'Algorithmic decisions affecting NI residents satisfy s.75 due-regard requirement; equality scheme + EQIA evidence current for public authorities and contractors of public functions.',
            reference: 'NI Act 1998 s.75',
            check: 'governance_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'ni-equality-disparity-monitoring',
            description: 'Disparate-impact monitoring active across all 9 s.75 grounds; community-background subgroup analysis active.',
            reference: 'NI Act 1998 s.75; ECNI guidance',
            check: 'bias_monitor_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'ni-equality-feto-monitoring',
            description: 'FETO workforce monitoring active for employers; annual ECNI return scheduled; Article 55 3-yearly review tracked.',
            reference: 'FETO 1998 Article 55',
            check: 'attestation_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'ni-equality-feto-data-access',
            description: 'FETO monitoring data restricted-access controls in place; named monitoring officer; data-classifier flagging FETO data.',
            reference: 'FETO monitoring data confidentiality',
            check: 'rbac_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'ni-equality-good-relations',
            description: 'Good-relations duty (s.75(2)) evidence captured for public authorities; good-relations impact in EQIAs.',
            reference: 'NI Act 1998 s.75(2)',
            check: 'attestation_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'ni-equality-eqia-published',
            description: 'EQIA consultation published for material policy changes (public authorities); ECNI consultation captured.',
            reference: 'NI Act 1998 s.75 consultation',
            check: 'transparency_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'ni-equality-fairness-review-queue',
            description: 'Consequential AI decisions affecting s.75 grounds route to T2 fairness reviewer.',
            reference: 'NI Act 1998 s.75; ECNI guidance',
            check: 'approval_queue_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'ni-equality-tribunal-audit-trail',
            description: 'Tamper-evident audit trail captures s.75 ground decisions, FETO monitoring data access, EQIA revisions, ECNI correspondence as tribunal-grade evidence.',
            reference: 'Industrial + Fair Employment Tribunal disclosure',
            check: 'audit_trail_exists',
            failSeverity: 'HIGH',
        },
        {
            id: 'ni-equality-retention-6-year',
            description: 'NI equality evidence retained 6 years (Limitation NI Order); legal-hold support active for live tribunal claims.',
            reference: 'Limitation (NI) Order 1989',
            check: 'retention_policy_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'ni-equality-encryption',
            description: 'FETO monitoring data + s.75 ground data encrypted at rest and in transit.',
            reference: 'FETO monitoring data confidentiality; UK GDPR Art. 32',
            check: 'encryption_active',
            failSeverity: 'MEDIUM',
        },
    ],
};
//# sourceMappingURL=ni-equality.js.map