{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Audit Event",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "event_id",
    "case_id",
    "event_type",
    "occurred_at",
    "actor",
    "payload_hash"
  ],
  "properties": {
    "event_id": {
      "type": "string"
    },
    "case_id": {
      "type": "string"
    },
    "session_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "event_type": {
      "type": "string"
    },
    "occurred_at": {
      "type": "string",
      "format": "date-time"
    },
    "actor": {
      "type": "object",
      "required": [
        "type",
        "id"
      ],
      "properties": {
        "type": {
          "enum": [
            "USER",
            "SERVICE",
            "MODEL",
            "REVIEWER",
            "ADMIN"
          ]
        },
        "id": {
          "type": "string"
        }
      }
    },
    "model_version": {
      "type": [
        "string",
        "null"
      ]
    },
    "prompt_version": {
      "type": [
        "string",
        "null"
      ]
    },
    "workflow_version": {
      "type": [
        "string",
        "null"
      ]
    },
    "input_refs": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "output_refs": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "payload_hash": {
      "type": "string"
    },
    "trace_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "metadata": {
      "type": "object"
    }
  }
}