{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/wallet-bound-rail-run.schema.json",
  "title": "Wallet-Bound Rail Run",
  "type": "object",
  "required": [
    "schema_version",
    "mode",
    "rail_key",
    "wallet_id",
    "payment_intent_id"
  ],
  "properties": {
    "schema_version": {
      "type": "string"
    },
    "mode": {
      "type": "string",
      "enum": [
        "build_wallet_bound_run",
        "record_wallet_bound_receipt",
        "read_wallet_bound_runs"
      ]
    },
    "wallet_bound_run_id": {
      "type": "string"
    },
    "rail_key": {
      "type": "string",
      "enum": [
        "packetops",
        "diligenceops"
      ]
    },
    "wallet_id": {
      "type": "string"
    },
    "payment_intent_id": {
      "type": "string"
    },
    "settlement_rail": {
      "type": "string",
      "enum": [
        "agent_allowance",
        "stablecoin_reference",
        "x402_reference",
        "hosted_checkout",
        "invoice_or_purchase_order",
        "order_reference"
      ]
    },
    "settlement_reference": {
      "type": "string"
    },
    "receipt_id": {
      "type": "string"
    },
    "amount_units": {
      "type": "number",
      "minimum": 0
    },
    "fee_units": {
      "type": "number",
      "minimum": 0
    },
    "currency": {
      "type": "string"
    },
    "counterparty_service": {
      "type": "string"
    },
    "work_order_id": {
      "type": "string"
    },
    "return_package_id": {
      "type": "string"
    },
    "returned_package_summary": {
      "type": "object"
    },
    "source_payload": {
      "type": "object"
    }
  },
  "additionalProperties": true
}