{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "event_id": {
      "type": "string",
      "pattern": "^evt_[0-7][0-9A-HJKMNP-TV-Z]{25}(?![\\s\\S])"
    },
    "at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
    },
    "kind": {
      "type": "string",
      "enum": [
        "grant_created",
        "grant_revoked",
        "grant_expired",
        "rule_applied",
        "delegation_redeemed",
        "proposal_decided",
        "overlay_enabled",
        "overlay_disabled",
        "overlay_selected",
        "read_not_modified",
        "purge_issued",
        "purge_acknowledged",
        "operator_action",
        "migration_imported"
      ]
    },
    "actor_client_id": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 2048
        },
        {
          "type": "null"
        }
      ]
    },
    "subject_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "details": {
      "type": "object",
      "properties": {
        "decision": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "approved",
                "rejected",
                "enabled",
                "disabled",
                "selected",
                "unchanged",
                "completed",
                "failed"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "ids": {
          "maxItems": 32,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "response_hash": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^sha256:[a-f0-9]{64}$"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "decision",
        "ids",
        "response_hash"
      ],
      "additionalProperties": false
    },
    "prev_hash": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^sha256:[a-f0-9]{64}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "hash": {
      "type": "string",
      "pattern": "^sha256:[a-f0-9]{64}$"
    }
  },
  "required": [
    "event_id",
    "at",
    "kind",
    "actor_client_id",
    "subject_id",
    "details",
    "prev_hash",
    "hash"
  ],
  "additionalProperties": false
}
