{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.portolabs.xyz/london-0.1.0/ledger-schemas.json",
  "title": "Approved deterministic London ledger contracts",
  "oneOf": [
    {
      "$ref": "#/$defs/CommandEnvelope"
    },
    {
      "$ref": "#/$defs/JournalEntry"
    },
    {
      "$ref": "#/$defs/Checkpoint"
    }
  ],
  "$defs": {
    "Error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "message": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "correlation_id": {
          "type": "string",
          "format": "uuid"
        },
        "retryable": {
          "type": "boolean"
        }
      },
      "required": [
        "code",
        "message",
        "correlation_id",
        "retryable"
      ]
    },
    "Ack": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "status": {
          "type": "string",
          "enum": [
            "recorded",
            "accepted",
            "partial",
            "rejected",
            "held",
            "late",
            "consumed",
            "closed",
            "ready"
          ]
        },
        "reason": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "status",
        "reason"
      ]
    },
    "Account": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "roles": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "listener",
              "artist",
              "operator",
              "admin",
              "finance"
            ]
          }
        },
        "entitlement": {
          "type": "string",
          "enum": [
            "active",
            "pending",
            "expired",
            "none"
          ]
        },
        "access_ends_ms": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "maxLength": 20,
              "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "roles",
        "entitlement",
        "access_ends_ms"
      ]
    },
    "CheckoutRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "plan_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        }
      },
      "required": [
        "plan_id"
      ]
    },
    "URLResponse": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "expires_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        }
      },
      "required": [
        "url",
        "expires_ms"
      ]
    },
    "BillingEvent": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "string",
          "enum": [
            "london.v1"
          ]
        },
        "provider": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "event_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "event_type": {
          "type": "string",
          "enum": [
            "access_active",
            "access_ended",
            "payment_cleared",
            "payment_refunded",
            "chargeback"
          ]
        },
        "account_id": {
          "type": "string",
          "format": "uuid"
        },
        "payment_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "subscription_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "period_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "occurred_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "service_start_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "service_end_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "currency": {
          "type": "string",
          "enum": [
            "GBP"
          ]
        },
        "gross_pence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "provider_evidence_ref": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        }
      },
      "required": [
        "schema_version",
        "provider",
        "event_id",
        "event_type",
        "account_id",
        "payment_id",
        "subscription_id",
        "period_id",
        "occurred_ms",
        "service_start_ms",
        "service_end_ms",
        "currency",
        "gross_pence",
        "provider_evidence_ref"
      ]
    },
    "Work": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "artist": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "duration_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "rendition_id": {
          "type": "string",
          "format": "uuid"
        },
        "rights_version": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "available": {
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "title",
        "artist",
        "duration_ms",
        "rendition_id",
        "rights_version",
        "available"
      ]
    },
    "Catalogue": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Work"
          }
        },
        "next_cursor": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "items",
        "next_cursor"
      ]
    },
    "Chunk": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "index": {
          "type": "string",
          "pattern": "^(init|0|[1-9][0-9]*)$"
        },
        "media_start_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "media_end_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "byte_length": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      },
      "required": [
        "index",
        "media_start_ms",
        "media_end_ms",
        "byte_length",
        "sha256"
      ]
    },
    "Manifest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "string",
          "enum": [
            "london.v1"
          ]
        },
        "work_id": {
          "type": "string",
          "format": "uuid"
        },
        "rendition_id": {
          "type": "string",
          "format": "uuid"
        },
        "manifest_version": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "codec": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "duration_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "init": {
          "$ref": "#/$defs/Chunk"
        },
        "chunks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Chunk"
          }
        },
        "key_id": {
          "type": "string",
          "format": "uuid"
        },
        "signature": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{86}$",
          "description": "Base64url unpadded Ed25519 64-byte signature; decode and verify canonical trailing bits."
        }
      },
      "required": [
        "schema_version",
        "work_id",
        "rendition_id",
        "manifest_version",
        "codec",
        "duration_ms",
        "init",
        "chunks",
        "key_id",
        "signature"
      ]
    },
    "SessionRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "work_id": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "work_id"
      ]
    },
    "Session": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "work_id": {
          "type": "string",
          "format": "uuid"
        },
        "rendition_id": {
          "type": "string",
          "format": "uuid"
        },
        "rights_version": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "expires_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "closed"
          ]
        },
        "manifest_url": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "id",
        "work_id",
        "rendition_id",
        "rights_version",
        "expires_ms",
        "status",
        "manifest_url"
      ]
    },
    "Empty": {
      "type": "object",
      "additionalProperties": false,
      "properties": {},
      "required": []
    },
    "GrantRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "chunk_index": {
          "type": "string",
          "pattern": "^(init|0|[1-9][0-9]*)$"
        },
        "retry_of_grant_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "chunk_index",
        "retry_of_grant_id"
      ]
    },
    "Grant": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "string",
          "enum": [
            "london.v1"
          ]
        },
        "grant_id": {
          "type": "string",
          "format": "uuid"
        },
        "purpose": {
          "type": "string",
          "enum": [
            "playback",
            "peer_fill",
            "probe"
          ]
        },
        "session_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "source_node_id": {
          "type": "string",
          "format": "uuid"
        },
        "destination_node_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "rendition_id": {
          "type": "string",
          "format": "uuid"
        },
        "chunk_index": {
          "type": "string",
          "pattern": "^(init|0|[1-9][0-9]*)$"
        },
        "manifest_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "nonce": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "issued_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "expires_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "key_id": {
          "type": "string",
          "format": "uuid"
        },
        "signature": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{86}$",
          "description": "Base64url unpadded Ed25519 64-byte signature; decode and verify canonical trailing bits."
        }
      },
      "required": [
        "schema_version",
        "grant_id",
        "purpose",
        "session_id",
        "source_node_id",
        "destination_node_id",
        "rendition_id",
        "chunk_index",
        "manifest_hash",
        "nonce",
        "issued_ms",
        "expires_ms",
        "key_id",
        "signature"
      ]
    },
    "GrantResponse": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "grant": {
          "$ref": "#/$defs/Grant"
        },
        "content_url": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "grant",
        "content_url"
      ]
    },
    "Inventory": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "rendition_id": {
          "type": "string",
          "format": "uuid"
        },
        "manifest_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "ready_chunks": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^(init|0|[1-9][0-9]*)$"
          }
        }
      },
      "required": [
        "rendition_id",
        "manifest_hash",
        "ready_chunks"
      ]
    },
    "HealthRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "string",
          "enum": [
            "london.v1"
          ]
        },
        "node_id": {
          "type": "string",
          "format": "uuid"
        },
        "image_digest": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "observed_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "free_cache_bytes": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "pending_receipts": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "inventory": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Inventory"
          }
        }
      },
      "required": [
        "schema_version",
        "node_id",
        "image_digest",
        "observed_ms",
        "free_cache_bytes",
        "pending_receipts",
        "inventory"
      ]
    },
    "HealthResponse": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "active",
            "pending",
            "suspended",
            "retired"
          ]
        },
        "server_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "withdraw_renditions": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          }
        },
        "next_heartbeat_seconds": {
          "type": "integer",
          "const": 20
        }
      },
      "required": [
        "status",
        "server_ms",
        "withdraw_renditions",
        "next_heartbeat_seconds"
      ]
    },
    "FillRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "rendition_id": {
          "type": "string",
          "format": "uuid"
        },
        "chunk_index": {
          "type": "string",
          "pattern": "^(init|0|[1-9][0-9]*)$"
        }
      },
      "required": [
        "rendition_id",
        "chunk_index"
      ]
    },
    "PeerProof": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "string",
          "enum": [
            "london.v1"
          ]
        },
        "grant_id": {
          "type": "string",
          "format": "uuid"
        },
        "request_id": {
          "type": "string",
          "format": "uuid"
        },
        "destination_node_id": {
          "type": "string",
          "format": "uuid"
        },
        "method": {
          "type": "string",
          "enum": [
            "GET"
          ]
        },
        "path": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "key_id": {
          "type": "string",
          "format": "uuid"
        },
        "signature": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{86}$",
          "description": "Base64url unpadded Ed25519 64-byte signature; decode and verify canonical trailing bits."
        }
      },
      "required": [
        "schema_version",
        "grant_id",
        "request_id",
        "destination_node_id",
        "method",
        "path",
        "key_id",
        "signature"
      ]
    },
    "ConsumeRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "request_id": {
          "type": "string",
          "format": "uuid"
        },
        "peer_proof": {
          "anyOf": [
            {
              "$ref": "#/$defs/PeerProof"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "request_id",
        "peer_proof"
      ]
    },
    "Consumed": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "grant_id": {
          "type": "string",
          "format": "uuid"
        },
        "request_id": {
          "type": "string",
          "format": "uuid"
        },
        "consume_sequence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "consumed_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "deadline_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "expected_bytes": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "chunk_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      },
      "required": [
        "grant_id",
        "request_id",
        "consume_sequence",
        "consumed_ms",
        "deadline_ms",
        "expected_bytes",
        "chunk_sha256"
      ]
    },
    "Receipt": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "string",
          "enum": [
            "london.v1"
          ]
        },
        "receipt_id": {
          "type": "string",
          "format": "uuid"
        },
        "grant_id": {
          "type": "string",
          "format": "uuid"
        },
        "request_id": {
          "type": "string",
          "format": "uuid"
        },
        "node_id": {
          "type": "string",
          "format": "uuid"
        },
        "key_id": {
          "type": "string",
          "format": "uuid"
        },
        "rendition_id": {
          "type": "string",
          "format": "uuid"
        },
        "chunk_index": {
          "type": "string",
          "pattern": "^(init|0|[1-9][0-9]*)$"
        },
        "purpose": {
          "type": "string",
          "enum": [
            "playback",
            "peer_fill",
            "probe"
          ]
        },
        "consume_sequence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "bytes_written": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "chunk_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "started_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "ended_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "outcome": {
          "type": "string",
          "enum": [
            "complete",
            "partial",
            "failed"
          ]
        },
        "signature": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{86}$",
          "description": "Base64url unpadded Ed25519 64-byte signature; decode and verify canonical trailing bits."
        }
      },
      "required": [
        "schema_version",
        "receipt_id",
        "grant_id",
        "request_id",
        "node_id",
        "key_id",
        "rendition_id",
        "chunk_index",
        "purpose",
        "consume_sequence",
        "bytes_written",
        "chunk_sha256",
        "started_ms",
        "ended_ms",
        "outcome",
        "signature"
      ]
    },
    "PeerResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "string",
          "enum": [
            "london.v1"
          ]
        },
        "result_id": {
          "type": "string",
          "format": "uuid"
        },
        "grant_id": {
          "type": "string",
          "format": "uuid"
        },
        "request_id": {
          "type": "string",
          "format": "uuid"
        },
        "source_node_id": {
          "type": "string",
          "format": "uuid"
        },
        "destination_node_id": {
          "type": "string",
          "format": "uuid"
        },
        "rendition_id": {
          "type": "string",
          "format": "uuid"
        },
        "chunk_index": {
          "type": "string",
          "pattern": "^(init|0|[1-9][0-9]*)$"
        },
        "bytes_received": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "chunk_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "verified": {
          "type": "boolean"
        },
        "key_id": {
          "type": "string",
          "format": "uuid"
        },
        "signature": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{86}$",
          "description": "Base64url unpadded Ed25519 64-byte signature; decode and verify canonical trailing bits."
        }
      },
      "required": [
        "schema_version",
        "result_id",
        "grant_id",
        "request_id",
        "source_node_id",
        "destination_node_id",
        "rendition_id",
        "chunk_index",
        "bytes_received",
        "chunk_sha256",
        "verified",
        "key_id",
        "signature"
      ]
    },
    "StatementSummary": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "day_start_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "asset_metadata": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "allocated_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "paid_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "unpaid_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "status": {
          "type": "string",
          "enum": [
            "provisional",
            "allocated",
            "committed",
            "held",
            "partially_paid",
            "paid"
          ]
        },
        "proof_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "day_start_ms",
        "asset_metadata",
        "allocated_micro_usdc",
        "paid_micro_usdc",
        "unpaid_micro_usdc",
        "status",
        "proof_id"
      ]
    },
    "Statements": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/StatementSummary"
          }
        },
        "next_cursor": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "items",
        "next_cursor"
      ]
    },
    "OperatorView": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "operator_id": {
          "type": "string",
          "format": "uuid"
        },
        "node_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          }
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "active",
            "stale",
            "suspended",
            "retired"
          ]
        },
        "accepted_duration_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "peer_fill_bytes": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "earned_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "paid_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "unpaid_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "missing_receipts": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "rejected_receipts": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        }
      },
      "required": [
        "operator_id",
        "node_ids",
        "status",
        "accepted_duration_ms",
        "peer_fill_bytes",
        "earned_micro_usdc",
        "paid_micro_usdc",
        "unpaid_micro_usdc",
        "missing_receipts",
        "rejected_receipts"
      ]
    },
    "BatchStatus": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "kind": {
          "type": "string",
          "enum": [
            "evidence",
            "accounting",
            "statement-index",
            "payment-journal",
            "correction"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "preparing",
            "frozen",
            "submitted",
            "confirmed",
            "failed",
            "uncertain"
          ]
        },
        "artifact_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "chain_id": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "package_address": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "chain_batch_id": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "transaction_hash": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^0x[0-9a-f]{64}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "ledger_version": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "maxLength": 20,
              "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "kind",
        "status",
        "artifact_hash",
        "chain_id",
        "package_address",
        "chain_batch_id",
        "transaction_hash",
        "ledger_version"
      ]
    },
    "ObjectRef": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "object_id": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "sha256",
        "object_id"
      ]
    },
    "GrantInventory": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "grant_id": {
          "type": "string",
          "format": "uuid"
        },
        "purpose": {
          "type": "string",
          "enum": [
            "playback",
            "peer_fill",
            "probe"
          ]
        },
        "consume_sequence": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "maxLength": 20,
              "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "issued",
            "consumed",
            "cancelled",
            "expired",
            "complete",
            "partial",
            "missing"
          ]
        },
        "receipt_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "required": [
        "grant_id",
        "purpose",
        "consume_sequence",
        "status",
        "receipt_ids"
      ]
    },
    "ReceiptDecision": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "receipt_id": {
          "type": "string",
          "format": "uuid"
        },
        "raw_receipt": {
          "$ref": "#/$defs/ObjectRef"
        },
        "revision": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "disposition": {
          "type": "string",
          "enum": [
            "accepted",
            "rejected",
            "partial",
            "held",
            "late"
          ]
        },
        "reason": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "grant_id": {
          "type": "string",
          "format": "uuid"
        },
        "node_id": {
          "type": "string",
          "format": "uuid"
        },
        "session_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "chunk_index": {
          "type": "string",
          "pattern": "^(init|0|[1-9][0-9]*)$"
        },
        "credited_duration_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        }
      },
      "required": [
        "receipt_id",
        "raw_receipt",
        "revision",
        "disposition",
        "reason",
        "grant_id",
        "node_id",
        "session_id",
        "chunk_index",
        "credited_duration_ms"
      ]
    },
    "SessionSummary": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "session_id": {
          "type": "string",
          "format": "uuid"
        },
        "listener_day_id": {
          "type": "string",
          "format": "uuid"
        },
        "work_id": {
          "type": "string",
          "format": "uuid"
        },
        "rights_version": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "closed_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "eligible": {
          "type": "boolean"
        },
        "unique_duration_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "held": {
          "type": "boolean"
        }
      },
      "required": [
        "session_id",
        "listener_day_id",
        "work_id",
        "rights_version",
        "closed_ms",
        "eligible",
        "unique_duration_ms",
        "held"
      ]
    },
    "BudgetInput": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "budget_day_id": {
          "type": "string",
          "format": "uuid"
        },
        "listener_day_id": {
          "type": "string",
          "format": "uuid"
        },
        "period_id": {
          "type": "string",
          "format": "uuid"
        },
        "funding_refs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ObjectRef"
          }
        },
        "budget_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "policy_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "held": {
          "type": "boolean"
        }
      },
      "required": [
        "budget_day_id",
        "listener_day_id",
        "period_id",
        "funding_refs",
        "budget_micro_usdc",
        "policy_hash",
        "held"
      ]
    },
    "RightsRecipient": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "beneficiary_id": {
          "type": "string",
          "format": "uuid"
        },
        "address": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "bps": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10000
        }
      },
      "required": [
        "beneficiary_id",
        "address",
        "bps"
      ]
    },
    "RightsSnapshot": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "work_id": {
          "type": "string",
          "format": "uuid"
        },
        "rights_version": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "effective_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "licence_ref": {
          "$ref": "#/$defs/ObjectRef"
        },
        "recipients": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RightsRecipient"
          }
        }
      },
      "required": [
        "work_id",
        "rights_version",
        "effective_ms",
        "licence_ref",
        "recipients"
      ]
    },
    "EconomicPolicy": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "policy_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "rights_bps": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10000
        },
        "operator_bps": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10000
        },
        "porto_bps": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10000
        },
        "deduction_policy_ref": {
          "$ref": "#/$defs/ObjectRef"
        },
        "unused_budget_policy_ref": {
          "$ref": "#/$defs/ObjectRef"
        }
      },
      "required": [
        "policy_hash",
        "rights_bps",
        "operator_bps",
        "porto_bps",
        "deduction_policy_ref",
        "unused_budget_policy_ref"
      ]
    },
    "Contribution": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "listener_day_id": {
          "type": "string",
          "format": "uuid"
        },
        "session_id": {
          "type": "string",
          "format": "uuid"
        },
        "work_id": {
          "type": "string",
          "format": "uuid"
        },
        "rights_version": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "node_id": {
          "type": "string",
          "format": "uuid"
        },
        "operator_id": {
          "type": "string",
          "format": "uuid"
        },
        "receipt_id": {
          "type": "string",
          "format": "uuid"
        },
        "duration_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        }
      },
      "required": [
        "id",
        "listener_day_id",
        "session_id",
        "work_id",
        "rights_version",
        "node_id",
        "operator_id",
        "receipt_id",
        "duration_ms"
      ]
    },
    "AllocationLine": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "budget_day_id": {
          "type": "string",
          "format": "uuid"
        },
        "work_id": {
          "type": "string",
          "format": "uuid"
        },
        "rights_version": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "role": {
          "type": "string",
          "enum": [
            "rights",
            "operator",
            "porto"
          ]
        },
        "beneficiary_id": {
          "type": "string",
          "format": "uuid"
        },
        "recipient_address": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "contribution_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          }
        },
        "duration_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "amount_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "reverses_line_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "budget_day_id",
        "work_id",
        "rights_version",
        "role",
        "beneficiary_id",
        "recipient_address",
        "contribution_ids",
        "duration_ms",
        "amount_micro_usdc",
        "reverses_line_id"
      ]
    },
    "Reserve": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "budget_day_id": {
          "type": "string",
          "format": "uuid"
        },
        "unallocated_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "held_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        }
      },
      "required": [
        "budget_day_id",
        "unallocated_micro_usdc",
        "held_micro_usdc"
      ]
    },
    "StatementLine": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "allocation_line_id": {
          "type": "string",
          "format": "uuid"
        },
        "day_start_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "work_id": {
          "type": "string",
          "format": "uuid"
        },
        "role": {
          "type": "string",
          "enum": [
            "rights",
            "operator"
          ]
        },
        "accepted_duration_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "amount_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        }
      },
      "required": [
        "allocation_line_id",
        "day_start_ms",
        "work_id",
        "role",
        "accepted_duration_ms",
        "amount_micro_usdc"
      ]
    },
    "IndexEntry": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "proof_id": {
          "type": "string",
          "format": "uuid"
        },
        "statement_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      },
      "required": [
        "proof_id",
        "statement_hash"
      ]
    },
    "PaymentEntry": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "payment_id": {
          "type": "string",
          "format": "uuid"
        },
        "allocation_line_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          }
        },
        "recipient": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "amount_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "asset_metadata": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "chain_id": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "status": {
          "type": "string",
          "enum": [
            "prepared",
            "approved",
            "signed",
            "submitted",
            "confirmed",
            "held",
            "failed",
            "uncertain",
            "cancelled"
          ]
        },
        "attempt_index": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "transaction_hash": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^0x[0-9a-f]{64}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "ledger_version": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "maxLength": 20,
              "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "payment_id",
        "allocation_line_ids",
        "recipient",
        "amount_micro_usdc",
        "asset_metadata",
        "chain_id",
        "status",
        "attempt_index",
        "transaction_hash",
        "ledger_version"
      ]
    },
    "EvidenceArtifact": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "string",
          "enum": [
            "london.v1"
          ]
        },
        "kind": {
          "type": "string",
          "enum": [
            "evidence"
          ]
        },
        "batch_uuid": {
          "type": "string",
          "format": "uuid"
        },
        "window_start_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "window_end_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "salt": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "payload": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "grants": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/GrantInventory"
              }
            },
            "receipts": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/ReceiptDecision"
              }
            },
            "sessions": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/SessionSummary"
              }
            },
            "manifest_refs": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/ObjectRef"
              }
            },
            "rights_refs": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/ObjectRef"
              }
            },
            "policy_hashes": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              }
            }
          },
          "required": [
            "grants",
            "receipts",
            "sessions",
            "manifest_refs",
            "rights_refs",
            "policy_hashes"
          ]
        }
      },
      "required": [
        "schema_version",
        "kind",
        "batch_uuid",
        "window_start_ms",
        "window_end_ms",
        "salt",
        "payload"
      ]
    },
    "AccountingArtifact": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "string",
          "enum": [
            "london.v1"
          ]
        },
        "kind": {
          "type": "string",
          "enum": [
            "accounting"
          ]
        },
        "batch_uuid": {
          "type": "string",
          "format": "uuid"
        },
        "window_start_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "window_end_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "salt": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "payload": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "evidence_batch_ids": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            },
            "budgets": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/BudgetInput"
              }
            },
            "rights": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/RightsSnapshot"
              }
            },
            "policies": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/EconomicPolicy"
              }
            },
            "contributions": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/Contribution"
              }
            },
            "allocations": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/AllocationLine"
              }
            },
            "reserves": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/Reserve"
              }
            },
            "correction_ids": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          "required": [
            "evidence_batch_ids",
            "budgets",
            "rights",
            "policies",
            "contributions",
            "allocations",
            "reserves",
            "correction_ids"
          ]
        }
      },
      "required": [
        "schema_version",
        "kind",
        "batch_uuid",
        "window_start_ms",
        "window_end_ms",
        "salt",
        "payload"
      ]
    },
    "StatementArtifact": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "string",
          "enum": [
            "london.v1"
          ]
        },
        "kind": {
          "type": "string",
          "enum": [
            "statement"
          ]
        },
        "batch_uuid": {
          "type": "string",
          "format": "uuid"
        },
        "window_start_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "window_end_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "salt": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "payload": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "beneficiary_id": {
              "type": "string",
              "format": "uuid"
            },
            "accounting_batch_id": {
              "type": "string",
              "format": "uuid"
            },
            "proof_id": {
              "type": "string",
              "format": "uuid"
            },
            "recipient_address": {
              "type": "string",
              "pattern": "^0x[0-9a-f]{64}$"
            },
            "asset_metadata": {
              "type": "string",
              "pattern": "^0x[0-9a-f]{64}$"
            },
            "chain_id": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "maxLength": 20,
              "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
            },
            "lines": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/StatementLine"
              }
            },
            "allocated_micro_usdc": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "maxLength": 20,
              "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
            }
          },
          "required": [
            "beneficiary_id",
            "accounting_batch_id",
            "proof_id",
            "recipient_address",
            "asset_metadata",
            "chain_id",
            "lines",
            "allocated_micro_usdc"
          ]
        }
      },
      "required": [
        "schema_version",
        "kind",
        "batch_uuid",
        "window_start_ms",
        "window_end_ms",
        "salt",
        "payload"
      ]
    },
    "IndexArtifact": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "string",
          "enum": [
            "london.v1"
          ]
        },
        "kind": {
          "type": "string",
          "enum": [
            "statement-index"
          ]
        },
        "batch_uuid": {
          "type": "string",
          "format": "uuid"
        },
        "window_start_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "window_end_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "salt": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "payload": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "accounting_batch_id": {
              "type": "string",
              "format": "uuid"
            },
            "entries": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/IndexEntry"
              }
            }
          },
          "required": [
            "accounting_batch_id",
            "entries"
          ]
        }
      },
      "required": [
        "schema_version",
        "kind",
        "batch_uuid",
        "window_start_ms",
        "window_end_ms",
        "salt",
        "payload"
      ]
    },
    "PaymentArtifact": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "string",
          "enum": [
            "london.v1"
          ]
        },
        "kind": {
          "type": "string",
          "enum": [
            "payment-journal"
          ]
        },
        "batch_uuid": {
          "type": "string",
          "format": "uuid"
        },
        "window_start_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "window_end_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "salt": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "payload": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "accounting_batch_id": {
              "type": "string",
              "format": "uuid"
            },
            "run_id": {
              "type": "string",
              "format": "uuid"
            },
            "approved_run_hash": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "entries": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/PaymentEntry"
              }
            }
          },
          "required": [
            "accounting_batch_id",
            "run_id",
            "approved_run_hash",
            "entries"
          ]
        }
      },
      "required": [
        "schema_version",
        "kind",
        "batch_uuid",
        "window_start_ms",
        "window_end_ms",
        "salt",
        "payload"
      ]
    },
    "CorrectionArtifact": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "string",
          "enum": [
            "london.v1"
          ]
        },
        "kind": {
          "type": "string",
          "enum": [
            "correction"
          ]
        },
        "batch_uuid": {
          "type": "string",
          "format": "uuid"
        },
        "window_start_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "window_end_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "salt": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "payload": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "target_batch_id": {
              "type": "string",
              "format": "uuid"
            },
            "prior_correction_id": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ]
            },
            "reason_code": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "replacement_refs": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/ObjectRef"
              }
            },
            "ledger_entry_ids": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            },
            "approval_ref": {
              "$ref": "#/$defs/ObjectRef"
            }
          },
          "required": [
            "target_batch_id",
            "prior_correction_id",
            "reason_code",
            "replacement_refs",
            "ledger_entry_ids",
            "approval_ref"
          ]
        }
      },
      "required": [
        "schema_version",
        "kind",
        "batch_uuid",
        "window_start_ms",
        "window_end_ms",
        "salt",
        "payload"
      ]
    },
    "ProofBundle": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "statement": {
          "$ref": "#/$defs/StatementArtifact"
        },
        "index": {
          "$ref": "#/$defs/IndexArtifact"
        },
        "index_commitment": {
          "$ref": "#/$defs/BatchStatus"
        },
        "accounting_commitment": {
          "$ref": "#/$defs/BatchStatus"
        },
        "payment_journals": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PaymentArtifact"
          }
        },
        "payment_commitments": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BatchStatus"
          }
        }
      },
      "required": [
        "statement",
        "index",
        "index_commitment",
        "accounting_commitment",
        "payment_journals",
        "payment_commitments"
      ]
    },
    "NodeHealth": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "ready": {
          "type": "boolean"
        },
        "version": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        }
      },
      "required": [
        "ready",
        "version"
      ]
    },
    "FundingAssignment": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "period_id": {
          "type": "string",
          "format": "uuid"
        },
        "approved_net_pence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "allocated_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        }
      },
      "required": [
        "period_id",
        "approved_net_pence",
        "allocated_micro_usdc"
      ]
    },
    "FundingImport": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "provider_ref": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "currency": {
          "type": "string",
          "enum": [
            "GBP"
          ]
        },
        "gross_pence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "tax_pence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "fees_pence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "refund_pence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "reserve_pence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "approved_net_pence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "received_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "asset_metadata": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "deposit_tx_hash": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "deposit_event_index": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "chain_id": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "assignments": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FundingAssignment"
          }
        },
        "approver_id": {
          "type": "string",
          "format": "uuid"
        },
        "evidence_ref": {
          "$ref": "#/$defs/ObjectRef"
        }
      },
      "required": [
        "id",
        "provider_ref",
        "currency",
        "gross_pence",
        "tax_pence",
        "fees_pence",
        "refund_pence",
        "reserve_pence",
        "approved_net_pence",
        "received_micro_usdc",
        "asset_metadata",
        "deposit_tx_hash",
        "deposit_event_index",
        "chain_id",
        "assignments",
        "approver_id",
        "evidence_ref"
      ]
    },
    "HoldCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "target_type": {
          "type": "string",
          "enum": [
            "listener_day",
            "payment",
            "operator"
          ]
        },
        "target_id": {
          "type": "string",
          "format": "uuid"
        },
        "action": {
          "type": "string",
          "enum": [
            "open",
            "released",
            "closed_no_credit"
          ]
        },
        "reason": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "private_note_ref": {
          "anyOf": [
            {
              "$ref": "#/$defs/ObjectRef"
            },
            {
              "type": "null"
            }
          ]
        },
        "predecessor_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "target_type",
        "target_id",
        "action",
        "reason",
        "private_note_ref",
        "predecessor_id"
      ]
    },
    "PayoutApproval": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "run_id": {
          "type": "string",
          "format": "uuid"
        },
        "run_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "accounting_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "max_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "approver_id": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "run_id",
        "run_hash",
        "accounting_hash",
        "max_micro_usdc",
        "approver_id"
      ]
    },
    "NodeChallenge": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "const": "london.v1"
        },
        "node_id": {
          "type": "string",
          "format": "uuid"
        },
        "operator_id": {
          "type": "string",
          "format": "uuid"
        },
        "public_base_url": {
          "type": "string",
          "format": "uri"
        },
        "public_key_hex": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "nonce": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "issued_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "expires_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "signature": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{86}$",
          "description": "Base64url unpadded Ed25519 64-byte signature; decode and verify canonical trailing bits."
        }
      },
      "required": [
        "schema_version",
        "node_id",
        "operator_id",
        "public_base_url",
        "public_key_hex",
        "nonce",
        "issued_ms",
        "expires_ms",
        "signature"
      ]
    },
    "NodeAdmission": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "node_id": {
          "type": "string",
          "format": "uuid"
        },
        "operator_id": {
          "type": "string",
          "format": "uuid"
        },
        "public_base_url": {
          "type": "string",
          "format": "uri"
        },
        "public_key_hex": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "key_id": {
          "type": "string",
          "format": "uuid"
        },
        "recipient_address": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "ownership_evidence": {
          "$ref": "#/$defs/ObjectRef"
        },
        "terms_evidence": {
          "$ref": "#/$defs/ObjectRef"
        },
        "challenge": {
          "$ref": "#/$defs/NodeChallenge"
        },
        "approved_by": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "node_id",
        "operator_id",
        "public_base_url",
        "public_key_hex",
        "key_id",
        "recipient_address",
        "ownership_evidence",
        "terms_evidence",
        "challenge",
        "approved_by"
      ]
    },
    "CatalogueImport": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "work": {
          "$ref": "#/$defs/Work"
        },
        "rights": {
          "$ref": "#/$defs/RightsSnapshot"
        },
        "manifest": {
          "$ref": "#/$defs/Manifest"
        },
        "allowed_territories": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "pattern": "^[A-Z]{2}$"
          }
        },
        "available_from_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "available_until_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20,
          "description": "Unsigned u64 decimal; semantic validator enforces maximum 18446744073709551615."
        },
        "master_evidence": {
          "$ref": "#/$defs/ObjectRef"
        },
        "approved_by": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "work",
        "rights",
        "manifest",
        "allowed_territories",
        "available_from_ms",
        "available_until_ms",
        "master_evidence",
        "approved_by"
      ]
    },
    "RevisionPrecondition": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "state_key": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "revision": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "maxLength": 20
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "state_key",
        "revision"
      ]
    },
    "WorkTarget": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "work_id": {
          "type": "string",
          "format": "uuid"
        },
        "reason_code": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        }
      },
      "required": [
        "work_id",
        "reason_code"
      ]
    },
    "NodeStatusCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "node_id": {
          "type": "string",
          "format": "uuid"
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "suspended",
            "retired"
          ]
        },
        "reason_code": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        }
      },
      "required": [
        "node_id",
        "status",
        "reason_code"
      ]
    },
    "NodeKeyCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "node_id": {
          "type": "string",
          "format": "uuid"
        },
        "key_id": {
          "type": "string",
          "format": "uuid"
        },
        "public_key_hex": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "effective_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "ownership_evidence": {
          "$ref": "#/$defs/ObjectRef"
        }
      },
      "required": [
        "node_id",
        "key_id",
        "public_key_hex",
        "effective_ms",
        "ownership_evidence"
      ]
    },
    "OpenSessionCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "session_id": {
          "type": "string",
          "format": "uuid"
        },
        "account_id": {
          "type": "string",
          "format": "uuid"
        },
        "work_id": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "session_id",
        "account_id",
        "work_id"
      ]
    },
    "CloseSessionCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "session_id": {
          "type": "string",
          "format": "uuid"
        },
        "reason_code": {
          "type": "string",
          "enum": [
            "explicit",
            "midnight",
            "work_change",
            "idle",
            "maximum",
            "entitlement",
            "rights",
            "failure"
          ]
        }
      },
      "required": [
        "session_id",
        "reason_code"
      ]
    },
    "IssueGrantCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "account_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "grant": {
          "$ref": "#/$defs/Grant"
        },
        "retry_of_grant_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "account_id",
        "grant",
        "retry_of_grant_id"
      ]
    },
    "ConsumeGrantCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "grant_id": {
          "type": "string",
          "format": "uuid"
        },
        "source_node_id": {
          "type": "string",
          "format": "uuid"
        },
        "request_id": {
          "type": "string",
          "format": "uuid"
        },
        "peer_proof": {
          "anyOf": [
            {
              "$ref": "#/$defs/PeerProof"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "grant_id",
        "source_node_id",
        "request_id",
        "peer_proof"
      ]
    },
    "RecordReceiptCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "receipt": {
          "$ref": "#/$defs/Receipt"
        },
        "raw_ref": {
          "$ref": "#/$defs/ObjectRef"
        }
      },
      "required": [
        "receipt",
        "raw_ref"
      ]
    },
    "RecordPeerCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "result": {
          "$ref": "#/$defs/PeerResult"
        },
        "raw_ref": {
          "$ref": "#/$defs/ObjectRef"
        }
      },
      "required": [
        "result",
        "raw_ref"
      ]
    },
    "CloseDayCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "day_start_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "day_end_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        }
      },
      "required": [
        "day_start_ms",
        "day_end_ms"
      ]
    },
    "AllocateDayCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "listener_day_id": {
          "type": "string",
          "format": "uuid"
        },
        "budget_day_id": {
          "type": "string",
          "format": "uuid"
        },
        "policy_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "allocation_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "required": [
        "listener_day_id",
        "budget_day_id",
        "policy_hash",
        "allocation_ids"
      ]
    },
    "FreezeArtifactCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "batch_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_ref": {
          "$ref": "#/$defs/ObjectRef"
        },
        "kind": {
          "type": "string",
          "enum": [
            "evidence",
            "accounting",
            "statement-index",
            "payment-journal",
            "correction"
          ]
        },
        "item_count": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "window_start_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "window_end_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "parent_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "supersedes_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "source_head_sequence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "source_state_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "effect_id": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "batch_id",
        "artifact_ref",
        "kind",
        "item_count",
        "window_start_ms",
        "window_end_ms",
        "parent_id",
        "supersedes_id",
        "source_head_sequence",
        "source_state_hash",
        "effect_id"
      ]
    },
    "RunPayment": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "payment_id": {
          "type": "string",
          "format": "uuid"
        },
        "allocation_line_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          }
        },
        "recipient": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "asset_metadata": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "amount_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "effect_id": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "payment_id",
        "allocation_line_ids",
        "recipient",
        "asset_metadata",
        "amount_micro_usdc",
        "effect_id"
      ]
    },
    "PrepareRunCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "run_id": {
          "type": "string",
          "format": "uuid"
        },
        "accounting_batch_id": {
          "type": "string",
          "format": "uuid"
        },
        "statement_index_batch_id": {
          "type": "string",
          "format": "uuid"
        },
        "payments": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RunPayment"
          }
        },
        "run_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      },
      "required": [
        "run_id",
        "accounting_batch_id",
        "statement_index_batch_id",
        "payments",
        "run_hash"
      ]
    },
    "SignedAttemptCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "payment_id": {
          "type": "string",
          "format": "uuid"
        },
        "attempt_index": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "signed_bytes_ref": {
          "$ref": "#/$defs/ObjectRef"
        },
        "tx_hash": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "sender": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "sender_sequence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "expiry_seconds": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "external_journal_ref": {
          "$ref": "#/$defs/ObjectRef"
        }
      },
      "required": [
        "payment_id",
        "attempt_index",
        "signed_bytes_ref",
        "tx_hash",
        "sender",
        "sender_sequence",
        "expiry_seconds",
        "external_journal_ref"
      ]
    },
    "TransferObservationCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "payment_id": {
          "type": "string",
          "format": "uuid"
        },
        "attempt_index": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "tx_hash": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "status": {
          "type": "string",
          "enum": [
            "confirmed_success",
            "confirmed_abort",
            "expired_absent",
            "uncertain"
          ]
        },
        "chain_id": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "ledger_version": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "maxLength": 20
            },
            {
              "type": "null"
            }
          ]
        },
        "ledger_time_seconds": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "asset_metadata": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "sender": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "recipient": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "amount_micro_usdc": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "observation_ref": {
          "$ref": "#/$defs/ObjectRef"
        }
      },
      "required": [
        "payment_id",
        "attempt_index",
        "tx_hash",
        "status",
        "chain_id",
        "ledger_version",
        "ledger_time_seconds",
        "asset_metadata",
        "sender",
        "recipient",
        "amount_micro_usdc",
        "observation_ref"
      ]
    },
    "CommitmentObservationCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "batch_id": {
          "type": "string",
          "format": "uuid"
        },
        "chain_id": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "package_address": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "tx_hash": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "chain_batch_id": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "artifact_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "ledger_version": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "observation_ref": {
          "$ref": "#/$defs/ObjectRef"
        }
      },
      "required": [
        "batch_id",
        "chain_id",
        "package_address",
        "tx_hash",
        "chain_batch_id",
        "artifact_hash",
        "ledger_version",
        "observation_ref"
      ]
    },
    "ClaimEffectCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "effect_id": {
          "type": "string",
          "format": "uuid"
        },
        "worker_id": {
          "type": "string",
          "format": "uuid"
        },
        "claim_id": {
          "type": "string",
          "format": "uuid"
        },
        "expires_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        }
      },
      "required": [
        "effect_id",
        "worker_id",
        "claim_id",
        "expires_ms"
      ]
    },
    "CompleteEffectCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "effect_id": {
          "type": "string",
          "format": "uuid"
        },
        "claim_id": {
          "type": "string",
          "format": "uuid"
        },
        "worker_id": {
          "type": "string",
          "format": "uuid"
        },
        "outcome": {
          "type": "string",
          "enum": [
            "completed",
            "failed",
            "uncertain"
          ]
        },
        "result_ref": {
          "anyOf": [
            {
              "$ref": "#/$defs/ObjectRef"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "effect_id",
        "claim_id",
        "worker_id",
        "outcome",
        "result_ref"
      ]
    },
    "CorrectionCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "correction_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact": {
          "$ref": "#/$defs/CorrectionArtifact"
        },
        "approval_ref": {
          "$ref": "#/$defs/ObjectRef"
        }
      },
      "required": [
        "correction_id",
        "artifact",
        "approval_ref"
      ]
    },
    "CommandEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "const": "london.v1"
        },
        "command_id": {
          "type": "string",
          "format": "uuid"
        },
        "command_type": {
          "type": "string",
          "enum": [
            "ApplyBillingObservation",
            "ImportCatalogue",
            "ActivateWork",
            "DisableWork",
            "AdmitNode",
            "ChangeNodeStatus",
            "RotateNodeKey",
            "OpenSession",
            "CloseSession",
            "IssueGrant",
            "ConsumeGrant",
            "RecordReceipt",
            "RecordPeerResult",
            "CloseDay",
            "DecideHold",
            "ImportFunding",
            "AllocateListenerDay",
            "FreezeArtifact",
            "PreparePayoutRun",
            "ApprovePayoutRun",
            "RecordSignedAttempt",
            "RecordTransferObservation",
            "RecordCommitmentObservation",
            "ClaimEffect",
            "CompleteEffect",
            "RecordCorrection",
            "RegisterAccount",
            "RecordNodeHealth",
            "UpdateRecipient",
            "CancelPayoutRun"
          ]
        },
        "actor_id": {
          "type": "string",
          "format": "uuid"
        },
        "admitted_at_ms": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "ruleset_version": {
          "const": "london.ledger.v1"
        },
        "expected_revisions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RevisionPrecondition"
          }
        },
        "payload": {},
        "evidence_hashes": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      },
      "required": [
        "schema_version",
        "command_id",
        "command_type",
        "actor_id",
        "admitted_at_ms",
        "ruleset_version",
        "expected_revisions",
        "payload",
        "evidence_hashes"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "ApplyBillingObservation"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/BillingEvent"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "ImportCatalogue"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/CatalogueImport"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "ActivateWork"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/WorkTarget"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "DisableWork"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/WorkTarget"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "AdmitNode"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/NodeAdmission"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "ChangeNodeStatus"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/NodeStatusCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "RotateNodeKey"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/NodeKeyCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "OpenSession"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/OpenSessionCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "CloseSession"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/CloseSessionCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "IssueGrant"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/IssueGrantCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "ConsumeGrant"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/ConsumeGrantCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "RecordReceipt"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/RecordReceiptCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "RecordPeerResult"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/RecordPeerCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "CloseDay"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/CloseDayCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "DecideHold"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/HoldCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "ImportFunding"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/FundingImport"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "AllocateListenerDay"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/AllocateDayCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "FreezeArtifact"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/FreezeArtifactCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "PreparePayoutRun"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/PrepareRunCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "ApprovePayoutRun"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/PayoutApproval"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "RecordSignedAttempt"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/SignedAttemptCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "RecordTransferObservation"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/TransferObservationCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "RecordCommitmentObservation"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/CommitmentObservationCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "ClaimEffect"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/ClaimEffectCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "CompleteEffect"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/CompleteEffectCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "RecordCorrection"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/CorrectionCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "RegisterAccount"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/RegisterAccountCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "RecordNodeHealth"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/HealthRequest"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "UpdateRecipient"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/UpdateRecipientCommand"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "command_type": {
                "const": "CancelPayoutRun"
              }
            }
          },
          "then": {
            "properties": {
              "payload": {
                "$ref": "#/$defs/CancelRunCommand"
              }
            }
          }
        }
      ]
    },
    "CommandResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "entity_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          }
        },
        "amount_micro_usdc": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "maxLength": 20
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "code",
        "entity_ids",
        "amount_micro_usdc"
      ]
    },
    "JournalEntry": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "sequence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "previous_entry_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "command": {
          "$ref": "#/$defs/CommandEnvelope"
        },
        "outcome": {
          "type": "string",
          "enum": [
            "accepted",
            "rejected"
          ]
        },
        "result": {
          "$ref": "#/$defs/CommandResult"
        },
        "delta_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "entry_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      },
      "required": [
        "sequence",
        "previous_entry_hash",
        "command",
        "outcome",
        "result",
        "delta_hash",
        "entry_hash"
      ]
    },
    "LogicalRow": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "column_family": {
          "type": "string",
          "enum": [
            "state",
            "unique",
            "command_result",
            "outbox"
          ]
        },
        "key": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "pattern": "^[ -~]+$"
        },
        "value": {
          "type": "object",
          "description": "Versioned domain record. The entity-key prefix selects a closed record schema, never arbitrary caller-authored mutations."
        }
      },
      "required": [
        "column_family",
        "key",
        "value"
      ]
    },
    "DeltaRow": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "column_family": {
          "type": "string",
          "enum": [
            "state",
            "unique",
            "command_result",
            "outbox",
            "events"
          ]
        },
        "key": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "value": {
          "type": "object"
        }
      },
      "required": [
        "column_family",
        "key",
        "value"
      ]
    },
    "CheckpointFile": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "logical_state",
            "journal",
            "events"
          ]
        },
        "object_id": {
          "type": "string",
          "format": "uuid"
        },
        "sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "byte_length": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "start_sequence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "end_sequence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        }
      },
      "required": [
        "kind",
        "object_id",
        "sha256",
        "byte_length",
        "start_sequence",
        "end_sequence"
      ]
    },
    "Checkpoint": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "const": "london.v1"
        },
        "checkpoint_id": {
          "type": "string",
          "format": "uuid"
        },
        "ruleset_version": {
          "const": "london.ledger.v1"
        },
        "logical_schema_version": {
          "const": "1"
        },
        "sequence": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$",
          "maxLength": 20
        },
        "last_entry_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "logical_state_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "files": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CheckpointFile"
          }
        },
        "parent_checkpoint_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "private_aux_excluded": {
          "const": true
        }
      },
      "required": [
        "schema_version",
        "checkpoint_id",
        "ruleset_version",
        "logical_schema_version",
        "sequence",
        "last_entry_hash",
        "logical_state_hash",
        "files",
        "parent_checkpoint_id",
        "private_aux_excluded"
      ]
    },
    "RegisterAccountCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "account_id": {
          "type": "string",
          "format": "uuid"
        },
        "roles": {
          "type": "array",
          "minItems": 1,
          "items": {
            "enum": [
              "listener",
              "artist",
              "operator",
              "admin",
              "finance"
            ]
          }
        },
        "identity_evidence": {
          "$ref": "#/$defs/ObjectRef"
        }
      },
      "required": [
        "account_id",
        "roles",
        "identity_evidence"
      ]
    },
    "UpdateRecipientCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "beneficiary_id": {
          "type": "string",
          "format": "uuid"
        },
        "new_address": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{64}$"
        },
        "ownership_evidence": {
          "$ref": "#/$defs/ObjectRef"
        },
        "finance_approval_ref": {
          "$ref": "#/$defs/ObjectRef"
        }
      },
      "required": [
        "beneficiary_id",
        "new_address",
        "ownership_evidence",
        "finance_approval_ref"
      ]
    },
    "CancelRunCommand": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "run_id": {
          "type": "string",
          "format": "uuid"
        },
        "reason_code": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        }
      },
      "required": [
        "run_id",
        "reason_code"
      ]
    }
  }
}
