/**
 * ISO 26262 Automotive Functional Safety Compliance Pack
 *
 * ISO 26262:2018 — "Road vehicles — Functional safety." International standard
 * for functional safety of electrical and/or electronic (E/E) systems in road
 * vehicles. Replaces IEC 61508 as the sector-specific standard for automotive
 * E/E functional safety. The 2018 second edition extends scope from passenger
 * vehicles (first edition 2011) to trucks, buses, motorcycles, and trailers.
 *
 * Standards referenced (citations only; no verbatim text from the standard):
 *   - ISO 26262:2018 (all 12 parts) — Road vehicles — Functional safety
 *   - ISO 26262-3:2018 — Concept phase (item definition + HARA + FSC)
 *   - ISO 26262-4:2018 — System-level development (TSC + FTTI)
 *   - ISO 26262-5:2018 — Hardware development
 *   - ISO 26262-6:2018 — Software development (SSR + arch + unit verification)
 *   - ISO 26262-7:2018 — Production, operation, service, decommissioning
 *   - ISO 26262-8:2018 — Supporting processes (CM, change, TCL, DIA)
 *   - ISO 26262-9:2018 — ASIL-oriented + safety-oriented analyses (decomposition)
 *   - ISO 26262-10:2018 — Guidelines for ISO 26262 in general
 *   - ISO 26262-11:2018 — Guidelines for application to semiconductors
 *   - ISO 26262-12:2018 — Adaptation for motorcycles
 *   - ISO/SAE 21434:2021 — Road vehicle cybersecurity engineering (pairing standard)
 *   - UNECE WP.29 Regulations 155 (cybersecurity) + 156 (software updates)
 *   - NHTSA Defect Reporting 49 CFR Part 573 — 5-day/24h clock for safety-related defects
 *   - EU Type Approval Reg (EU) 2018/858 + Reg (EU) 2019/2144 (ALKS)
 *   - SAE J3016 — Automated driving taxonomy (L0–L5 reference for ASIL scope)
 *
 * ASIL Classification (ISO 26262-3 §6 — Hazard Analysis and Risk Assessment):
 *   Each safety goal is assigned an ASIL (Automotive Safety Integrity Level)
 *   derived from three parameters in the HARA:
 *     S — Severity   (S0–S3: no injury to life-threatening / fatal)
 *     E — Exposure   (E0–E4: incredible to high probability)
 *     C — Controllability (C0–C3: controllable to uncontrollable)
 *
 *   | ASIL | Risk  | Typical examples                                        |
 *   |------|-------|---------------------------------------------------------|
 *   | D    | Max   | Steering, service braking, airbag deployment            |
 *   | C    | High  | Adaptive cruise control, eCall emergency system         |
 *   | B    | Mod   | Lane-keep assist, blind-spot detection, TPMS            |
 *   | A    | Min   | Interior lighting controller, climate control actuation |
 *   | QM   | None  | Infotainment brightness — quality management only       |
 *
 *   ASIL D is the maximum process burden. QM is outside ISO 26262 functional
 *   safety scope (ordinary quality-management methods are sufficient).
 *   Default when ASIL not declared: ASIL B (conservative per §6.4.3).
 *
 * Key automotive customers:
 *   OEMs — BMW, Mercedes-Benz, Volkswagen Group, Stellantis, Toyota, GM,
 *           Ford, Hyundai-Kia, SAIC, Geely-Volvo, Tesla, Rivian
 *   Tier 1s — Bosch, Continental, ZF, Aptiv, Magna, Denso, Valeo, Vitesco,
 *              Forvia, Visteon, Lear, Panasonic Automotive
 *
 * Retention:
 *   ISO 26262-7 §6 + UNECE WP.29 Reg 79/156 require safety documentation
 *   to be retained for the vehicle service lifetime plus post-production
 *   support period. For passenger vehicles this is effectively 20 years
 *   (7300 days). NHTSA 49 CFR 573.8 mandates 10-year retention of defect
 *   records; the 20-year ISO 26262 / UNECE WP.29 window is more stringent.
 *
 * @connexum/ai-governance
 */
/**
 * ISO 26262 category classifiers.
 *
 * Covers ASIL classification signals, HARA artefacts, functional and
 * technical safety concepts, software safety requirements, ASIL-D
 * MC/DC coverage records, fault tree + FMEA artefacts, and tool
 * confidence level (TCL) qualification records per Part 8 §11.
 */
export const ISO_26262_CATEGORY_CLASSIFIERS = {
    /**
     * ASIL_D — Maximum automotive safety integrity level (ISO 26262-3 §6).
     * Represents uncontrollable, high-severity, high-exposure hazards.
     * Examples: steering control loss, service brake failure, airbag
     * inadvertent deployment / non-deployment. Unauthorised changes BLOCKED.
     */
    ASIL_D: {
        references: [
            'ISO 26262-3:2018 §6 — HARA; ASIL determination',
            'ISO 26262-4:2018 §6 — system safety requirements at ASIL D',
            'ISO 26262-6:2018 §9 — software unit verification at ASIL D (MC/DC required)',
        ],
        classifier: (input) => {
            if (/\b(?:ASIL[_\s-]?D|ASIL\s+D\s+(?:requirement|function|item|element|component)|automotive\s+safety\s+integrity\s+level\s+D)\b/i.test(input))
                return true;
            if (/\b(?:asil_d_function|ASIL_D_ITEM|ASIL_D_ELEMENT|asild|ASILD)\b/.test(input))
                return true;
            if (/\b(?:steering\s+(?:control|loss|failure)\s+ASIL|service\s+brake\s+(?:failure|ASIL)|airbag\s+(?:ASIL|deployment\s+ASIL))\b/i.test(input))
                return true;
            return false;
        },
    },
    /**
     * ASIL_C — High automotive safety integrity level (ISO 26262-3 §6).
     * High-severity, moderate-exposure hazards; possibly survivable serious
     * injuries. Examples: adaptive cruise control, emergency call (eCall).
     * Anomaly closure requires approval-queue gate.
     */
    ASIL_C: {
        references: [
            'ISO 26262-3:2018 §6 — HARA; ASIL C determination',
            'ISO 26262-6:2018 §7 — software architectural design at ASIL C',
        ],
        classifier: (input) => {
            if (/\b(?:ASIL[_\s-]?C|ASIL\s+C\s+(?:requirement|function|item|element|component)|automotive\s+safety\s+integrity\s+level\s+C)\b/i.test(input))
                return true;
            if (/\b(?:asil_c_function|ASIL_C_ITEM|ASIL_C_ELEMENT|asilc|ASILC)\b/.test(input))
                return true;
            return false;
        },
    },
    /**
     * ASIL_B — Moderate automotive safety integrity level (ISO 26262-3 §6).
     * Moderate-severity or moderate-exposure hazards; light to moderate
     * injuries. Examples: lane-keep assist, blind-spot detection, TPMS.
     * Default classification when ASIL not declared.
     */
    ASIL_B: {
        references: [
            'ISO 26262-3:2018 §6 — HARA; ASIL B determination',
            'ISO 26262-6:2018 §6 — software safety requirements at ASIL B',
        ],
        classifier: (input) => {
            if (/\b(?:ASIL[_\s-]?B|ASIL\s+B\s+(?:requirement|function|item|element|component)|automotive\s+safety\s+integrity\s+level\s+B)\b/i.test(input))
                return true;
            if (/\b(?:asil_b_function|ASIL_B_ITEM|ASIL_B_ELEMENT|asilb|ASILB)\b/.test(input))
                return true;
            return false;
        },
    },
    /**
     * ASIL_A — Minimum functional safety level (ISO 26262-3 §6).
     * Low-severity, high-controllability hazards; minor / non-injury.
     * Examples: interior lighting controller, climate control actuation.
     * ALLOWED with audit logging; basic process objectives apply.
     */
    ASIL_A: {
        references: [
            'ISO 26262-3:2018 §6 — HARA; ASIL A determination',
        ],
        classifier: (input) => {
            if (/\b(?:ASIL[_\s-]?A|ASIL\s+A\s+(?:requirement|function|item|element|component)|automotive\s+safety\s+integrity\s+level\s+A)\b/i.test(input))
                return true;
            if (/\b(?:asil_a_function|ASIL_A_ITEM|ASIL_A_ELEMENT|asila|ASILA)\b/.test(input))
                return true;
            return false;
        },
    },
    /**
     * QM — Quality Management only; outside ISO 26262 functional safety scope
     * (ISO 26262-3 §6.4.1). Normal product-quality methods apply; no
     * ISO 26262 process objectives. Logging only for classification traceability.
     */
    QM: {
        references: [
            'ISO 26262-3:2018 §6.4.1 — QM: no ASIL requirements; quality management sufficient',
        ],
        classifier: (input) => {
            if (/\b(?:QM\s+(?:function|item|element|component|classification)|quality\s+management\s+only\s+(?:ISO.?26262|ASIL)|ASIL[_\s-]?QM)\b/i.test(input))
                return true;
            if (/\b(?:asil_qm|ASIL_QM|qm_function|QM_ITEM)\b/.test(input))
                return true;
            return false;
        },
    },
    /**
     * HARA_ARTEFACT — Hazard Analysis and Risk Assessment artefacts
     * (ISO 26262-3 §6). Foundational document that determines ASIL.
     * Includes hazard catalogues, risk assessments, safety goals, and
     * rationale for ASIL assignment. Changes require immediate review.
     */
    HARA_ARTEFACT: {
        references: [
            'ISO 26262-3:2018 §6 — Hazard Analysis and Risk Assessment',
            'ISO 26262-3:2018 §6.4 — determination of ASIL and safety goals',
        ],
        classifier: (input) => {
            if (/\b(?:HARA|hazard\s+analysis\s+(?:and\s+)?risk\s+assessment|hazard\s+catalogue|risk\s+assessment\s+(?:ISO.?26262|automotive)|safety\s+goal\s+(?:ASIL|ISO.?26262))\b/i.test(input))
                return true;
            if (/\b(?:HARA_(?:document|record|update|review)|hara_doc|hazard_analysis_record)\b/.test(input))
                return true;
            return false;
        },
    },
    /**
     * FUNCTIONAL_SAFETY_CONCEPT — Output of ISO 26262-3 §7.
     * Documents functional safety requirements (FSR) derived from the
     * safety goals + HARA. Includes preliminary architecture, FTTI
     * (fault tolerant time interval) requirements, and safe states.
     * Required before any system or software development artefact.
     */
    FUNCTIONAL_SAFETY_CONCEPT: {
        references: [
            'ISO 26262-3:2018 §7 — Functional safety concept',
            'ISO 26262-3:2018 §7.4 — functional safety requirements allocation',
        ],
        classifier: (input) => {
            if (/\b(?:functional\s+safety\s+concept|FSC\s+(?:document|record|update)|functional\s+safety\s+requirement[s]?\s+(?:ISO.?26262|automotive|FSR))\b/i.test(input))
                return true;
            if (/\b(?:FTTI|fault\s+tolerant\s+time\s+interval|safe\s+state\s+(?:requirement|definition|ISO.?26262))\b/i.test(input))
                return true;
            return false;
        },
    },
    /**
     * SOFTWARE_SAFETY_REQUIREMENT — Software safety requirements (SSR) per
     * ISO 26262-6 §6. Derived from the technical safety concept (TSC).
     * Includes software safety requirements + rationale. Required for
     * ASIL A/B/C/D software elements. REVIEWED on change.
     */
    SOFTWARE_SAFETY_REQUIREMENT: {
        references: [
            'ISO 26262-6:2018 §6 — software safety requirements',
            'ISO 26262-4:2018 §6 — technical safety concept (TSC source)',
        ],
        classifier: (input) => {
            if (/\b(?:software\s+safety\s+requirement[s]?\s+(?:ISO.?26262|ASIL|SSR)|SSR\s+(?:document|record|specification|update))\b/i.test(input))
                return true;
            if (/\b(?:technical\s+safety\s+concept\s+(?:document|record)|TSC\s+(?:document|record|update|ISO.?26262))\b/i.test(input))
                return true;
            return false;
        },
    },
    /**
     * MC_DC_COVERAGE_ASIL_D — Modified Condition / Decision Coverage records
     * for ASIL D software (ISO 26262-6 §9 + Table 12). MANDATORY at 100%
     * for ASIL D software units. MC/DC is HIGHLY RECOMMENDED for ASIL C.
     * Changes to ASIL D units without MC/DC evidence BLOCKED.
     */
    MC_DC_COVERAGE_ASIL_D: {
        references: [
            'ISO 26262-6:2018 §9 — software unit verification',
            'ISO 26262-6:2018 Table 12 — structural coverage at unit level (ASIL D: MC/DC mandatory)',
        ],
        classifier: (input) => {
            if (/\b(?:MC.?DC\s+(?:coverage|record|analysis|ASIL.?D)|modified\s+condition\s*\/?\s*decision\s+coverage\s+(?:ASIL|automotive))\b/i.test(input))
                return true;
            if (/\b(?:structural\s+coverage\s+ASIL.?D|ASIL.?D\s+MC.?DC|coverage\s+record\s+(?:ASIL|ISO.?26262))\b/i.test(input))
                return true;
            return false;
        },
    },
    /**
     * TOOL_CONFIDENCE_LEVEL — TCL classification records per ISO 26262-8 §11.
     * Every tool used in the safety lifecycle must be classified:
     *   TCL 1 (no confidence measures) / TCL 2 (validation only) / TCL 3 (full qualification).
     * AI-assisted code generation, static analysis, and test generation tools
     * targeting ASIL B/C/D typically require TCL 2 or TCL 3.
     */
    TOOL_CONFIDENCE_LEVEL: {
        references: [
            'ISO 26262-8:2018 §11 — Tool confidence level (TCL)',
            'ISO 26262-8:2018 §11.4.7 — TCL determination',
        ],
        classifier: (input) => {
            if (/\b(?:TCL[_\s-]?[123]|tool\s+confidence\s+level|TCL\s+(?:classification|determination|assessment|ISO.?26262))\b/i.test(input))
                return true;
            if (/\b(?:tool_qualification\s+(?:ISO.?26262|automotive)|tool\s+error\s+detection\s+(?:TD|ISO.?26262))\b/i.test(input))
                return true;
            return false;
        },
    },
};
/**
 * ISO 26262 Automotive Functional Safety Compliance Pack.
 *
 * Pack ID: 'iso-26262'
 * Jurisdiction: International (ISO TC 22/SC 32 joint standard; mandated
 *   by EU type approval (EU) 2018/858 + (EU) 2019/2144 ALKS, UNECE WP.29,
 *   adopted by NHTSA, China GB/T 34590, Korea K-ETAS, Japan JASO Z 0001,
 *   India AIS 172, and all major OEM supplier-quality agreements).
 *
 * Guard-layer wiring:
 *   - G1-G4 (audit, logging, classification, session): always active
 *   - G5-G6 (supply-chain TCL, approval-queue): ASIL A/B/C/D
 *   - G7-G8 (attestation, anomaly-detection): ASIL B/C/D
 *   - G9 (transparency): ASIL D only (maximum disclosure burden)
 *   - Approval Queue: always active (ASIL D/C immediate; ASIL B closure)
 *
 * Human-in-loop tier:
 *   - T1: ASIL A (engineering safety review)
 *   - T2: ASIL B/C/D (certified functional safety engineer / TÜV/DEKRA/SGS)
 */
export const ISO_26262_PACK = {
    categoryClassifiers: ISO_26262_CATEGORY_CLASSIFIERS,
    /**
     * HARA artefacts and safety concept documents are subject-keyed
     * per item / safety goal — they must be traceable to specific
     * vehicle functions under Part 3.
     */
    subjectKeyedCategories: [
        'HARA_ARTEFACT',
        'FUNCTIONAL_SAFETY_CONCEPT',
        'SOFTWARE_SAFETY_REQUIREMENT',
        'MC_DC_COVERAGE_ASIL_D',
        'TOOL_CONFIDENCE_LEVEL',
    ],
    id: 'iso-26262',
    name: 'ISO 26262 Automotive Functional Safety',
    version: '1.0.0',
    contentHash: 'd9573c217fc5efafb3db5639ac4604ee779d3d29438dcbabaf0d359817722f54',
    description: 'ISO 26262:2018 Road vehicles — Functional safety. International standard for ' +
        'E/E (electrical/electronic) system functional safety in passenger cars, trucks, ' +
        'buses, motorcycles, and trailers. Five ASIL levels (D: maximum — steering/braking; ' +
        'C: adaptive cruise / eCall; B: lane-keep / TPMS; A: lighting / climate; QM: outside ' +
        'functional safety scope) drive scaled process objectives. Validators cover HARA + item ' +
        'definition + functional + technical safety concepts (Parts 3–4), software safety ' +
        'requirements + architectural design + unit verification + ASIL-D MC/DC coverage ' +
        '(Part 6), ASIL decomposition + FMEA + fault-tree analysis (Part 9), tool confidence ' +
        'level (TCL) qualification (Part 8 §11), and configuration + change management (Part 8). ' +
        '20-year vehicle-lifetime retention. 30-day NHTSA defect notification. Reviewer tier: ' +
        'TÜV / SGS / DEKRA functional-safety-engineer-certified.',
    authority: 'ISO/TC 22/SC 32 (Road vehicles — Electrical and electronic components and general ' +
        'system aspects); UNECE WP.29; widely adopted by NHTSA, EU type approval (Reg (EU) ' +
        '2018/858 + 2019/2144), China GB/T 34590, Korea K-ETAS, Japan JASO Z 0001',
    industries: [
        'automotive',
        'autonomous-vehicles',
        'tier-1-supplier',
        'tier-2-supplier',
        'commercial-vehicles',
        'motorcycles',
        'electric-vehicles',
        'embedded-automotive',
        'adas',
        'powertrain-control',
        'chassis-control',
        'occupant-safety',
    ],
    requiredModules: [
        {
            name: 'governance-runtime',
            required: true,
            reason: 'ASIL tracking (A/B/C/D/QM) mandatory for every ISO 26262 process gate. ' +
                'ASIL D changes require blocking until verification + DER-equivalent review. ' +
                'ASIL C changes require approval gate. Governance runtime enforces HARA ' +
                'and functional safety concept prerequisite checks before software work proceeds.',
            reference: 'ISO 26262-3:2018 §6 — HARA + ASIL determination; ISO 26262-4:2018 §6 — TSC',
        },
        {
            name: 'audit-integrity',
            required: true,
            reason: 'Tamper-evident records for safety lifecycle artefacts: HARA, item definition, ' +
                'functional safety concept, technical safety concept, software safety requirements, ' +
                'software architectural design, unit verification records, FMEA/fault-tree reports, ' +
                'and tool confidence level qualification evidence. Required for UNECE WP.29 ' +
                'type-approval audit trails and NHTSA defect investigation submissions.',
            reference: 'ISO 26262-8:2018 §7 — configuration management; ISO 26262-7:2018 §6 — documentation',
        },
        {
            name: 'data-classifier',
            required: true,
            reason: 'ASIL signal detection (A/B/C/D/QM); HARA artefact categorisation; functional ' +
                'safety concept and software safety requirement identification; MC/DC coverage ' +
                'record tracking for ASIL D; TCL qualification artefact scanning.',
            reference: 'ISO 26262-3:2018 §6 — ASIL classification; ISO 26262-8:2018 §11 — TCL',
        },
        {
            name: 'supply-chain',
            required: true,
            reason: 'Tool confidence level (TCL) inventory per ISO 26262-8 §11; COTS component ' +
                'qualification under Part 8 §12; AUTOSAR and RTOS evaluation. AI-assisted ' +
                'code generation tools targeting ASIL B/C/D require TCL 2 or TCL 3 ' +
                'qualification with tool validation plan and usage guidance before outputs ' +
                'are accepted as satisfying safety requirements.',
            reference: 'ISO 26262-8:2018 §11 — tool confidence level; §12 — qualification of software components',
        },
        {
            name: 'approval-queue',
            required: true,
            reason: 'ASIL D change approval (functional-safety-engineer sign-off required). ' +
                'ASIL C change approval gate. ASIL B anomaly closure review. All safety ' +
                'goal changes and HARA updates require human review before downstream ' +
                'requirements and design work proceeds. Qualification of any new ' +
                'COTS/SOUP component requires approval-queue routing.',
            reference: 'ISO 26262-8:2018 §8 — change management; ISO 26262-3:2018 §7 — functional safety concept',
        },
        {
            name: 'attestation-manager',
            required: true,
            reason: 'Safety case attestation; functional safety assessment (FSA) sign-off; ' +
                'ASIL D MC/DC coverage attestation; software release attestation (DIA — ' +
                'development interface agreement); confirmation of ASIL-D unit verification ' +
                'completion. Certification engineers (TÜV / SGS / DEKRA) sign the safety ' +
                'case at vehicle-level sign-off.',
            reference: 'ISO 26262-2:2018 §6 — functional safety management; ISO 26262-8:2018 §5 — DIA',
        },
        {
            name: 'session-persistence',
            required: true,
            reason: 'ISO 26262 safety documentation must persist for the vehicle operational ' +
                'lifetime plus post-production support (effective 20 years per UNECE WP.29 ' +
                'Reg 79/156). Continuity of HARA, safety concept, and verification records ' +
                'across sessions is mandatory for in-service defect investigation, field ' +
                'monitoring, and recall analysis under NHTSA 49 CFR Part 573.',
            reference: 'ISO 26262-7:2018 §6 — documentation retention; UNECE WP.29 Reg 79/156',
        },
        {
            name: 'anomaly-detector',
            required: true,
            reason: 'Real-time detection of unverified changes to ASIL D/C safety elements. ' +
                'Flags conditions that may require immediate safety engineer notification. ' +
                'Detects ASIL D software modifications without verification record — must ' +
                'block immediately. Detects ASIL C anomalies requiring immediate escalation ' +
                'to functional safety manager.',
            reference: 'ISO 26262-8:2018 §8 — change management; ISO 26262-6:2018 §9 — unit verification',
        },
        {
            name: 'transparency-injector',
            required: true,
            reason: 'AI-generated code provenance disclosure to functional safety engineers, ' +
                'certification authorities (TÜV / SGS / DEKRA), and OEM safety managers. ' +
                'Tool confidence level (TCL) status disclosure on every AI output used in ' +
                'a safety lifecycle task without independent manual verification.',
            reference: 'ISO 26262-8:2018 §11 — TCL disclosure; ISO 26262-2:2018 §6 — safety management',
        },
        {
            name: 'event-bus',
            required: true,
            reason: 'ASIL D change event routing; HARA update lifecycle events; safety goal ' +
                'change notification; FMEA / fault-tree analysis milestone events; TCL ' +
                'qualification status events; in-vehicle field monitoring notification routing ' +
                'for post-production change management under Part 7.',
            reference: 'ISO 26262-7:2018 §5 — field monitoring; ISO 26262-8:2018 §8 — change management lifecycle',
        },
    ],
    moduleConfig: {
        'governance-runtime': {
            asilTrackingRequired: true,
            asilDChangeApprovalRequired: true,
            asilCChangeApprovalRequired: true,
            asilBAnomalyClosureApprovalRequired: true,
            asilDAnomalyImmediateEscalationRequired: true,
            asilCAnomalyImmediateEscalationRequired: true,
            iso26262Part6SoftwareProcessRequired: true,
            haraRequired: true,
            itemDefinitionRequired: true,
            functionalSafetyConceptRequired: true,
        },
        'approval-queue': {
            asilDChangeApprovalRequired: true,
            asilCChangeApprovalRequired: true,
            asilBAnomalyClosureApprovalRequired: true,
            functionalSafetyEngineerReviewRequired: true,
            humanInLoopTierAsilA: 'T1',
            humanInLoopTierAsilBCD: 'T2',
        },
        'attestation-manager': {
            safetyAssessmentAttestationRequired: true,
            asilDMcDcCoverageAttestationRequired: true,
            softwareReleaseAttestationRequired: true,
            functionalSafetyAssessmentSignOffRequired: true,
            itemDefinitionAttestationRequired: true,
        },
        'supply-chain': {
            toolConfidenceLevelInventoryRequired: true,
            tclClassificationRequired: true,
            cotsComponentQualificationRequired: true,
            autosarRtosEvaluationRequired: true,
            aiCodeGenToolTclRequired: true,
        },
        'anomaly-detector': {
            asilDAnomalyImmediateEscalationRequired: true,
            asilCAnomalyImmediateEscalationRequired: true,
            unverifiedAsilDChangeDetectionActive: true,
        },
        'transparency-injector': {
            aiGeneratedCodeProvenanceDisclosureRequired: true,
            toolConfidenceLevelDisclosureRequired: true,
        },
        'event-bus': {
            asilDChangeEventsActive: true,
            haraUpdateEventsActive: true,
            safetyGoalChangeEventsActive: true,
            tclQualificationStatusEventsActive: true,
            fieldMonitoringEventsActive: true,
        },
    },
    providerPolicy: {
        blockedProviders: ['deepseek', 'baidu', 'alibaba'],
        requiredCapabilities: ['ISO-26262-READY', 'AUTOMOTIVE-SAFETY-LIFECYCLE'],
        blockReasons: {
            deepseek: 'PRC-jurisdiction LLM providers cannot meet UNECE WP.29 / EU type-approval ' +
                'data-handling requirements for safety-critical automotive E/E development. ' +
                'ASIL D artefacts and HARA records require verifiable non-PRC jurisdiction ' +
                'under EU Reg (EU) 2018/858 type-approval bilateral agreements and ITAR/EAR ' +
                'dual-use controls on automotive safety software.',
            baidu: 'PRC-jurisdiction LLM; automotive functional safety records (HARA, safety ' +
                'concept, ASIL D verification evidence) must remain under verifiable non-PRC ' +
                'jurisdiction control per UNECE WP.29 data sovereignty requirements and ' +
                'PRC data localisation law (DSL + CSL). EU type-approval certification ' +
                'authority access requirements are incompatible with PRC data residency.',
            alibaba: 'PRC-jurisdiction LLM; ASIL D and ASIL C safety lifecycle artefacts must ' +
                'remain outside PRC data jurisdiction per UNECE WP.29 Reg 155 cybersecurity ' +
                'requirements and EU (EU) 2019/2144 ALKS type-approval data-handling ' +
                'obligations. PRC dual-use export controls on automotive E/E safety software ' +
                'create unresolvable compliance conflict.',
        },
    },
    dataPolicy: {
        scanCategories: [
            'ASIL_D',
            'ASIL_C',
            'ASIL_B',
            'ASIL_A',
            'QM',
            'HARA_ARTEFACT',
            'FUNCTIONAL_SAFETY_CONCEPT',
            'SOFTWARE_SAFETY_REQUIREMENT',
            'MC_DC_COVERAGE_ASIL_D',
            'TOOL_CONFIDENCE_LEVEL',
        ],
        categoryActions: {
            // ASIL D: unauthorised changes BLOCKED — functional safety engineer required
            ASIL_D: 'BLOCK',
            // ASIL C: changes enter approval queue for safety engineer review
            ASIL_C: 'REVIEWED',
            // ASIL B: anomaly closure requires approval; changes logged
            ASIL_B: 'REVIEWED',
            // ASIL A: logging sufficient for basic engineering review
            ASIL_A: 'LOG',
            // QM: outside functional safety scope; logging for classification traceability
            QM: 'LOG',
            // HARA artefacts: REVIEWED — changes require HARA update review
            HARA_ARTEFACT: 'REVIEWED',
            // Functional safety concept: REVIEWED — changes affect all downstream work
            FUNCTIONAL_SAFETY_CONCEPT: 'REVIEWED',
            // Software safety requirements: REVIEWED — changes traced to safety goals
            SOFTWARE_SAFETY_REQUIREMENT: 'REVIEWED',
            // MC/DC coverage records: BLOCK without verification evidence
            MC_DC_COVERAGE_ASIL_D: 'BLOCK',
            // TCL records: REVIEWED — TCL changes require re-evaluation
            TOOL_CONFIDENCE_LEVEL: 'REVIEWED',
        },
        encryptionRequired: true,
        encryptionStandard: 'AES-256-GCM',
        minimumClassification: 'RESTRICTED',
    },
    retentionPolicy: {
        /**
         * ISO 26262-7:2018 §6 + UNECE WP.29 Reg 79 (typeapproval) + Reg 156
         * (software updates) require safety documentation to be retained for the
         * vehicle operational lifetime plus post-production support obligations.
         * For passenger vehicles this is effectively 20 years (7300 days).
         * NHTSA 49 CFR 573.8 mandates 10-year defect record retention; the
         * 20-year ISO 26262 / UNECE WP.29 period is the more stringent requirement
         * and governs this pack.
         */
        sovereignty: ['international'],
        auditLogRetentionDays: 7300, // 20 years — vehicle lifetime + post-production support
        sessionRetentionDays: 7300,
        incidentRetentionDays: 7300,
        reference: 'ISO 26262-7:2018 §6 — documentation retention for vehicle operational lifetime. ' +
            'UNECE WP.29 Reg 79/156 — type-approval and software update documentation obligations. ' +
            'NHTSA 49 CFR 573.8 — 10-year defect record minimum (ISO 26262 20-year period governs). ' +
            'Effective minimum: 20 years (7300 days).',
    },
    incidentPolicy: {
        /**
         * NHTSA 49 CFR Part 573 — Defect and Noncompliance Reporting:
         *   §573.6(a): manufacturer that learns of a safety defect must report to
         *   NHTSA within 5 working days if it determines that a defect exists.
         *   Self-discovered defects: formal report within 30 days per §573.6(c).
         *   Using 720 hours (30 days) as the baseline for self-discovered defects.
         * EU Type Approval Reg (EU) 2018/858 Art. 20 + UNECE WP.29:
         *   Market surveillance authorities must be notified without undue delay.
         * OEM customer liaison notification: DIA-governed; OEM-specific SLAs
         *   typically require immediate notification for ASIL D field events.
         */
        notificationDeadlineHours: 720, // 30 days — NHTSA self-discovered defect reporting baseline
        reference: 'NHTSA 49 CFR Part 573 §573.6(c) — 30-day (720h) window for self-discovered safety ' +
            'defects. EU Reg (EU) 2018/858 Art. 20 — type-approval market surveillance notification. ' +
            'UNECE WP.29 Reg 79/156 — safety-related software update notification obligations. ' +
            'ISO 26262-7:2018 §5 — field monitoring and customer notification requirements.',
        requiredRecipients: [
            'safety-manager',
            'quality-management',
            'product-engineering',
            'regulatory-affairs',
            'oem-customer-liaison',
        ],
        formalNotificationRequired: true,
    },
    validators: [
        {
            id: 'iso26262-asil-assigned',
            description: 'ASIL (A, B, C, D, or QM) assigned to every safety-related E/E function ' +
                'with documented rationale derived from the HARA (Severity × Exposure × ' +
                'Controllability per ISO 26262-3 §6.4.3). Default: ASIL B when not declared.',
            reference: 'ISO 26262-3:2018 §6 — Item Definition + HARA; §6.4.3 ASIL determination',
            check: 'iso26262_asil_assigned',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'iso26262-item-definition',
            description: 'Item definition documented per ISO 26262-3 §5: item boundary, functions, ' +
                'operating modes, known hazardous events, legal and regulatory constraints, ' +
                'and preliminary hazardous events with initial risk estimates on file.',
            reference: 'ISO 26262-3:2018 §5 — Item definition',
            check: 'iso26262_item_definition_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'iso26262-hara-active',
            description: 'Hazard Analysis and Risk Assessment (HARA) document on file; hazard catalogue ' +
                'complete; every safety goal has assigned ASIL with S/E/C rationale; HARA ' +
                'reviewed and approved by functional safety manager.',
            reference: 'ISO 26262-3:2018 §6 — Hazard Analysis and Risk Assessment',
            check: 'iso26262_hara_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'iso26262-functional-safety-concept',
            description: 'Functional Safety Concept (FSC) established; functional safety requirements ' +
                '(FSR) derived from safety goals; preliminary architectural assumptions ' +
                'documented; safe states and FTTI (fault-tolerant time interval) defined ' +
                'for every ASIL B/C/D safety goal.',
            reference: 'ISO 26262-3:2018 §7 — Functional safety concept',
            check: 'iso26262_functional_safety_concept_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'iso26262-technical-safety-concept',
            description: 'Technical Safety Concept (TSC) on file per ISO 26262-4 §6; technical safety ' +
                'requirements (TSR) allocated to system elements; hardware-software interface ' +
                '(HSI) specification draft; preliminary system architecture reflecting ASIL ' +
                'decomposition decisions.',
            reference: 'ISO 26262-4:2018 §6 — Technical safety concept',
            check: 'iso26262_technical_safety_concept_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'iso26262-software-safety-requirements',
            description: 'Software safety requirements (SSR) derived from the TSC and documented per ' +
                'ISO 26262-6 §6; traceable to technical safety requirements; rationale for ' +
                'derived SSR on file; SSR review and approval complete for ASIL B/C/D.',
            reference: 'ISO 26262-6:2018 §6 — Software safety requirements',
            check: 'iso26262_software_safety_requirements_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'iso26262-software-architectural-design',
            description: 'Software architectural design documented per ISO 26262-6 §7; software ' +
                'components and their safety properties defined; data and control flow ' +
                'between components described; design rationale traceable to SSR; ' +
                'ASIL D: formal notation or semi-formal notation required.',
            reference: 'ISO 26262-6:2018 §7 — Software architectural design',
            check: 'iso26262_software_architectural_design_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'iso26262-unit-verification',
            description: 'Software unit verification per ISO 26262-6 §9; unit test cases cover ' +
                'requirements and structural coverage criteria for the applicable ASIL; ' +
                'unit verification evidence on file with traceability to SSR.',
            reference: 'ISO 26262-6:2018 §9 — Software unit verification',
            check: 'iso26262_unit_verification_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'iso26262-asil-d-mc-dc-coverage',
            description: 'ASIL D: Modified Condition / Decision Coverage (MC/DC) at 100% achieved ' +
                'and verified; MC/DC evidence on file per ISO 26262-6 Table 12. ASIL C: ' +
                'MC/DC highly recommended (HR); coverage gaps require documented rationale. ' +
                'Unverified ASIL D changes BLOCKED pending MC/DC re-analysis.',
            reference: 'ISO 26262-6:2018 §9 + Table 12 — structural coverage; MC/DC mandatory for ASIL D',
            check: 'iso26262_asil_d_mc_dc_coverage_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'iso26262-asil-decomposition',
            description: 'ASIL decomposition rules applied per ISO 26262-9 §5 when decomposing ' +
                'a safety goal into redundant elements (e.g., ASIL D → ASIL B + ASIL B(D); ' +
                'ASIL C → ASIL A + ASIL A(C)). Independent implementation requirement ' +
                'documented and verified for each decomposition.',
            reference: 'ISO 26262-9:2018 §5 — ASIL-oriented analyses: ASIL decomposition',
            check: 'iso26262_asil_decomposition_active',
            failSeverity: 'MEDIUM',
        },
        {
            id: 'iso26262-fmea-fault-tree',
            description: 'Safety analyses per ISO 26262-9 §8: FMEA (Failure Mode and Effects Analysis) ' +
                'or fault-tree analysis (FTA) on file at the appropriate level; results ' +
                'traceable to HARA safety goals; ASIL D requires both FMEA and FTA at ' +
                'system and hardware level.',
            reference: 'ISO 26262-9:2018 §8 — Safety analyses: FMEA, FTA, FMEDA',
            check: 'iso26262_fmea_fault_tree_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'iso26262-tool-confidence-level',
            description: 'Tool Confidence Level (TCL) classification per ISO 26262-8 §11 for every ' +
                'software tool in the safety lifecycle. TCL 1 (no confidence measures), ' +
                'TCL 2 (validation), or TCL 3 (full qualification with TQP) assigned with ' +
                'rationale. AI code generation and static analysis tools targeting ASIL B/C/D ' +
                'typically require TCL 2 or TCL 3.',
            reference: 'ISO 26262-8:2018 §11 — Tool confidence level (TCL) classification and qualification',
            check: 'iso26262_tool_confidence_level_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'iso26262-config-management',
            description: 'Configuration management plan active per ISO 26262-8 §7; all safety ' +
                'lifecycle artefacts under configuration control; baseline records on file; ' +
                'change control procedures enforced; configuration items identified with ' +
                'traceability to safety goals.',
            reference: 'ISO 26262-8:2018 §7 — Configuration management',
            check: 'iso26262_config_management_active',
            failSeverity: 'MEDIUM',
        },
        {
            id: 'iso26262-change-management',
            description: 'Change management process active per ISO 26262-8 §8; all changes to ' +
                'safety-relevant items assessed for safety impact; change impact analysis ' +
                'on file; ASIL D and ASIL C changes require functional safety engineer ' +
                'approval before implementation.',
            reference: 'ISO 26262-8:2018 §8 — Change management',
            check: 'iso26262_change_management_active',
            failSeverity: 'MEDIUM',
        },
        {
            id: 'iso26262-behavioral-validator-asil-d-unverified-change',
            description: 'Behavioral validator: detects unverified software changes to ASIL D elements. ' +
                'Any AI-generated or agent-initiated modification to an ASIL D software unit ' +
                'must be blocked pending unit verification completion, MC/DC coverage ' +
                're-analysis at 100%, and functional safety engineer impact review. ' +
                'No partial-pass path: ASIL D unverified changes are an absolute block.',
            reference: 'ISO 26262-6:2018 §9 — unit verification; §9 Table 12 — MC/DC mandatory for ASIL D; ' +
                'ISO 26262-8:2018 §11 — TCL for AI code generation tools',
            check: 'behavioralValidator_iso26262_asil_d_unverified_change',
            failSeverity: 'CRITICAL',
        },
    ],
};
//# sourceMappingURL=iso-26262.js.map