{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://usedeed.app/contracts/deed.proof_card.external_request.v1.schema.json",
  "title": "DEED proof-card external attestation request v1",
  "type": "object",
  "required": [
    "schema",
    "adr",
    "generatedAt",
    "status",
    "promotionCommand",
    "card",
    "standaloneVerifier",
    "requiredControls",
    "attestationTemplate",
    "signatureInstructions",
    "custodyBoundary",
    "promotionBoundary"
  ],
  "properties": {
    "schema": { "const": "https://usedeed.app/contracts/deed.proof_card.external_request.v1.schema.json" },
    "adr": { "const": "ADR-197" },
    "generatedAt": { "type": "string", "format": "date-time" },
    "status": { "type": "string", "minLength": 1 },
    "promotionCommand": { "type": "string", "pattern": "proof:external:promotion" },
    "card": {
      "type": "object",
      "required": ["path", "byteLength", "sha256", "cardId", "head", "mark", "issuedAt", "expiresAt", "externalAttestationCount"],
      "properties": {
        "path": { "type": "string", "minLength": 1 },
        "byteLength": { "type": "integer", "minimum": 1 },
        "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
        "cardId": { "type": "string", "pattern": "^zvpc_sha256_[0-9a-f]{64}$" },
        "head": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
        "mark": { "type": "string", "minLength": 1 },
        "issuedAt": { "type": "string", "format": "date-time" },
        "expiresAt": { "type": "string", "format": "date-time" },
        "externalAttestationCount": { "type": "integer", "minimum": 0 }
      },
      "additionalProperties": false
    },
    "standaloneVerifier": { "type": "object" },
    "requiredControls": {
      "type": "object",
      "required": ["count", "ids"],
      "properties": {
        "count": { "const": 9 },
        "ids": { "type": "array", "minItems": 9, "maxItems": 9, "uniqueItems": true }
      },
      "additionalProperties": false
    },
    "attestationTemplate": { "type": "object" },
    "signatureInstructions": { "type": "object" },
    "custodyBoundary": { "type": "string", "minLength": 1 },
    "promotionBoundary": { "type": "string", "minLength": 1 }
  },
  "additionalProperties": false
}
