{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://paloframework.org/schemas/palo-data-disclosure-observation.schema.json",
  "title": "PALO Data Disclosure Observation",
  "description": "Payload-minimized metadata observed by a trusted executor about rows read and information actually disclosed.",
  "type": "object",
  "required": ["format", "schemaVersion", "sourceRefs", "fieldsRead", "rowsRead", "egressFields", "egressRows", "sensitiveCategories", "redactionsApplied", "destination", "trace", "exported", "queryDigest", "payloadDigest", "observedAt"],
  "properties": {
    "format": { "const": "palo-data-disclosure-observation" },
    "schemaVersion": { "const": "1.0.0" },
    "sourceRefs": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1, "maxLength": 1000 } },
    "fieldsRead": { "type": "array", "uniqueItems": true, "maxItems": 1000, "items": { "type": "string", "minLength": 1, "maxLength": 500 } },
    "rowsRead": { "type": "integer", "minimum": 0, "maximum": 10000000 },
    "egressFields": { "type": "array", "uniqueItems": true, "maxItems": 1000, "items": { "type": "string", "minLength": 1, "maxLength": 500 } },
    "egressRows": { "type": "integer", "minimum": 0, "maximum": 1000000 },
    "aggregationGroupSize": { "type": "integer", "minimum": 1, "maximum": 10000000 },
    "sensitiveCategories": { "type": "array", "uniqueItems": true, "maxItems": 100, "items": { "type": "string", "minLength": 1, "maxLength": 200 } },
    "redactionsApplied": { "type": "array", "uniqueItems": true, "maxItems": 100, "items": { "type": "string", "minLength": 1, "maxLength": 200 } },
    "destination": {
      "type": "object",
      "required": ["recipient", "provider", "model", "region", "endpointHost"],
      "properties": {
        "recipient": { "type": "string", "minLength": 1, "maxLength": 500 },
        "provider": { "type": "string", "minLength": 1, "maxLength": 200 },
        "model": { "type": "string", "minLength": 1, "maxLength": 300 },
        "region": { "type": "string", "minLength": 1, "maxLength": 100 },
        "endpointHost": { "type": "string", "pattern": "^[a-z0-9.-]+$", "maxLength": 253 }
      },
      "additionalProperties": false
    },
    "trace": {
      "type": "object",
      "required": ["mode", "retentionSeconds"],
      "properties": {
        "mode": { "enum": ["disabled", "metadata-only", "redacted-payload"] },
        "retentionSeconds": { "type": "integer", "minimum": 0, "maximum": 31536000 }
      },
      "additionalProperties": false
    },
    "exported": { "type": "boolean" },
    "outputSchemaDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
    "queryDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
    "payloadDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
    "observedAt": { "type": "string", "format": "date-time" }
  },
  "additionalProperties": false
}
