{
  "openapi": "3.1.0",
  "info": {
    "title": "Games Studio API",
    "version": "1.2.0",
    "description": "API servidor a servidor en ARS y español. Sólo fichas virtuales. Bolsa total por cliente y recargas idempotentes de jugadores, cuando se asigna una bolsa. Los jugadores comparten saldo dentro de walletScope; diferentes grupos mantienen saldos separados."
  },
  "servers": [
    {
      "url": "https://gamestudio.pro",
      "description": "Dominio HTTPS asignado para Games Studio API."
    }
  ],
  "security": [
    {
      "ClientKey": []
    }
  ],
  "paths": {
    "/v1/games": {
      "get": {
        "operationId": "listGames",
        "summary": "Catálogo habilitado para el cliente",
        "responses": {
          "200": {
            "description": "Respuesta correcta",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Catalog"
                }
              }
            }
          },
          "400": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/launch": {
      "post": {
        "operationId": "launchGame",
        "summary": "Abrir partida virtual",
        "responses": {
          "200": {
            "description": "Sesión guardada; replayed=true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Launch"
                }
              }
            }
          },
          "201": {
            "description": "Nueva sesión",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Launch"
                }
              }
            }
          },
          "400": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Repetir misma clave y cuerpo tras timeout. No recarga saldo. Un fallo interno ambiguo puede generar otro token para la misma cuenta sin saldo adicional.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{16,100}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LaunchInput"
              },
              "example": {
                "gameId": "cheetah-wild",
                "playerId": "jugador-123",
                "currency": "ARS",
                "language": "es",
                "mode": "sandbox"
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{sessionId}": {
      "get": {
        "operationId": "getSession",
        "summary": "Consultar estado de una sesión propia",
        "responses": {
          "200": {
            "description": "Respuesta correcta",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/v1/sessions/{sessionId}/history": {
      "get": {
        "operationId": "getHistory",
        "summary": "Historial del jugador y juego, incluyendo aperturas anteriores",
        "responses": {
          "200": {
            "description": "Respuesta correcta",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/History"
                }
              }
            }
          },
          "400": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ]
      }
    },
    "/v1/games/{gameId}/rtp": {
      "get": {
        "operationId": "getGameRtp",
        "summary": "Consultar RTP y equivalencias disponibles para este cliente",
        "parameters": [
          {
            "name": "gameId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Configuración por cliente. Se aplica a rondas nuevas; las funciones activas conservan su perfil.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RtpConfiguration"
                }
              }
            }
          },
          "400": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setGameRtp",
        "summary": "Configurar RTP por cliente y juego",
        "parameters": [
          {
            "name": "gameId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{16,100}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Configuración por cliente. Se aplica a rondas nuevas; las funciones activas conservan su perfil.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RtpApplied"
                }
              }
            }
          },
          "400": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Consultar error.code y error.requestId. Para 429/503 respetar Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RtpInput"
              }
            }
          }
        },
        "description": "Consultar primero GET para obtener version. Usar expectedVersion y una clave nueva por cambio; para reintentar conservar ambos y el mismo cuerpo. Si falta el RTP exacto, se aplica el disponible más cercano hasta 96%; en empate, el mayor. 409 selection_conflict: volver a consultar y decidir el cambio. No configura el RTP por jugador ni por tirada."
      }
    },
    "/v1/wallet": {
      "get": {
        "operationId": "getClientWallet",
        "summary": "Saldo disponible de la bolsa del cliente",
        "responses": {
          "200": {
            "description": "Operación confirmada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "initialBalanceMinor",
                    "balanceMinor",
                    "allocatedMinor",
                    "pendingMinor",
                    "currency",
                    "realMoneyEnabled"
                  ],
                  "properties": {
                    "initialBalanceMinor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "balanceMinor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "allocatedMinor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "pendingMinor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "currency": {
                      "const": "ARS"
                    },
                    "unit": {
                      "const": "cent"
                    },
                    "realMoneyEnabled": {
                      "const": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/wallet/credits": {
      "post": {
        "operationId": "creditPlayer",
        "summary": "Repartir fichas del cliente al jugador",
        "description": "Descuenta una única vez de la bolsa y acredita una única vez en el walletScope del juego. No acreditar por cada juego si comparten walletScope. Los premios permanecen en el saldo del jugador. No hay retiro o transferencia entre grupos.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{16,100}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "gameId",
                  "playerId",
                  "amountMinor"
                ],
                "properties": {
                  "gameId": {
                    "type": "string"
                  },
                  "playerId": {
                    "type": "string"
                  },
                  "amountMinor": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000000000000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Operación confirmada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "transferId",
                    "playerId",
                    "gameId",
                    "walletScope",
                    "amountMinor",
                    "playerBalanceMinor",
                    "status",
                    "realMoneyEnabled"
                  ],
                  "properties": {
                    "transferId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "playerId": {
                      "type": "string"
                    },
                    "gameId": {
                      "type": "string"
                    },
                    "walletScope": {
                      "type": "string"
                    },
                    "amountMinor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "playerBalanceMinor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "status": {
                      "const": "completed"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "creditedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "realMoneyEnabled": {
                      "const": false
                    }
                  }
                }
              }
            }
          },
          "200": {
            "description": "Operación confirmada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "transferId",
                    "playerId",
                    "gameId",
                    "walletScope",
                    "amountMinor",
                    "playerBalanceMinor",
                    "status",
                    "realMoneyEnabled"
                  ],
                  "properties": {
                    "transferId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "playerId": {
                      "type": "string"
                    },
                    "gameId": {
                      "type": "string"
                    },
                    "walletScope": {
                      "type": "string"
                    },
                    "amountMinor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "playerBalanceMinor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "status": {
                      "const": "completed"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "creditedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "realMoneyEnabled": {
                      "const": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/wallet/transfers/{transferId}": {
      "get": {
        "operationId": "getWalletTransfer",
        "summary": "Consultar o recuperar la recarga del cliente",
        "parameters": [
          {
            "name": "transferId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operación confirmada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "transferId",
                    "playerId",
                    "gameId",
                    "walletScope",
                    "amountMinor",
                    "playerBalanceMinor",
                    "status",
                    "realMoneyEnabled"
                  ],
                  "properties": {
                    "transferId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "playerId": {
                      "type": "string"
                    },
                    "gameId": {
                      "type": "string"
                    },
                    "walletScope": {
                      "type": "string"
                    },
                    "amountMinor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "playerBalanceMinor": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "status": {
                      "const": "completed"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "creditedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "realMoneyEnabled": {
                      "const": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Consultar error.code. En wallet_transfer_pending (503), conservar y reintentar la misma clave/cuerpo; el importe permanece reservado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ClientKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "cg_sbx_<key-id>_<secret>",
        "description": "Clave privada, sólo servidor. Sin CORS."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "requestId"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "requestId": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        }
      },
      "Game": {
        "type": "object",
        "required": [
          "id",
          "title",
          "version",
          "currency",
          "language",
          "defaultRtpBasisPoints",
          "rtpBasisPoints",
          "betOptionsMinor",
          "betRangeArs10to600",
          "viewStatus",
          "walletScope",
          "selectableRtp",
          "rtpChoices"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "currency": {
            "const": "ARS"
          },
          "language": {
            "const": "es"
          },
          "defaultRtpBasisPoints": {
            "const": 9600
          },
          "rtpBasisPoints": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9600
            }
          },
          "betOptionsMinor": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "description": "Centavos de ARS: 1000 = 10 ARS."
            }
          },
          "betRangeArs10to600": {
            "type": "boolean"
          },
          "viewStatus": {
            "enum": [
              "published-legacy",
              "published-approved"
            ]
          },
          "walletScope": {
            "type": "string"
          },
          "selectableRtp": {
            "type": "array",
            "items": {
              "enum": [
                80,
                85,
                90,
                93,
                96
              ]
            }
          },
          "rtpChoices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RtpChoice"
            }
          }
        }
      },
      "LaunchInput": {
        "type": "object",
        "required": [
          "gameId",
          "playerId",
          "currency",
          "language",
          "mode"
        ],
        "properties": {
          "gameId": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,79}$"
          },
          "playerId": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,79}$"
          },
          "currency": {
            "const": "ARS"
          },
          "language": {
            "const": "es"
          },
          "mode": {
            "const": "sandbox"
          }
        },
        "additionalProperties": false
      },
      "Launch": {
        "type": "object",
        "required": [
          "sessionId",
          "gameId",
          "playerId",
          "mode",
          "currency",
          "language",
          "realMoneyEnabled",
          "walletScope",
          "expiresAt",
          "requestId",
          "launchUrl",
          "replayed"
        ],
        "properties": {
          "sessionId": {
            "type": "string",
            "format": "uuid"
          },
          "gameId": {
            "type": "string"
          },
          "playerId": {
            "type": "string"
          },
          "mode": {
            "const": "sandbox"
          },
          "currency": {
            "const": "ARS"
          },
          "language": {
            "const": "es"
          },
          "realMoneyEnabled": {
            "const": false
          },
          "walletScope": {
            "enum": [
              "engine",
              "approved-three",
              "helios"
            ]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "launchUrl": {
            "type": "string",
            "format": "uri",
            "description": "Enlace privado temporal; no registrar en logs."
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "Session": {
        "type": "object",
        "required": [
          "sessionId",
          "gameId",
          "playerId",
          "mode",
          "currency",
          "language",
          "realMoneyEnabled",
          "walletScope",
          "expiresAt",
          "requestId",
          "balanceMinor",
          "betOptionsMinor",
          "rtpBasisPoints",
          "featureActive"
        ],
        "properties": {
          "sessionId": {
            "type": "string",
            "format": "uuid"
          },
          "gameId": {
            "type": "string"
          },
          "playerId": {
            "type": "string"
          },
          "mode": {
            "const": "sandbox"
          },
          "currency": {
            "const": "ARS"
          },
          "language": {
            "const": "es"
          },
          "realMoneyEnabled": {
            "const": false
          },
          "walletScope": {
            "enum": [
              "engine",
              "approved-three",
              "helios"
            ]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "balanceMinor": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Centavos de ARS: 1000 = 10 ARS."
          },
          "betOptionsMinor": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991,
              "description": "Centavos de ARS: 1000 = 10 ARS."
            }
          },
          "rtpBasisPoints": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9600
          },
          "featureActive": {
            "type": "boolean"
          }
        }
      },
      "Round": {
        "type": "object",
        "required": [
          "cursor",
          "roundId",
          "gameId",
          "betMinor",
          "winMinor",
          "balanceMinor",
          "settledAt",
          "featureActive"
        ],
        "properties": {
          "cursor": {
            "type": "integer",
            "minimum": 1
          },
          "roundId": {
            "type": "string",
            "format": "uuid"
          },
          "gameId": {
            "type": "string"
          },
          "betMinor": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Centavos de ARS: 1000 = 10 ARS."
          },
          "winMinor": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Centavos de ARS: 1000 = 10 ARS."
          },
          "balanceMinor": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Centavos de ARS: 1000 = 10 ARS."
          },
          "settledAt": {
            "type": "string",
            "format": "date-time"
          },
          "featureActive": {
            "type": "boolean"
          }
        }
      },
      "Catalog": {
        "type": "object",
        "required": [
          "mode",
          "currency",
          "language",
          "realMoneyEnabled",
          "requestId",
          "games"
        ],
        "properties": {
          "mode": {
            "const": "sandbox"
          },
          "currency": {
            "const": "ARS"
          },
          "language": {
            "const": "es"
          },
          "realMoneyEnabled": {
            "const": false
          },
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "games": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Game"
            }
          }
        }
      },
      "History": {
        "type": "object",
        "required": [
          "mode",
          "currency",
          "language",
          "realMoneyEnabled",
          "sessionId",
          "gameId",
          "playerId",
          "walletScope",
          "requestId",
          "nextCursor",
          "rounds"
        ],
        "properties": {
          "mode": {
            "const": "sandbox"
          },
          "currency": {
            "const": "ARS"
          },
          "language": {
            "const": "es"
          },
          "realMoneyEnabled": {
            "const": false
          },
          "sessionId": {
            "type": "string",
            "format": "uuid"
          },
          "gameId": {
            "type": "string"
          },
          "playerId": {
            "type": "string"
          },
          "walletScope": {
            "type": "string"
          },
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "nextCursor": {
            "type": "integer",
            "minimum": 0
          },
          "rounds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Round"
            }
          }
        }
      },
      "RtpChoice": {
        "type": "object",
        "required": [
          "requestedRtp",
          "appliedRtp",
          "exact"
        ],
        "properties": {
          "requestedRtp": {
            "enum": [
              80,
              85,
              90,
              93,
              96
            ]
          },
          "appliedRtp": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 96
          },
          "exact": {
            "type": "boolean"
          }
        }
      },
      "RtpInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "rtp",
          "expectedVersion"
        ],
        "properties": {
          "rtp": {
            "type": "integer",
            "enum": [
              80,
              85,
              90,
              93,
              96
            ]
          },
          "expectedVersion": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "RtpConfiguration": {
        "type": "object",
        "required": [
          "gameId",
          "currentRtp",
          "version",
          "defaultRtp",
          "selectableRtp",
          "choices",
          "appliesTo",
          "realMoneyEnabled"
        ],
        "properties": {
          "gameId": {
            "type": "string"
          },
          "currentRtp": {
            "type": "number",
            "maximum": 96
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "defaultRtp": {
            "const": 96
          },
          "selectableRtp": {
            "type": "array",
            "items": {
              "enum": [
                80,
                85,
                90,
                93,
                96
              ]
            }
          },
          "choices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RtpChoice"
            }
          },
          "appliesTo": {
            "const": "new-rounds"
          },
          "realMoneyEnabled": {
            "const": false
          }
        }
      },
      "RtpApplied": {
        "type": "object",
        "required": [
          "gameId",
          "requestedRtp",
          "appliedRtp",
          "exact",
          "version",
          "appliesTo",
          "realMoneyEnabled"
        ],
        "properties": {
          "requestedRtp": {
            "enum": [
              80,
              85,
              90,
              93,
              96
            ]
          },
          "appliedRtp": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 96
          },
          "exact": {
            "type": "boolean"
          },
          "gameId": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "defaultRtp": {
            "const": 96
          },
          "appliesTo": {
            "const": "new-rounds"
          },
          "realMoneyEnabled": {
            "const": false
          }
        }
      }
    }
  }
}
