{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://protocol.proxypay.invalid/open-request/v1/schema.json",
  "title": "ProxyPay Open Payment Request v1",
  "description": "A non-money-moving signed review request. The .invalid identifiers and bundled fixtures are test-only.",
  "type": "object",
  "additionalProperties": false,
  "minProperties": 16,
  "maxProperties": 16,
  "required": [
    "version",
    "issuer",
    "key_id",
    "request_id",
    "payment_reference",
    "merchant_display_name",
    "location_display_name",
    "recipient",
    "network",
    "token_mint",
    "amount_base_units",
    "issued_at",
    "expires_at",
    "nonce",
    "display_reference",
    "signature"
  ],
  "properties": {
    "version": { "const": "1" },
    "issuer": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://",
      "maxLength": 256
    },
    "key_id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{2,63}$"
    },
    "request_id": {
      "type": "string",
      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
    },
    "payment_reference": {
      "type": "string",
      "minLength": 32,
      "maxLength": 44,
      "pattern": "^[1-9A-HJ-NP-Za-km-z]{32,44}$"
    },
    "merchant_display_name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "location_display_name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "recipient": {
      "type": "string",
      "minLength": 32,
      "maxLength": 44,
      "pattern": "^[1-9A-HJ-NP-Za-km-z]{32,44}$"
    },
    "network": {
      "type": "string",
      "enum": ["devnet", "testnet", "mainnet-beta"]
    },
    "token_mint": {
      "type": "string",
      "minLength": 32,
      "maxLength": 44,
      "pattern": "^[1-9A-HJ-NP-Za-km-z]{32,44}$"
    },
    "amount_base_units": {
      "type": "string",
      "pattern": "^[1-9][0-9]*$",
      "maxLength": 15
    },
    "issued_at": {
      "type": "string",
      "minLength": 20,
      "maxLength": 20,
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "expires_at": {
      "type": "string",
      "minLength": 20,
      "maxLength": 20,
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "nonce": {
      "type": "string",
      "minLength": 24,
      "maxLength": 64,
      "pattern": "^[A-Za-z0-9_-]{24,64}$"
    },
    "display_reference": {
      "type": "string",
      "minLength": 4,
      "maxLength": 24,
      "pattern": "^[A-Z0-9](?:[A-Z0-9-]{2,22}[A-Z0-9])$"
    },
    "signature": {
      "type": "string",
      "minLength": 86,
      "maxLength": 86,
      "pattern": "^[A-Za-z0-9_-]{85}[AQgw]$"
    }
  }
}
