{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://nyk.dev/schemas/release-receipt/v1",
  "title": "Release Receipt",
  "description": "A record of the six release checks for one change, with a self-verifying content digest.",
  "type": "object",
  "required": ["schema", "version", "generated_at", "gates", "verdict", "digest"],
  "additionalProperties": false,
  "properties": {
    "schema": { "const": "https://nyk.dev/schemas/release-receipt/v1" },
    "version": { "type": "string", "description": "Release Receipt Kit version that produced this." },
    "generated_at": { "type": "string", "format": "date-time" },
    "base": { "type": "string", "description": "Git ref the change was measured against." },
    "task": { "type": "string", "description": "What the change was supposed to do." },
    "changed_files": { "type": "array", "items": { "type": "string" } },
    "gates": {
      "type": "array",
      "minItems": 6,
      "items": {
        "type": "object",
        "required": ["gate", "status", "summary"],
        "additionalProperties": false,
        "properties": {
          "gate": {
            "type": "string",
            "enum": [
              "behavior-proof",
              "scope-fidelity",
              "supply-chain",
              "secret-safety",
              "rollback-proof",
              "run-evidence"
            ]
          },
          "status": { "type": "string", "enum": ["pass", "warn", "fail", "skip"] },
          "summary": { "type": "string" },
          "evidence": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "verdict": {
      "type": "string",
      "enum": ["ready", "review", "blocked"],
      "description": "ready = all pass; review = at least one warn; blocked = at least one fail."
    },
    "digest": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$",
      "description": "sha256 of the canonical receipt without this field. Detects tampering and drift; NOT a cryptographic signature or proof of authorship."
    }
  }
}
