{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ei-trust-receipt.brittanywright.workers.dev/schema/trust-receipt-demo-v0.2.json",
  "title": "AI Trust Receipt Demonstration Receipt v0.2",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "receipt_version",
    "receipt_environment",
    "attempt_id",
    "receipt_id",
    "event_time",
    "created_at",
    "gate_decision",
    "action",
    "verification",
    "persistence",
    "integrity"
  ],
  "properties": {
    "receipt_version": {
      "const": "demo-0.2"
    },
    "receipt_environment": {
      "const": "demonstration"
    },
    "synthetic": {
      "const": true
    },
    "attempt_id": {
      "type": "string",
      "format": "uuid"
    },
    "receipt_id": {
      "type": "string",
      "minLength": 1
    },
    "event_time": {
      "type": "string",
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "gate_decision": {
      "type": "object",
      "required": [
        "result",
        "failures"
      ],
      "properties": {
        "result": {
          "enum": [
            "allow",
            "deny"
          ]
        },
        "failures": {
          "type": "array"
        }
      }
    },
    "action": {
      "type": "object"
    },
    "verification": {
      "type": "object"
    },
    "persistence": {
      "type": "object"
    },
    "integrity": {
      "type": "object",
      "required": [
        "digest_algorithm",
        "digest"
      ],
      "properties": {
        "digest_algorithm": {
          "const": "SHA-256"
        },
        "digest": {
          "type": "string",
          "pattern": "^sha256:[a-f0-9]{64}$"
        }
      }
    }
  }
}