{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://vaultfire.example/schemas/x402-v2-live-evidence.schema.json",
  "title": "Vaultfire owner-supplied V2 live x402 evidence",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema", "evidenceId", "ownerAttestation", "route", "payment",
    "transactionHash", "collectedAt", "finalityPolicy"
  ],
  "properties": {
    "schema": { "const": "vaultfire.x402.v2-live-evidence.v1" },
    "evidenceId": { "type": "string", "pattern": "^[A-Za-z0-9._:-]{1,160}$" },
    "ownerAttestation": {
      "type": "object",
      "additionalProperties": false,
      "required": ["suppliedBy", "approvedAt", "authorization"],
      "properties": {
        "suppliedBy": { "type": "string", "minLength": 1, "maxLength": 256 },
        "approvedAt": { "type": "string", "format": "date-time" },
        "authorization": { "type": "string", "minLength": 1, "maxLength": 512 }
      }
    },
    "route": {
      "type": "object",
      "additionalProperties": false,
      "required": ["protocolVersion", "method", "path"],
      "properties": {
        "protocolVersion": { "const": "v2" },
        "method": { "type": "string", "pattern": "^[A-Z]+$" },
        "path": { "type": "string", "pattern": "^/" }
      }
    },
    "payment": {
      "type": "object",
      "additionalProperties": false,
      "required": ["x402Version", "network", "chainId", "asset", "amount", "payee", "authorizationId", "nonce", "validAfter", "expiresAt"],
      "properties": {
        "x402Version": { "const": 2 },
        "network": { "const": "eip155:8453" },
        "chainId": { "const": 8453 },
        "asset": { "type": "string", "pattern": "^0x[0-9a-fA-F]{40}$" },
        "amount": { "type": "string", "pattern": "^[1-9][0-9]*$" },
        "payee": { "type": "string", "pattern": "^0x[0-9a-fA-F]{40}$" },
        "payer": { "type": "string", "pattern": "^0x[0-9a-fA-F]{40}$" },
        "authorizationId": { "type": "string", "minLength": 1, "maxLength": 160 },
        "nonce": { "type": "string", "minLength": 1, "maxLength": 160 },
        "validAfter": { "type": "integer", "minimum": 0 },
        "expiresAt": { "type": "integer", "minimum": 0 }
      }
    },
    "transactionHash": { "type": "string", "pattern": "^0x[0-9a-fA-F]{64}$" },
    "collectedAt": { "type": "string", "format": "date-time" },
    "finalityPolicy": {
      "type": "object",
      "additionalProperties": false,
      "required": ["requiredConfirmations"],
      "properties": { "requiredConfirmations": { "type": "integer", "minimum": 1, "maximum": 10000 } }
    }
  }
}
