{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/whitemagic-dev/json-schema/whitemagic-dev-verdict-schema.json",
  "title": "Verdict",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/whitemagic-dev-openapi.json#/components/schemas/Verdict",
  "type": "object",
  "required": [
    "verdict"
  ],
  "properties": {
    "verdict": {
      "type": "string",
      "enum": [
        "TRUSTED",
        "PROVISIONAL",
        "INSUFFICIENT_EVIDENCE",
        "UNTRUSTED"
      ]
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "receipt_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "provisional_reasons": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "insufficient_reasons": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "summary": {
      "type": "object"
    },
    "verification_receipt": {
      "$ref": "#/$defs/VerificationReceipt"
    }
  },
  "$defs": {
    "VerificationReceipt": {
      "type": "object",
      "description": "A signed record of a verification run: the full result (verdict, errors, reasons, summary) with offline-checkable consistency.",
      "required": [
        "kind",
        "version",
        "bundle_digest",
        "verdict",
        "error_codes",
        "errors",
        "provisional_reasons",
        "insufficient_reasons",
        "summary",
        "verified_at",
        "issuer",
        "sig"
      ],
      "properties": {
        "kind": {
          "const": "continuity-receipt-verification"
        },
        "version": {
          "const": 1
        },
        "bundle_digest": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{64}$"
        },
        "verdict": {
          "enum": [
            "TRUSTED",
            "PROVISIONAL",
            "INSUFFICIENT_EVIDENCE",
            "UNTRUSTED"
          ]
        },
        "error_codes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "errors": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "code"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "detail": {
                "type": "string"
              },
              "receipt_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "provisional_reasons": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "insufficient_reasons": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "summary": {
          "type": "object"
        },
        "verified_at": {
          "type": "string"
        },
        "verifier": {
          "type": "object"
        },
        "issuer": {
          "type": "string"
        },
        "sig": {
          "type": "object",
          "required": [
            "alg",
            "key",
            "value"
          ]
        }
      }
    }
  }
}