{
  "$comment": "SPDX-License-Identifier: MIT",
  "$id": "https://spec.vaultfire.local/v3-open/1.0.0/receipt.v1.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "errorCode": {
      "oneOf": [
        {
          "pattern": "^VF3-[A-Z]+-[0-9]{3}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "evidence": {
      "type": "object"
    },
    "evidenceDigest": {
      "pattern": "^0x[0-9a-f]{64}$",
      "type": "string"
    },
    "issuedAt": {
      "format": "date-time",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$",
      "type": "string"
    },
    "issuer": {
      "maxLength": 128,
      "minLength": 1,
      "type": "string"
    },
    "operation": {
      "enum": [
        "define",
        "fund",
        "activate",
        "settle",
        "cancel",
        "expire",
        "force-exit",
        "withdraw-credit",
        "conformance"
      ]
    },
    "protocolVersion": {
      "const": "3.0.0"
    },
    "receiptId": {
      "pattern": "^0x[0-9a-f]{64}$",
      "type": "string"
    },
    "result": {
      "enum": [
        "accepted",
        "rejected",
        "observed"
      ]
    },
    "schema": {
      "const": "vaultfire.v3.open.receipt.v1"
    },
    "schemaVersion": {
      "const": "1.0.0"
    },
    "subject": {
      "type": "object"
    },
    "subjectDigest": {
      "pattern": "^0x[0-9a-f]{64}$",
      "type": "string"
    },
    "truth": {
      "additionalProperties": false,
      "properties": {
        "audited": {
          "type": "boolean"
        },
        "authorized": {
          "type": "boolean"
        },
        "deployed": {
          "type": "boolean"
        },
        "endorsed": {
          "type": "boolean"
        },
        "specificationCompliant": {
          "type": "boolean"
        }
      },
      "required": [
        "specificationCompliant",
        "audited",
        "deployed",
        "authorized",
        "endorsed"
      ],
      "type": "object"
    }
  },
  "required": [
    "schema",
    "schemaVersion",
    "protocolVersion",
    "receiptId",
    "operation",
    "subject",
    "subjectDigest",
    "result",
    "errorCode",
    "issuedAt",
    "issuer",
    "evidence",
    "evidenceDigest",
    "truth"
  ],
  "type": "object"
}
