{
  "$comment": "SPDX-License-Identifier: MIT",
  "$id": "https://spec.vaultfire.local/v3-open/1.0.0/deployment-capability-evidence.v1.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "abiIdentity": {
      "pattern": "^0x[0-9a-f]{64}$",
      "type": "string"
    },
    "candidateCommitAuthority": {
      "const": "external-conformance-envelope-v1"
    },
    "capabilities": {
      "items": {
        "pattern": "^0x[0-9a-f]{64}$",
        "type": "string"
      },
      "maxItems": 64,
      "minItems": 0,
      "type": "array",
      "uniqueItems": true
    },
    "chainId": {
      "enum": [
        "8453",
        "84532"
      ]
    },
    "claims": {
      "additionalProperties": false,
      "properties": {
        "authorizationVerified": {
          "type": "boolean"
        },
        "capabilityVerified": {
          "type": "boolean"
        },
        "deploymentVerified": {
          "type": "boolean"
        },
        "sourceSupported": {
          "type": "boolean"
        }
      },
      "required": [
        "sourceSupported",
        "deploymentVerified",
        "authorizationVerified",
        "capabilityVerified"
      ],
      "type": "object"
    },
    "conformanceControls": {
      "additionalProperties": false,
      "properties": {
        "activationMode": {
          "const": "module-by-module-gated"
        },
        "boundedLiabilities": {
          "const": true
        },
        "exactCommitTesting": {
          "const": true
        },
        "explicitConsent": {
          "const": true
        },
        "failClosedApis": {
          "const": true
        },
        "gateModule": {
          "enum": [
            "accountabilityBond",
            "partnershipBond",
            "governance",
            "mandateRegistry"
          ]
        },
        "immutableEvidenceBindings": {
          "const": true
        },
        "pullPaymentsWhereValueClaimed": {
          "const": true
        },
        "terminalBoundedExits": {
          "const": true
        }
      },
      "required": [
        "boundedLiabilities",
        "pullPaymentsWhereValueClaimed",
        "explicitConsent",
        "terminalBoundedExits",
        "immutableEvidenceBindings",
        "failClosedApis",
        "exactCommitTesting",
        "activationMode",
        "gateModule"
      ],
      "type": "object"
    },
    "contract": {
      "oneOf": [
        {
          "pattern": "^0x[0-9a-f]{40}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "module": {
      "enum": [
        "accountabilityBond",
        "partnershipBond",
        "governance",
        "mandateRegistry"
      ]
    },
    "observedAt": {
      "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"
    },
    "observer": {
      "maxLength": 128,
      "minLength": 1,
      "type": "string"
    },
    "protocolVersion": {
      "const": "3.0.0"
    },
    "runtimeCodeHash": {
      "oneOf": [
        {
          "pattern": "^0x[0-9a-f]{64}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "schema": {
      "const": "vaultfire.v3.open.deployment-capability-evidence.v1"
    },
    "schemaVersion": {
      "const": "1.0.0"
    },
    "sourceBindings": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "path": {
            "pattern": "^[a-zA-Z0-9._/-]+$",
            "type": "string"
          },
          "sha256": {
            "pattern": "^[0-9a-f]{64}$",
            "type": "string"
          }
        },
        "required": [
          "path",
          "sha256"
        ],
        "type": "object"
      },
      "maxItems": 64,
      "minItems": 1,
      "type": "array",
      "uniqueItems": true
    },
    "sourceSetDigest": {
      "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"
    },
    "validUntil": {
      "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"
    }
  },
  "required": [
    "schema",
    "schemaVersion",
    "protocolVersion",
    "module",
    "chainId",
    "contract",
    "abiIdentity",
    "runtimeCodeHash",
    "capabilities",
    "observedAt",
    "validUntil",
    "observer",
    "sourceBindings",
    "sourceSetDigest",
    "claims",
    "truth",
    "conformanceControls",
    "candidateCommitAuthority"
  ],
  "type": "object"
}
