{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "recordType",
    "candidateId",
    "sourceCommit",
    "gitTree",
    "scopeSha256",
    "exerciseId",
    "objectiveId",
    "assertionId",
    "evidenceType",
    "observedAtUtc",
    "participantIdentityIds",
    "channelIds",
        "result",
        "sourceRecordPath",
        "sourceRecordSha256",
        "event",
    "eventSha256",
    "controllerReceipt"
  ],
  "properties": {
    "schemaVersion": {
      "const": "1.0.0"
    },
    "recordType": {
      "const": "incident-assertion-evidence"
    },
    "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"
      ]
    },
    "assertionId": {
      "type": "string",
      "pattern": "^assertion:[0-9a-f]{64}$"
    },
    "evidenceType": {
      "enum": [
        "detection-event",
        "triage-record",
        "escalation-receipt",
        "containment-record",
        "partner-notification"
      ]
    },
    "observedAtUtc": {
      "type": "string",
      "format": "date-time"
    },
    "participantIdentityIds": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^identity:[0-9a-f]{64}$"
      }
    },
    "channelIds": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^channel:[0-9a-f]{64}$"
      }
    },
    "result": {
      "const": "objective-satisfied"
    },
    "sourceRecordPath": {
      "type": "string",
      "pattern": "^pr10/partner-package/evidence/organizational/incident-sources/[a-z0-9-]+\\.json$"
    },
    "sourceRecordSha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "event": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "eventType",
            "detectorIdentityId",
            "detectorId",
            "signalClass",
            "signalSha256",
            "detectedAtUtc",
            "severity"
          ],
          "properties": {
            "eventType": {
              "const": "detection-event"
            },
            "detectorIdentityId": {
              "type": "string",
              "pattern": "^identity:[0-9a-f]{64}$"
            },
            "detectorId": {
              "type": "string",
              "pattern": "^detector:[0-9a-f]{64}$"
            },
            "signalClass": {
              "enum": [
                "integrity-alert",
                "credential-alert",
                "data-exposure-alert",
                "vulnerability-alert"
              ]
            },
            "signalSha256": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "detectedAtUtc": {
              "type": "string",
              "format": "date-time"
            },
            "severity": {
              "enum": [
                "sev-1",
                "sev-2"
              ]
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "eventType",
            "ticketId",
            "classification",
            "ownerIdentityId",
            "openedAtUtc",
            "decisionSha256"
          ],
          "properties": {
            "eventType": {
              "const": "triage-record"
            },
            "ticketId": {
              "type": "string",
              "pattern": "^ticket:[0-9a-f]{64}$"
            },
            "classification": {
              "enum": [
                "confirmed-incident",
                "credible-suspected-incident"
              ]
            },
            "ownerIdentityId": {
              "type": "string",
              "pattern": "^identity:[0-9a-f]{64}$"
            },
            "openedAtUtc": {
              "type": "string",
              "format": "date-time"
            },
            "decisionSha256": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "eventType",
            "fromIdentityId",
            "toIdentityId",
            "channelId",
            "messageSha256",
            "sentAtUtc",
            "receivedAtUtc"
          ],
          "properties": {
            "eventType": {
              "const": "escalation-receipt"
            },
            "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}$"
            },
            "messageSha256": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "sentAtUtc": {
              "type": "string",
              "format": "date-time"
            },
            "receivedAtUtc": {
              "type": "string",
              "format": "date-time"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "eventType",
            "controlId",
            "actionClass",
            "operatorIdentityId",
            "startedAtUtc",
            "completedAtUtc",
            "verificationSha256"
          ],
          "properties": {
            "eventType": {
              "const": "containment-record"
            },
            "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}$"
            },
            "startedAtUtc": {
              "type": "string",
              "format": "date-time"
            },
            "completedAtUtc": {
              "type": "string",
              "format": "date-time"
            },
            "verificationSha256": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "eventType",
            "senderIdentityId",
            "recipientIdentityId",
            "channelId",
            "noticeSha256",
            "sentAtUtc",
            "acknowledgedAtUtc"
          ],
          "properties": {
            "eventType": {
              "const": "partner-notification"
            },
            "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}$"
            },
            "noticeSha256": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "sentAtUtc": {
              "type": "string",
              "format": "date-time"
            },
            "acknowledgedAtUtc": {
              "type": "string",
              "format": "date-time"
            }
          }
        }
      ]
    },
    "eventSha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "controllerReceipt": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "controllerIdentityId",
        "channelId",
        "nonceSha256",
        "eventSha256",
        "signedAtUtc",
        "keyType",
        "publicKeySha256",
        "signedPayloadSha256",
        "signatureBase64"
      ],
      "properties": {
        "controllerIdentityId": {
          "type": "string",
          "pattern": "^identity:[0-9a-f]{64}$"
        },
        "channelId": {
          "type": "string",
          "pattern": "^channel:[0-9a-f]{64}$"
        },
        "nonceSha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "eventSha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "signedAtUtc": {
          "type": "string",
          "format": "date-time"
        },
        "keyType": {
          "const": "Ed25519"
        },
        "publicKeySha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "signedPayloadSha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "signatureBase64": {
          "type": "string",
          "pattern": "^[A-Za-z0-9+/]{86}==$"
        }
      }
    }
  }
}
