{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://heartcortex.ai/schemas/1.0/audit.schema.json",
  "title": "audit",
  "type": "object",
  "required": [
    "sequence",
    "time",
    "category"
  ],
  "properties": {
    "sequence": {
      "type": "integer",
      "minimum": 0,
      "x-heart-privacy": "public"
    },
    "time": {
      "$ref": "common.schema.json#/$defs/timestamp",
      "x-heart-privacy": "public"
    },
    "category": {
      "enum": [
        "access",
        "change",
        "action",
        "valve",
        "security",
        "native"
      ],
      "x-heart-privacy": "public",
      "description": "access: a read of non-public data. change: a setting, rule or policy changed. action: an Action created or decided. valve: data released or blocked. security: login, key or certificate events. native: a native passthrough request."
    },
    "outcome": {
      "enum": [
        "allowed",
        "denied",
        "failed"
      ],
      "x-heart-privacy": "public",
      "description": "allowed: done. denied: refused by clearance, gate, guard or Valve. failed: allowed but did not complete."
    },
    "operation": {
      "type": "string",
      "x-heart-privacy": "internal"
    },
    "target": {
      "type": "string",
      "x-heart-privacy": "internal"
    },
    "previousHash": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$",
      "x-heart-privacy": "internal",
      "description": "SHA-256 of the previous entry's canonical JSON (RFC 8785), so tampering is detectable."
    },
    "actor": {
      "type": "string",
      "x-heart-privacy": "private"
    },
    "detail": {
      "type": "object",
      "x-heart-privacy": "private"
    },
    "ext": {
      "$ref": "common.schema.json#/$defs/ext",
      "x-heart-privacy": "private"
    }
  }
}
