{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://quickiso.app/data-portability/tables/audit_events.schema.json",
  "title": "tables/audit_events.json",
  "description": "The rows of the table audit_events that belong to the workspace, one object per row, keyed by the database's column names.",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid"
      },
      "organization_id": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "actor_type": {
        "type": "string",
        "enum": [
          "user",
          "operator",
          "system",
          "ai"
        ]
      },
      "actor_user_id": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "action": {
        "type": "string"
      },
      "object_type": {
        "type": [
          "string",
          "null"
        ]
      },
      "object_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "request_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "source": {
        "type": "string",
        "enum": [
          "web",
          "mobile",
          "api",
          "worker",
          "admin"
        ]
      },
      "client_ip": {
        "type": [
          "string",
          "null"
        ]
      },
      "user_agent": {
        "type": [
          "string",
          "null"
        ]
      },
      "session_ref": {
        "type": [
          "string",
          "null"
        ]
      },
      "metadata": {
        "type": [
          "object",
          "array",
          "string",
          "number",
          "boolean",
          "null"
        ]
      },
      "reason": {
        "type": [
          "string",
          "null"
        ]
      },
      "prev_hash": {
        "type": [
          "string",
          "null"
        ]
      },
      "event_hash": {
        "type": [
          "string",
          "null"
        ]
      },
      "chain_index": {
        "type": "integer"
      },
      "chain_version": {
        "type": "integer"
      },
      "personal_salt": {
        "type": [
          "string",
          "null"
        ]
      },
      "personal_digest": {
        "type": [
          "string",
          "null"
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
      }
    },
    "required": [
      "id",
      "organization_id",
      "actor_type",
      "actor_user_id",
      "action",
      "object_type",
      "object_id",
      "request_id",
      "source",
      "client_ip",
      "user_agent",
      "session_ref",
      "metadata",
      "reason",
      "prev_hash",
      "event_hash",
      "chain_index",
      "chain_version",
      "personal_salt",
      "personal_digest",
      "created_at"
    ],
    "additionalProperties": false
  }
}
