{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://intelligence.metatron.marketing/governance/incident-hazard-public.schema.json",
  "title": "Metatron Intelligence public AI incident and hazard projection",
  "description": "Strict public projection after editorial admission. It is not the raw submission contract and excludes restricted reporter and evidence fields.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "recordId", "revision", "publicationState", "eventKind", "title", "description", "aiRelationship", "harm", "evidence", "assessment", "frameworkMappings", "publication", "limitations"],
  "properties": {
    "schema": {"const": "metatron.intelligence.ai-incident-hazard-public.v1"},
    "recordId": {"type": "string", "pattern": "^MIH-[0-9]{4}-[0-9]{6}$"},
    "revision": {"type": "integer", "minimum": 1},
    "publicationState": {"enum": ["published", "corrected", "superseded", "retracted", "expired"]},
    "eventKind": {"enum": ["incident", "hazard", "near_miss", "vulnerability", "error", "unclear"]},
    "title": {"type": "string", "minLength": 1},
    "description": {"type": "string", "minLength": 1},
    "aiRelationship": {
      "type": "object",
      "additionalProperties": false,
      "required": ["relationship", "system", "version", "useContext", "causalClaimStatus"],
      "properties": {
        "relationship": {"enum": ["direct", "indirect", "contributing", "unclear"]},
        "system": {"type": ["string", "null"]},
        "version": {"type": ["string", "null"]},
        "useContext": {"type": "string", "minLength": 1},
        "causalClaimStatus": {"enum": ["supported", "partially_supported", "contested", "unverified", "refuted"]}
      }
    },
    "harm": {
      "type": "object",
      "additionalProperties": false,
      "required": ["actual", "plausiblePath", "domains", "affectedStakeholders", "geography"],
      "properties": {
        "actual": {"type": "boolean"},
        "plausiblePath": {"type": ["string", "null"]},
        "domains": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}},
        "affectedStakeholders": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}},
        "geography": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}}
      }
    },
    "evidence": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["sourceUrl", "title", "publisher", "publicationDate", "retrievedAt", "supportStatus", "locator", "boundary"],
        "properties": {
          "sourceUrl": {"type": "string", "format": "uri", "pattern": "^https://"},
          "title": {"type": "string", "minLength": 1},
          "publisher": {"type": "string", "minLength": 1},
          "publicationDate": {"type": ["string", "null"], "format": "date"},
          "retrievedAt": {"type": "string", "format": "date-time"},
          "supportStatus": {"enum": ["supported", "partially_supported", "contested", "unverified", "refuted"]},
          "locator": {"type": ["string", "null"]},
          "boundary": {"type": "string", "minLength": 1}
        }
      }
    },
    "assessment": {
      "type": "object",
      "additionalProperties": false,
      "required": ["supportStatus", "confidence", "counterevidence", "unresolvedQuestions", "reviewerRole", "reviewedAt"],
      "properties": {
        "supportStatus": {"enum": ["supported", "partially_supported", "contested", "unverified", "refuted"]},
        "confidence": {"enum": ["low", "medium", "high", "unknown"]},
        "counterevidence": {"type": "array", "items": {"type": "string", "minLength": 1}},
        "unresolvedQuestions": {"type": "array", "items": {"type": "string", "minLength": 1}},
        "reviewerRole": {"type": "string", "minLength": 1},
        "reviewedAt": {"type": "string", "format": "date-time"}
      }
    },
    "frameworkMappings": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["mappingId", "sourceNamespace", "sourceVersion", "sourceElement", "relation", "direction", "rationale", "limitation", "assessmentStatus", "reviewerRole", "reviewedAt"],
        "properties": {
          "mappingId": {"type": "string", "minLength": 1},
          "sourceNamespace": {"type": "string", "minLength": 1},
          "sourceVersion": {"type": "string", "minLength": 1},
          "sourceElement": {"type": "string", "minLength": 1},
          "relation": {"enum": ["exact", "partial", "related", "conflict", "none"]},
          "direction": {"enum": ["source_to_record", "record_to_source", "bidirectional"]},
          "rationale": {"type": "string", "minLength": 1},
          "limitation": {"type": "string", "minLength": 1},
          "assessmentStatus": {"enum": ["editorial_mapping", "qualified_legal_review", "review_due"]},
          "reviewerRole": {"type": "string", "minLength": 1},
          "reviewedAt": {"type": "string", "format": "date-time"}
        }
      }
    },
    "publication": {
      "type": "object",
      "additionalProperties": false,
      "required": ["publishedAt", "updatedAt", "nextReviewDue", "supersedesRecordRevision", "correctionNoticeUrl"],
      "properties": {
        "publishedAt": {"type": "string", "format": "date-time"},
        "updatedAt": {"type": "string", "format": "date-time"},
        "nextReviewDue": {"type": ["string", "null"], "format": "date-time"},
        "supersedesRecordRevision": {"type": ["integer", "null"], "minimum": 1},
        "correctionNoticeUrl": {"type": ["string", "null"], "format": "uri"}
      }
    },
    "limitations": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}
  }
}
