{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/agent-allowance-wallet.schema.json",
  "title": "Agent Allowance Wallet",
  "type": "object",
  "required": ["schema_version", "mode", "agent_id"],
  "properties": {
    "schema_version": { "type": "string" },
    "mode": { "type": "string", "enum": ["create_wallet", "attach_funding_reference", "authorize_payment", "record_receipt", "close_wallet"] },
    "wallet_id": { "type": "string" },
    "agent_id": { "type": "string" },
    "agent_name": { "type": "string" },
    "organization_name": { "type": "string" },
    "owner_reference": { "type": "string" },
    "currency": { "type": "string", "default": "usdc" },
    "allowance_limit_units": { "type": "number", "minimum": 0 },
    "amount_units": { "type": "number", "minimum": 0 },
    "funding_reference": { "type": "string" },
    "settlement_reference": { "type": "string" },
    "settlement_rail": { "type": "string", "enum": ["agent_allowance", "stablecoin_reference", "x402_reference", "hosted_checkout", "invoice_or_purchase_order", "order_reference"] },
    "counterparty_agent_id": { "type": "string" },
    "counterparty_service": { "type": "string" },
    "payment_intent_id": { "type": "string" },
    "work_order_id": { "type": "string" },
    "return_package_id": { "type": "string" },
    "allowed_rails": { "type": "array", "items": { "type": "string" } },
    "allowed_counterparties": { "type": "array", "items": { "type": "string" } },
    "allowed_actions": { "type": "array", "items": { "type": "string" } },
    "preferred_payment_rails": { "type": "array", "items": { "type": "string" } },
    "receipt_payload": { "type": "object" }
  },
  "additionalProperties": true
}
