{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://zambo.dev/aer-1/hosted-profile.schema.json",
  "title": "Zambo Hosted Receipt Profile v1",
  "description": "The public JSON object returned as receipt by GET /api/receipt/{id} and GET /api/v2/receipt/{id}/verify. This profile is distinct from the raw AER-1 result._receipt schema.",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "id",
    "created_at",
    "receipt_schema_version",
    "output_hash",
    "hash_algorithm",
    "canonical_bytes",
    "canonical_byte_length",
    "verification_status",
    "provenance_class",
    "anchor",
    "checks"
  ],
  "properties": {
    "id": { "type": "string", "format": "uuid" },
    "created_at": { "type": "string", "format": "date-time" },
    "receipt_schema_version": { "type": "string", "enum": ["0.2", "0.3"] },
    "job_summary": { "type": "string" },
    "output_hash": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
    "hash_algorithm": { "type": "string", "const": "sha256" },
    "canonical_bytes": { "type": ["string", "null"], "contentEncoding": "base64" },
    "canonical_byte_length": { "type": ["integer", "null"], "minimum": 0 },
    "verification_status": { "type": "string", "minLength": 1 },
    "provenance_class": { "type": "string", "minLength": 1 },
    "anchor": { "type": ["object", "null"] },
    "checks": {
      "type": "object",
      "required": ["commitment_matches"],
      "properties": {
        "commitment_matches": {
          "type": "object",
          "required": ["status", "passed"],
          "properties": {
            "status": { "type": "string", "enum": ["pass", "fail", "not_checked"] },
            "passed": { "type": "boolean" }
          }
        },
        "signature_valid": {
          "type": "object",
          "properties": {
            "passed": { "type": "boolean", "const": false },
            "status": { "type": "string", "const": "not_checked" }
          }
        },
        "chain_valid": {
          "type": "object",
          "properties": {
            "passed": { "type": "boolean", "const": false },
            "status": { "type": "string", "const": "not_checked" }
          }
        }
      }
    }
  }
}