{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agentpaywire.com/schemas/support.schema.json",
  "title": "Agent Paywire voluntary support",
  "description": "Voluntary Bitcoin tip for using Agent Paywire open data. Payment is never required.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "voluntary",
    "purpose",
    "data_is_free",
    "access_conditional_on_payment",
    "methods",
    "suggested_amounts_sats",
    "suggested_amounts_optional",
    "note",
    "updated",
    "warning",
    "usdc_contracts_source"
  ],
  "properties": {
    "$schema": {
      "type": "string"
    },
    "voluntary": {
      "const": true
    },
    "purpose": {
      "type": "string",
      "minLength": 1
    },
    "data_is_free": {
      "const": true
    },
    "access_conditional_on_payment": {
      "const": false
    },
    "methods": {
      "type": "array",
      "minItems": 6,
      "items": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "address",
              "address_type",
              "format",
              "network",
              "bip21_uri",
              "qr_svg",
              "qr_text",
              "qr_error_correction"
            ],
            "properties": {
              "type": {
                "const": "bitcoin-onchain"
              },
              "address": {
                "type": "string",
                "minLength": 1,
                "examples": [
                  "bc1qz6p0nwkl69gcm8cjaxayvnv2rf7e2tj03uzyku"
                ],
                "description": "P2WPKH native segwit receive address. The previous donation address should no longer be used."
              },
              "address_type": {
                "const": "p2wpkh"
              },
              "format": {
                "const": "native segwit"
              },
              "network": {
                "const": "mainnet"
              },
              "bip21_uri": {
                "type": "string",
                "minLength": 1
              },
              "qr_svg": {
                "type": "string",
                "format": "uri"
              },
              "qr_text": {
                "type": "string",
                "minLength": 1
              },
              "qr_error_correction": {
                "enum": [
                  "L",
                  "M",
                  "Q",
                  "H"
                ]
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "offer",
              "uri",
              "bip21_uri",
              "qr_svg",
              "qr_text",
              "qr_error_correction"
            ],
            "properties": {
              "type": {
                "const": "lightning-bolt12"
              },
              "offer": {
                "type": "string",
                "minLength": 1
              },
              "uri": {
                "type": "string",
                "minLength": 1
              },
              "bip21_uri": {
                "type": "string",
                "minLength": 1
              },
              "qr_svg": {
                "type": "string",
                "format": "uri"
              },
              "qr_text": {
                "type": "string",
                "minLength": 1
              },
              "qr_error_correction": {
                "enum": [
                  "L",
                  "M",
                  "Q",
                  "H"
                ]
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "asset",
              "network",
              "chain_id",
              "address",
              "token_contract",
              "eip681_uri"
            ],
            "properties": {
              "type": {
                "const": "evm-stablecoin"
              },
              "asset": {
                "const": "USDC"
              },
              "network": {
                "enum": [
                  "Base",
                  "Ethereum",
                  "Arbitrum One"
                ]
              },
              "chain_id": {
                "enum": [
                  8453,
                  1,
                  42161
                ]
              },
              "primary": {
                "const": true
              },
              "address": {
                "type": "string",
                "minLength": 1
              },
              "token_contract": {
                "type": "string",
                "description": "Circle-issued native USDC. See usdc_contracts_source. Example, Base: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913."
              },
              "eip681_uri": {
                "type": "string",
                "minLength": 1
              },
              "qr_svg": {
                "type": "string",
                "format": "uri"
              },
              "qr_text": {
                "type": "string",
                "minLength": 1
              },
              "qr_error_correction": {
                "enum": [
                  "L",
                  "M",
                  "Q",
                  "H"
                ]
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "asset",
              "network",
              "address",
              "mint",
              "uri",
              "qr_svg",
              "qr_text",
              "qr_error_correction"
            ],
            "properties": {
              "type": {
                "const": "solana-stablecoin"
              },
              "asset": {
                "const": "USDC"
              },
              "network": {
                "const": "Solana"
              },
              "address": {
                "type": "string",
                "minLength": 1
              },
              "mint": {
                "type": "string",
                "description": "Circle-issued USDC mint on Solana: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v."
              },
              "uri": {
                "type": "string",
                "minLength": 1
              },
              "qr_svg": {
                "type": "string",
                "format": "uri"
              },
              "qr_text": {
                "type": "string",
                "minLength": 1
              },
              "qr_error_correction": {
                "enum": [
                  "L",
                  "M",
                  "Q",
                  "H"
                ]
              }
            }
          }
        ]
      }
    },
    "suggested_amounts_sats": {
      "type": "array",
      "description": "Optional suggestions in satoshis. Paying a different amount, or nothing, is fine.",
      "items": {
        "type": "integer",
        "minimum": 1
      }
    },
    "suggested_amounts_optional": {
      "const": true
    },
    "note": {
      "type": "string",
      "minLength": 1
    },
    "updated": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "warning": {
      "const": "Send only USDC on the listed networks; other tokens or networks may be lost."
    },
    "usdc_contracts_source": {
      "const": "https://developers.circle.com/stablecoins/usdc-contract-addresses",
      "description": "Circle Docs page for native USDC contract addresses. Listed networks are Base, Ethereum, Arbitrum One, and Solana."
    },
    "paid_api": {
      "type": "object",
      "additionalProperties": false,
      "description": "Optional. Present only while the paid convenience API is live. Site files stay free.",
      "required": [
        "live",
        "paid",
        "protocol",
        "payment",
        "url",
        "price_sats",
        "credits",
        "ttl_days",
        "note"
      ],
      "properties": {
        "live": {
          "const": true
        },
        "paid": {
          "const": true
        },
        "protocol": {
          "const": "L402"
        },
        "payment": {
          "const": "Lightning"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "price_sats": {
          "type": "integer",
          "minimum": 1
        },
        "credits": {
          "type": "integer",
          "minimum": 1
        },
        "ttl_days": {
          "type": "integer",
          "minimum": 1
        },
        "note": {
          "type": "string",
          "minLength": 1
        }
      }
    }
  }
}
