{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pdf2html.invalid/schemas/deployment-evidence-case.schema.json",
  "title": "Deployment evidence fixture case",
  "type": "object",
  "additionalProperties": false,
  "required": ["case_id", "gate", "scenario", "input", "expected"],
  "properties": {
    "case_id": {"type": "string", "pattern": "^DE-[A-Z0-9]+-[0-9]{3}$"},
    "gate": {"enum": ["dns", "tls", "origin", "cors", "csrf", "runtime", "database", "private-s3", "stripe-tax", "platform-package", "health", "readiness", "rollback", "sbom", "provenance", "vulnerability"]},
    "scenario": {"type": "string", "minLength": 1},
    "input": {"$ref": "#/$defs/evidence"},
    "expected": {"$ref": "#/$defs/expected"}
  },
  "$defs": {
    "status": {"enum": ["PASS", "FAIL", "BLOCKED"]},
    "sha256": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"},
    "timestamp": {"type": "string", "format": "date-time"},
    "secretName": {"type": "string", "pattern": "^[A-Z][A-Z0-9_]*$"},
    "assertion": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "actual", "expected", "passed"],
      "properties": {
        "name": {"type": "string", "minLength": 1},
        "actual": {}, "expected": {}, "passed": {"type": "boolean"}
      }
    },
    "evidence": {
      "type": "object",
      "additionalProperties": false,
      "required": ["evidence_id", "kind", "observed_at", "method", "subject", "status", "assertions", "secret_names", "redacted"],
      "properties": {
        "evidence_id": {"type": "string", "pattern": "^ev_[a-z0-9_]+$"},
        "kind": {"enum": ["dns", "tls", "origin", "cors", "csrf", "runtime", "database", "private-s3", "stripe-tax", "platform-package", "health", "readiness", "rollback", "sbom", "provenance", "vulnerability"]},
        "observed_at": {"type": ["string", "null"]},
        "method": {"type": "string", "minLength": 1},
        "subject": {"type": "string", "minLength": 1},
        "status": {"$ref": "#/$defs/status"},
        "assertions": {"type": "array", "items": {"$ref": "#/$defs/assertion"}, "minItems": 1},
        "secret_names": {"type": "array", "items": {"$ref": "#/$defs/secretName"}, "uniqueItems": true},
        "redacted": {"const": true},
        "sequence": {"type": "integer", "minimum": 0},
        "attempt": {"type": "integer", "minimum": 1},
        "image_digest": {"$ref": "#/$defs/sha256"},
        "artifact_digest": {"$ref": "#/$defs/sha256"},
        "expires_at": {"type": ["string", "null"]},
        "metadata": {"type": "object"}
      }
    },
    "expected": {
      "type": "object",
      "additionalProperties": false,
      "required": ["outcome", "error", "evidence"],
      "properties": {
        "outcome": {"$ref": "#/$defs/status"},
        "error": {"type": ["string", "null"], "pattern": "^[A-Z][A-Z0-9_]*$"},
        "evidence": {"type": "array", "items": {"type": "string", "minLength": 1}, "minItems": 1, "uniqueItems": true}
      }
    }
  }
}
