{
  "openapi": "3.1.2",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "Operator-owned Wallet API",
    "version": "1.0.0-draft.1",
    "description": "Provider calls Operator. New independent v1 contract, not wire compatible with inbound Operator API. No production transport is implemented. See wallet-api-v1.md and ADR 0014."
  },
  "servers": [
    {
      "url": "https://wallet.example.com",
      "description": "Reserved example; trusted integration selects real endpoint."
    }
  ],
  "paths": {
    "/v1/wallet/balance": {
      "post": {
        "operationId": "observeWalletBalance",
        "security": [
          {
            "WalletAccessToken": [],
            "WalletMessageSignature": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentType"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          }
        ],
        "responses": {
          "200": {
            "description": "Authoritative observation. Monetary terminal business decisions, including rejection, use HTTP 200.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "400": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "401": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "WWW-Authenticate": {
                "schema": {
                  "const": "Bearer realm=\"wallet-api\""
                },
                "description": "Generic authentication challenge.",
                "required": true
              }
            }
          },
          "403": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "409": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "413": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "415": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "422": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "429": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            }
          },
          "500": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "503": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            }
          },
          "504": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BalanceRequest"
              }
            }
          }
        }
      }
    },
    "/v1/wallet/debits": {
      "post": {
        "operationId": "submitWalletDebit",
        "security": [
          {
            "WalletAccessToken": [],
            "WalletMessageSignature": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentType"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          }
        ],
        "responses": {
          "200": {
            "description": "Authoritative observation. Monetary terminal business decisions, including rejection, use HTTP 200.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "400": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "401": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "WWW-Authenticate": {
                "schema": {
                  "const": "Bearer realm=\"wallet-api\""
                },
                "description": "Generic authentication challenge.",
                "required": true
              }
            }
          },
          "403": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "409": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "413": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "415": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "422": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "429": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            }
          },
          "500": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "503": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            }
          },
          "504": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DebitRequest"
              }
            }
          }
        }
      }
    },
    "/v1/wallet/credits": {
      "post": {
        "operationId": "submitWalletCredit",
        "security": [
          {
            "WalletAccessToken": [],
            "WalletMessageSignature": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentType"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          }
        ],
        "responses": {
          "200": {
            "description": "Authoritative observation. Monetary terminal business decisions, including rejection, use HTTP 200.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "400": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "401": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "WWW-Authenticate": {
                "schema": {
                  "const": "Bearer realm=\"wallet-api\""
                },
                "description": "Generic authentication challenge.",
                "required": true
              }
            }
          },
          "403": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "409": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "413": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "415": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "422": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "429": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            }
          },
          "500": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "503": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            }
          },
          "504": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreditRequest"
              }
            }
          }
        }
      }
    },
    "/v1/wallet/reversals": {
      "post": {
        "operationId": "submitWalletReversal",
        "security": [
          {
            "WalletAccessToken": [],
            "WalletMessageSignature": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/ContentType"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          }
        ],
        "responses": {
          "200": {
            "description": "Authoritative observation. Monetary terminal business decisions, including rejection, use HTTP 200.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "400": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "401": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "WWW-Authenticate": {
                "schema": {
                  "const": "Bearer realm=\"wallet-api\""
                },
                "description": "Generic authentication challenge.",
                "required": true
              }
            }
          },
          "403": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "409": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "413": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "415": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "422": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "429": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            }
          },
          "500": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "503": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            }
          },
          "504": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReversalRequest"
              }
            }
          }
        }
      }
    },
    "/v1/wallet/transactions/{transaction_id}": {
      "get": {
        "operationId": "getWalletTransactionStatus",
        "security": [
          {
            "WalletAccessToken": [],
            "WalletMessageSignature": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SignatureInput"
          },
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/TransactionId"
          }
        ],
        "responses": {
          "200": {
            "description": "Authoritative observation. Monetary terminal business decisions, including rejection, use HTTP 200.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LookupResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "400": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "401": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "WWW-Authenticate": {
                "schema": {
                  "const": "Bearer realm=\"wallet-api\""
                },
                "description": "Generic authentication challenge.",
                "required": true
              }
            }
          },
          "403": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "409": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "413": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "415": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "422": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "429": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            }
          },
          "500": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "503": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            }
          },
          "504": {
            "description": "Transport observation only; retryable never proves lack of monetary effect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          },
          "404": {
            "description": "not_found: absence at read time only. A late original request can still arrive.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "X-Content-Type-Options": {
                "$ref": "#/components/headers/XContentTypeOptions"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "WalletAccessToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "Separate opaque Operator-issued provider Wallet credential, bound to provider/operator/environment/account namespace and allowed signing key IDs."
      },
      "WalletMessageSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "Signature",
        "description": "RFC9421 sig1 / Ed25519 / provider-wallet-api-v1; nonce replay enforcement. See separate normative Wallet security profile."
      }
    },
    "parameters": {
      "SignatureInput": {
        "name": "Signature-Input",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "Signature": {
        "name": "Signature",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "ContentDigest": {
        "name": "Content-Digest",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "ContentType": {
        "name": "Content-Type",
        "in": "header",
        "required": true,
        "schema": {
          "const": "application/json"
        }
      },
      "TransactionId": {
        "name": "transaction_id",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/Id"
        }
      }
    },
    "schemas": {
      "Id": {
        "type": "string",
        "format": "uuid",
        "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
      },
      "UtcTime": {
        "type": "string",
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{0,5}[1-9])?Z$",
        "description": "Canonical RFC3339 UTC, no leap second, up to six fractional digits without trailing zero. Chosen once for business time."
      },
      "PlayerId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256,
        "pattern": "^[^\\u0000]+$"
      },
      "Currency": {
        "type": "string",
        "pattern": "^[A-Z]{3}$"
      },
      "OperatorSessionToken": {
        "type": "string",
        "minLength": 1,
        "maxLength": 4096,
        "writeOnly": true
      },
      "Money": {
        "type": "object",
        "required": [
          "currency",
          "minor_units"
        ],
        "properties": {
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "minor_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9223372036854775807
          },
          "operator_session_token": false
        },
        "description": "Exact JSON integer; implementations MUST NOT convert through binary64. Receipt objects allow additive properties."
      },
      "CommandIdentity": {
        "type": "object",
        "properties": {
          "transaction_id": {
            "$ref": "#/components/schemas/Id"
          },
          "operation": {
            "type": "string",
            "enum": [
              "debit",
              "credit",
              "reversal"
            ]
          },
          "brand_id": {
            "$ref": "#/components/schemas/Id"
          },
          "game_session_id": {
            "$ref": "#/components/schemas/Id"
          },
          "game_id": {
            "$ref": "#/components/schemas/Id"
          },
          "player_id": {
            "$ref": "#/components/schemas/PlayerId"
          },
          "round_id": {
            "$ref": "#/components/schemas/Id"
          },
          "amount": {
            "$ref": "#/components/schemas/Money"
          },
          "reason": {
            "type": "string",
            "enum": [
              "gameplay",
              "round_close",
              "compensation"
            ]
          },
          "round_closed": {
            "type": "boolean"
          },
          "occurred_at": {
            "$ref": "#/components/schemas/UtcTime"
          },
          "original_transaction_id": {
            "$ref": "#/components/schemas/Id"
          },
          "operator_session_token": false
        },
        "required": [
          "transaction_id",
          "operation",
          "brand_id",
          "game_session_id",
          "game_id",
          "player_id",
          "round_id",
          "amount",
          "reason",
          "round_closed",
          "occurred_at"
        ],
        "description": "All fields form immutable payload binding. Reversal original ID differs from its own ID; original player/currency/amount/Brand/Game/session/round and round_closed must match the debit intent. Original reason and occurred_at remain those of the debit; compensation reason/time belong to the reversal.",
        "allOf": [
          {
            "if": {
              "properties": {
                "operation": {
                  "const": "debit"
                }
              }
            },
            "then": {
              "properties": {
                "reason": {
                  "const": "gameplay"
                },
                "amount": {
                  "properties": {
                    "minor_units": {
                      "minimum": 1
                    }
                  }
                }
              },
              "not": {
                "required": [
                  "original_transaction_id"
                ]
              }
            }
          },
          {
            "if": {
              "properties": {
                "operation": {
                  "const": "reversal"
                }
              }
            },
            "then": {
              "properties": {
                "reason": {
                  "const": "compensation"
                },
                "amount": {
                  "properties": {
                    "minor_units": {
                      "minimum": 1
                    }
                  }
                }
              },
              "required": [
                "original_transaction_id"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "operation": {
                  "const": "credit"
                }
              }
            },
            "then": {
              "not": {
                "required": [
                  "original_transaction_id"
                ]
              },
              "properties": {
                "reason": {
                  "enum": [
                    "gameplay",
                    "round_close"
                  ]
                }
              },
              "allOf": [
                {
                  "if": {
                    "properties": {
                      "amount": {
                        "properties": {
                          "minor_units": {
                            "const": 0
                          }
                        }
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "reason": {
                        "const": "round_close"
                      },
                      "round_closed": {
                        "const": true
                      }
                    }
                  }
                },
                {
                  "if": {
                    "properties": {
                      "reason": {
                        "const": "round_close"
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "round_closed": {
                        "const": true
                      }
                    }
                  }
                }
              ]
            }
          }
        ]
      },
      "DebitRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "transaction_id": {
            "$ref": "#/components/schemas/Id"
          },
          "operation": {
            "const": "debit"
          },
          "brand_id": {
            "$ref": "#/components/schemas/Id"
          },
          "game_session_id": {
            "$ref": "#/components/schemas/Id"
          },
          "game_id": {
            "$ref": "#/components/schemas/Id"
          },
          "player_id": {
            "$ref": "#/components/schemas/PlayerId"
          },
          "round_id": {
            "$ref": "#/components/schemas/Id"
          },
          "amount": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "currency",
              "minor_units"
            ],
            "properties": {
              "currency": {
                "$ref": "#/components/schemas/Currency"
              },
              "minor_units": {
                "type": "integer",
                "format": "int64",
                "minimum": 1,
                "maximum": 9223372036854775807
              }
            }
          },
          "reason": {
            "const": "gameplay"
          },
          "round_closed": {
            "type": "boolean"
          },
          "occurred_at": {
            "$ref": "#/components/schemas/UtcTime"
          },
          "operator_session_token": {
            "$ref": "#/components/schemas/OperatorSessionToken"
          }
        },
        "required": [
          "transaction_id",
          "operation",
          "brand_id",
          "game_session_id",
          "game_id",
          "player_id",
          "round_id",
          "amount",
          "reason",
          "round_closed",
          "occurred_at",
          "operator_session_token"
        ]
      },
      "CreditRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "transaction_id": {
            "$ref": "#/components/schemas/Id"
          },
          "operation": {
            "const": "credit"
          },
          "brand_id": {
            "$ref": "#/components/schemas/Id"
          },
          "game_session_id": {
            "$ref": "#/components/schemas/Id"
          },
          "game_id": {
            "$ref": "#/components/schemas/Id"
          },
          "player_id": {
            "$ref": "#/components/schemas/PlayerId"
          },
          "round_id": {
            "$ref": "#/components/schemas/Id"
          },
          "amount": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "currency",
              "minor_units"
            ],
            "properties": {
              "currency": {
                "$ref": "#/components/schemas/Currency"
              },
              "minor_units": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "maximum": 9223372036854775807
              }
            }
          },
          "reason": {
            "enum": [
              "gameplay",
              "round_close"
            ]
          },
          "round_closed": {
            "type": "boolean"
          },
          "occurred_at": {
            "$ref": "#/components/schemas/UtcTime"
          },
          "operator_session_token": {
            "$ref": "#/components/schemas/OperatorSessionToken"
          }
        },
        "required": [
          "transaction_id",
          "operation",
          "brand_id",
          "game_session_id",
          "game_id",
          "player_id",
          "round_id",
          "amount",
          "reason",
          "round_closed",
          "occurred_at"
        ],
        "allOf": [
          {
            "if": {
              "properties": {
                "amount": {
                  "properties": {
                    "minor_units": {
                      "const": 0
                    }
                  }
                }
              }
            },
            "then": {
              "properties": {
                "reason": {
                  "const": "round_close"
                },
                "round_closed": {
                  "const": true
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "reason": {
                  "const": "round_close"
                }
              }
            },
            "then": {
              "properties": {
                "round_closed": {
                  "const": true
                }
              }
            }
          }
        ]
      },
      "ReversalRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "transaction_id": {
            "$ref": "#/components/schemas/Id"
          },
          "operation": {
            "const": "reversal"
          },
          "brand_id": {
            "$ref": "#/components/schemas/Id"
          },
          "game_session_id": {
            "$ref": "#/components/schemas/Id"
          },
          "game_id": {
            "$ref": "#/components/schemas/Id"
          },
          "player_id": {
            "$ref": "#/components/schemas/PlayerId"
          },
          "round_id": {
            "$ref": "#/components/schemas/Id"
          },
          "amount": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "currency",
              "minor_units"
            ],
            "properties": {
              "currency": {
                "$ref": "#/components/schemas/Currency"
              },
              "minor_units": {
                "type": "integer",
                "format": "int64",
                "minimum": 1,
                "maximum": 9223372036854775807
              }
            }
          },
          "reason": {
            "const": "compensation"
          },
          "round_closed": {
            "type": "boolean"
          },
          "occurred_at": {
            "$ref": "#/components/schemas/UtcTime"
          },
          "original_transaction_id": {
            "$ref": "#/components/schemas/Id"
          },
          "operator_session_token": {
            "$ref": "#/components/schemas/OperatorSessionToken"
          }
        },
        "required": [
          "transaction_id",
          "operation",
          "brand_id",
          "game_session_id",
          "game_id",
          "player_id",
          "round_id",
          "amount",
          "reason",
          "round_closed",
          "occurred_at",
          "original_transaction_id"
        ]
      },
      "BalanceIdentity": {
        "type": "object",
        "required": [
          "brand_id",
          "game_session_id",
          "player_id",
          "currency"
        ],
        "properties": {
          "brand_id": {
            "$ref": "#/components/schemas/Id"
          },
          "game_session_id": {
            "$ref": "#/components/schemas/Id"
          },
          "player_id": {
            "$ref": "#/components/schemas/PlayerId"
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "operator_session_token": false
        }
      },
      "BalanceRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "brand_id",
          "game_session_id",
          "player_id",
          "currency",
          "operator_session_token"
        ],
        "properties": {
          "brand_id": {
            "$ref": "#/components/schemas/Id"
          },
          "game_session_id": {
            "$ref": "#/components/schemas/Id"
          },
          "player_id": {
            "$ref": "#/components/schemas/PlayerId"
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "operator_session_token": {
            "$ref": "#/components/schemas/OperatorSessionToken"
          }
        }
      },
      "BalanceResponse": {
        "type": "object",
        "required": [
          "identity",
          "balance",
          "observed_at"
        ],
        "properties": {
          "identity": {
            "$ref": "#/components/schemas/BalanceIdentity"
          },
          "balance": {
            "$ref": "#/components/schemas/Money"
          },
          "observed_at": {
            "$ref": "#/components/schemas/UtcTime"
          },
          "operator_session_token": false
        }
      },
      "Receipt": {
        "type": "object",
        "required": [
          "identity",
          "outcome",
          "processed_at"
        ],
        "properties": {
          "identity": {
            "$ref": "#/components/schemas/CommandIdentity"
          },
          "outcome": {
            "enum": [
              "succeeded",
              "rejected"
            ]
          },
          "rejection_code": {
            "enum": [
              "insufficient_funds",
              "session_invalid",
              "gameplay_not_allowed",
              "currency_unsupported",
              "transaction_cancelled",
              "original_already_reversed"
            ]
          },
          "first_reversal_id": {
            "$ref": "#/components/schemas/Id"
          },
          "reversal_effect": {
            "enum": [
              "refunded",
              "prevented",
              "no_effect"
            ]
          },
          "processed_at": {
            "$ref": "#/components/schemas/UtcTime"
          },
          "balance_after": {
            "$ref": "#/components/schemas/Money"
          },
          "operator_session_token": false
        },
        "description": "Full identity MUST equal intent; currency MUST match. Unknown outcome/code is invalid. Optional fields absent, never null.",
        "allOf": [
          {
            "if": {
              "properties": {
                "outcome": {
                  "const": "rejected"
                }
              }
            },
            "then": {
              "required": [
                "rejection_code"
              ],
              "not": {
                "required": [
                  "reversal_effect"
                ]
              }
            },
            "else": {
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "rejection_code"
                    ]
                  },
                  {
                    "required": [
                      "first_reversal_id"
                    ]
                  }
                ]
              }
            }
          },
          {
            "if": {
              "properties": {
                "outcome": {
                  "const": "succeeded"
                },
                "identity": {
                  "properties": {
                    "operation": {
                      "const": "reversal"
                    }
                  }
                }
              }
            },
            "then": {
              "required": [
                "reversal_effect"
              ]
            },
            "else": {
              "not": {
                "required": [
                  "reversal_effect"
                ]
              }
            }
          },
          {
            "if": {
              "required": [
                "rejection_code"
              ],
              "properties": {
                "rejection_code": {
                  "const": "original_already_reversed"
                }
              }
            },
            "then": {
              "required": [
                "first_reversal_id"
              ],
              "properties": {
                "identity": {
                  "properties": {
                    "operation": {
                      "const": "reversal"
                    }
                  }
                }
              }
            },
            "else": {
              "not": {
                "required": [
                  "first_reversal_id"
                ]
              }
            }
          },
          {
            "if": {
              "required": [
                "rejection_code"
              ],
              "properties": {
                "rejection_code": {
                  "const": "transaction_cancelled"
                }
              }
            },
            "then": {
              "properties": {
                "identity": {
                  "properties": {
                    "operation": {
                      "const": "debit"
                    }
                  }
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "rejection_code"
              ],
              "properties": {
                "rejection_code": {
                  "enum": [
                    "insufficient_funds",
                    "session_invalid",
                    "gameplay_not_allowed"
                  ]
                }
              }
            },
            "then": {
              "properties": {
                "identity": {
                  "properties": {
                    "operation": {
                      "const": "debit"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "LookupResponse": {
        "type": "object",
        "required": [
          "status",
          "transaction_id"
        ],
        "properties": {
          "status": {
            "enum": [
              "receipt",
              "pending"
            ]
          },
          "transaction_id": {
            "$ref": "#/components/schemas/Id"
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          },
          "operator_session_token": false
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "status": {
                  "const": "receipt"
                }
              }
            },
            "then": {
              "required": [
                "receipt"
              ]
            },
            "else": {
              "not": {
                "required": [
                  "receipt"
                ]
              }
            }
          }
        ]
      },
      "ProblemDetails": {
        "type": "object",
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "code",
          "request_id",
          "retryable"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599
          },
          "detail": {
            "type": "string"
          },
          "instance": {
            "type": "string",
            "format": "uri-reference"
          },
          "code": {
            "type": "string"
          },
          "request_id": {
            "$ref": "#/components/schemas/Id"
          },
          "retryable": {
            "type": "boolean"
          }
        },
        "description": "RFC9457-compatible transport failure; fixed safe details, no values or internals. Does not establish transaction outcome."
      }
    },
    "headers": {
      "XRequestId": {
        "description": "Effective response correlation ID; equals body request_id.",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/Id"
        }
      },
      "CacheControl": {
        "description": "Prevents storage of financial or error responses.",
        "required": true,
        "schema": {
          "const": "no-store"
        }
      },
      "XContentTypeOptions": {
        "description": "Prevents content-type sniffing.",
        "required": true,
        "schema": {
          "const": "nosniff"
        }
      },
      "RetryAfter": {
        "description": "Optional scheduling advice only. The Provider accepts delta-seconds or an IMF-fixdate and treats the value as the earliest instant it may retry the same transaction ID. It never establishes or rejects money, never becomes part of an observation identity, and is never logged. A value beyond the Provider's operational hold horizon holds the operation for operator review rather than being silently shortened; an unusable value is ignored and the Provider's own bounded backoff applies.",
        "required": false,
        "schema": {
          "type": "string",
          "maxLength": 64
        }
      }
    }
  }
}
