{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:proof21:schema:consumer-decision:v1",
  "title": "P21 Consumer Decision Receipt v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "type",
    "proofDigest",
    "requestDigest",
    "actionDigest",
    "consumer",
    "acceptancePolicyDigest",
    "acceptancePolicyVersion",
    "decision",
    "reasonCodes",
    "evidenceSnapshotDigest",
    "decidedAt",
    "signature"
  ],
  "properties": {
    "type": {
      "const": "p21.consumer-decision.v1"
    },
    "proofDigest": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "requestDigest": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "actionDigest": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "consumer": {
      "type": "string",
      "minLength": 1
    },
    "acceptancePolicyDigest": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "acceptancePolicyVersion": {
      "type": "string",
      "minLength": 1
    },
    "decision": {
      "enum": [
        "ACCEPT",
        "REJECT",
        "REVIEW"
      ]
    },
    "reasonCodes": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true
    },
    "evidenceSnapshotDigest": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "decidedAt": {
      "type": "string",
      "format": "date-time"
    },
    "validUntil": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "signature": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "algorithm",
        "keyId",
        "value"
      ],
      "properties": {
        "algorithm": {
          "type": "string",
          "minLength": 1
        },
        "keyId": {
          "type": "string",
          "minLength": 1
        },
        "value": {
          "type": "string",
          "minLength": 1
        }
      }
    }
  }
}
