{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion", "recordType", "candidateId", "sourceCommit", "gitTree",
    "scopeSha256", "exerciseId", "objectiveId", "sourceType",
    "occurredAtUtc", "actorIdentityIds", "organizationIds", "channelIds",
    "content"
  ],
  "properties": {
    "schemaVersion": {"const": "1.0.0"},
    "recordType": {"const": "incident-objective-source-record"},
    "candidateId": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"},
    "sourceCommit": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
    "gitTree": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
    "scopeSha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
    "exerciseId": {"type": "string", "pattern": "^incident-exercise:[0-9a-f]{64}$"},
    "objectiveId": {
      "enum": ["detect", "triage", "escalate", "contain", "notify-partner"]
    },
    "sourceType": {
      "enum": [
        "detection-signal", "triage-decision", "escalation-message",
        "containment-verification", "partner-notice"
      ]
    },
    "occurredAtUtc": {"type": "string", "format": "date-time"},
    "actorIdentityIds": {
      "type": "array", "minItems": 1, "maxItems": 2, "uniqueItems": true,
      "items": {"type": "string", "pattern": "^identity:[0-9a-f]{64}$"}
    },
    "organizationIds": {
      "type": "array", "minItems": 1, "maxItems": 2, "uniqueItems": true,
      "items": {"type": "string", "pattern": "^organization:[0-9a-f]{64}$"}
    },
    "channelIds": {
      "type": "array", "minItems": 1, "maxItems": 1, "uniqueItems": true,
      "items": {"type": "string", "pattern": "^channel:[0-9a-f]{64}$"}
    },
    "content": {
      "oneOf": [
        {
          "type": "object", "additionalProperties": false,
          "required": ["sourceType", "detectorId", "signalClass", "severity", "description"],
          "properties": {
            "sourceType": {"const": "detection-signal"},
            "detectorId": {"type": "string", "pattern": "^detector:[0-9a-f]{64}$"},
            "signalClass": {"enum": ["integrity-alert", "credential-alert", "data-exposure-alert", "vulnerability-alert"]},
            "severity": {"enum": ["sev-1", "sev-2"]},
            "description": {"type": "string", "minLength": 12, "maxLength": 512}
          }
        },
        {
          "type": "object", "additionalProperties": false,
          "required": ["sourceType", "ticketId", "classification", "rationale"],
          "properties": {
            "sourceType": {"const": "triage-decision"},
            "ticketId": {"type": "string", "pattern": "^ticket:[0-9a-f]{64}$"},
            "classification": {"enum": ["confirmed-incident", "credible-suspected-incident"]},
            "rationale": {"type": "string", "minLength": 12, "maxLength": 512}
          }
        },
        {
          "type": "object", "additionalProperties": false,
          "required": ["sourceType", "fromIdentityId", "toIdentityId", "channelId", "messageClass", "deliveryConfirmed"],
          "properties": {
            "sourceType": {"const": "escalation-message"},
            "fromIdentityId": {"type": "string", "pattern": "^identity:[0-9a-f]{64}$"},
            "toIdentityId": {"type": "string", "pattern": "^identity:[0-9a-f]{64}$"},
            "channelId": {"type": "string", "pattern": "^channel:[0-9a-f]{64}$"},
            "messageClass": {"const": "incident-escalation"},
            "deliveryConfirmed": {"const": true}
          }
        },
        {
          "type": "object", "additionalProperties": false,
          "required": ["sourceType", "controlId", "actionClass", "operatorIdentityId", "verified", "result"],
          "properties": {
            "sourceType": {"const": "containment-verification"},
            "controlId": {"type": "string", "pattern": "^control:[0-9a-f]{64}$"},
            "actionClass": {"enum": ["credential-revocation", "route-disable", "write-pause", "access-isolation"]},
            "operatorIdentityId": {"type": "string", "pattern": "^identity:[0-9a-f]{64}$"},
            "verified": {"const": true},
            "result": {"const": "containment-effective"}
          }
        },
        {
          "type": "object", "additionalProperties": false,
          "required": ["sourceType", "senderIdentityId", "recipientIdentityId", "channelId", "noticeClass", "acknowledged"],
          "properties": {
            "sourceType": {"const": "partner-notice"},
            "senderIdentityId": {"type": "string", "pattern": "^identity:[0-9a-f]{64}$"},
            "recipientIdentityId": {"type": "string", "pattern": "^identity:[0-9a-f]{64}$"},
            "channelId": {"type": "string", "pattern": "^channel:[0-9a-f]{64}$"},
            "noticeClass": {"const": "partner-incident-notification"},
            "acknowledged": {"const": true}
          }
        }
      ]
    }
  }
}
