{
  "openapi": "3.1.0",
  "info": {
    "title": "i-gaming Portal — API pública",
    "version": "1.1.0",
    "description": "Especificação completa dos endpoints do portal i-gaming.\n\n**Proteções:**\n- `bearerAuth` — token de operador ou super_admin (`Authorization: Bearer <token>`)\n- `operatorTokenHeader` — mesmo token via `X-Operator-Token`\n- `portalHmac` — assinatura HMAC portal↔jogo (`x-dl-portal-sig`, segredo `PORTAL_HMAC_SECRET`)\n- `hookSecret` — token de hook/cron (`Authorization: Bearer <ADMIN_API_TOKEN|CRON_SECRET>`)\n- `hasRoleAdmin` / `hasRoleManager` — gate por role via `public.has_role(auth.uid(), 'admin'|'manager')`\n- `webhookSignature` — HMAC específico por provedor (Evolution, Telegram, Cloudflare)\n\nRotas sob `/api/public/*` ignoram autenticação de site publicado; cada handler faz sua própria verificação.",
    "contact": {
      "name": "i-gaming",
      "url": "https://www.i-gaming.co"
    }
  },
  "servers": [
    {
      "url": "https://www.i-gaming.co",
      "description": "Produção"
    }
  ],
  "tags": [
    {
      "name": "auth",
      "description": "Introspecção e verificação de tokens de operador"
    },
    {
      "name": "launch",
      "description": "Emissão/consumo de launch tokens para iframe"
    },
    {
      "name": "wallet",
      "description": "Seamless wallet: bet/win/rollback/saldo"
    },
    {
      "name": "rounds",
      "description": "Ciclo de vida de rodadas (open/settle/void/export)"
    },
    {
      "name": "operator",
      "description": "Configurações e catálogo do operador"
    },
    {
      "name": "admin",
      "description": "Endpoints administrativos (super_admin/admin)"
    },
    {
      "name": "manager",
      "description": "Endpoints para gerentes / hierarquia de comissão"
    },
    {
      "name": "health",
      "description": "Health checks e status"
    },
    {
      "name": "hooks",
      "description": "Cron jobs e hooks internos (autenticados por ADMIN_API_TOKEN)"
    },
    {
      "name": "webhooks",
      "description": "Webhooks de terceiros (Evolution / Telegram / Cloudflare)"
    },
    {
      "name": "dl-casino",
      "description": "Wallet demo do /dl-casino (game-proxy, seamless demo)"
    },
    {
      "name": "public",
      "description": "Endpoints públicos (demo request, status, health)"
    },
    {
      "name": "payments",
      "description": "Bridge de pagamentos (depósito, saque, callback, contestação, catálogo de PSPs). Autenticação HMAC por operador."
    },
    {
      "name": "sms",
      "description": "OTP por SMS e cadastro de jogador (Twilio da plataforma ou GatewayAPI, por operador)"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Token de operador/super_admin emitido em Configurações → Tokens."
      },
      "operatorTokenHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Operator-Token"
      },
      "payHmac": {
        "type": "apiKey",
        "in": "header",
        "name": "x-pay-sig",
        "description": "HMAC SHA-256 hex de \"<x-pay-ts>.<corpo cru>\" usando o hmac_secret do gateway do operador. Enviar sempre junto: x-pay-operator (UUID do operador) e x-pay-ts (epoch em segundos, janela de 300s). Corpo assinado deve ser byte-a-byte o mesmo enviado."
      },
      "portalHmac": {
        "type": "apiKey",
        "in": "header",
        "name": "x-dl-portal-sig",
        "description": "HMAC SHA-256 de `portal-play-pro.<slug>.<ts>` com `PORTAL_HMAC_SECRET`."
      },
      "hookSecret": {
        "type": "http",
        "scheme": "bearer",
        "description": "ADMIN_API_TOKEN ou CRON_SECRET (aceita também `x-admin-token`, `x-cron-secret`, `apikey`, `?token=`)."
      },
      "hasRoleAdmin": {
        "type": "http",
        "scheme": "bearer",
        "description": "Sessão Supabase — endpoint checa `has_role(auth.uid(), 'admin')`."
      },
      "hasRoleManager": {
        "type": "http",
        "scheme": "bearer",
        "description": "Sessão Supabase — endpoint checa `has_role(auth.uid(), 'manager')` (admin herda)."
      },
      "webhookSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "x-signature",
        "description": "Assinatura HMAC do provedor (Evolution/Telegram/Cloudflare). Verificação timing-safe no handler."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "ok"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string"
          }
        }
      },
      "OK": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "example": true
          }
        }
      },
      "Money": {
        "type": "integer",
        "description": "Valor em centavos.",
        "example": 1000
      },
      "Currency": {
        "type": "string",
        "pattern": "^[A-Z]{3}$",
        "example": "BRL"
      },
      "Slug": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$",
        "example": "gold-tiger-slot"
      },
      "BetRequest": {
        "type": "object",
        "required": [
          "amount"
        ],
        "properties": {
          "amount": {
            "type": "number",
            "example": 1
          },
          "round_id": {
            "type": "string",
            "nullable": true
          },
          "auto_cashout": {
            "type": "number",
            "minimum": 1.01,
            "nullable": true
          },
          "operator_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "user_id": {
            "type": "string",
            "nullable": true
          },
          "is_demo": {
            "type": "boolean"
          },
          "game_slug": {
            "$ref": "#/components/schemas/Slug"
          },
          "nonce": {
            "type": "string"
          },
          "ts": {
            "type": "integer"
          }
        }
      },
      "CashoutRequest": {
        "type": "object",
        "required": [
          "bet_id",
          "multiplier"
        ],
        "properties": {
          "bet_id": {
            "type": "string",
            "format": "uuid"
          },
          "multiplier": {
            "type": "number",
            "example": 2.35
          },
          "nonce": {
            "type": "string"
          },
          "ts": {
            "type": "integer"
          }
        }
      },
      "LaunchMintRequest": {
        "type": "object",
        "required": [
          "game_slug"
        ],
        "properties": {
          "game_slug": {
            "$ref": "#/components/schemas/Slug"
          },
          "user_ref": {
            "type": "string",
            "example": "player_123"
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "language": {
            "type": "string",
            "example": "pt-BR"
          },
          "ttl_seconds": {
            "type": "integer",
            "minimum": 10,
            "maximum": 300
          },
          "operator_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        }
      },
      "LaunchMintResponse": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "example": "lt_9f8e7d6c5b4a3210"
          },
          "iframe_url": {
            "type": "string",
            "format": "uri",
            "example": "https://gold-tiger-slot.i-gaming.co/?token=lt_...&currency=BRL&lang=pt&mode=real"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SeamlessBet": {
        "type": "object",
        "required": [
          "launch_token",
          "game_slug",
          "round_id",
          "amount_cents",
          "idempotency_key"
        ],
        "properties": {
          "launch_token": {
            "type": "string",
            "example": "lt_9f8e7d6c5b4a3210"
          },
          "game_slug": {
            "$ref": "#/components/schemas/Slug"
          },
          "round_id": {
            "type": "string",
            "example": "rnd_01H..."
          },
          "amount_cents": {
            "$ref": "#/components/schemas/Money"
          },
          "idempotency_key": {
            "type": "string"
          }
        }
      },
      "SeamlessWin": {
        "type": "object",
        "required": [
          "launch_token",
          "game_slug",
          "round_id",
          "amount_cents",
          "idempotency_key"
        ],
        "properties": {
          "launch_token": {
            "type": "string"
          },
          "game_slug": {
            "$ref": "#/components/schemas/Slug"
          },
          "round_id": {
            "type": "string"
          },
          "amount_cents": {
            "$ref": "#/components/schemas/Money"
          },
          "idempotency_key": {
            "type": "string"
          },
          "multiplier": {
            "type": "number",
            "example": 2.5
          }
        }
      },
      "SeamlessResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "balance_cents": {
            "$ref": "#/components/schemas/Money"
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "tx_id": {
            "type": "string"
          },
          "idempotent": {
            "type": "boolean"
          }
        }
      },
      "OperatorSettingsPatch": {
        "type": "object",
        "properties": {
          "operator_id": {
            "type": "string",
            "format": "uuid"
          },
          "rtp": {
            "type": "number",
            "minimum": 0.5,
            "maximum": 0.99,
            "example": 0.95
          },
          "min_bet": {
            "type": "number",
            "example": 1
          },
          "max_bet": {
            "type": "number",
            "example": 500
          },
          "max_payout": {
            "type": "number"
          },
          "cashback_enabled": {
            "type": "boolean"
          },
          "cashback_percent": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "auto_cashout_enabled": {
            "type": "boolean"
          },
          "volatility": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ]
          },
          "deposit_min": {
            "type": "number",
            "nullable": true
          },
          "deposit_max": {
            "type": "number",
            "nullable": true
          }
        }
      },
      "DemoRequest": {
        "type": "object",
        "required": [
          "name",
          "company",
          "email"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "company": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phone": {
            "type": "string"
          },
          "website": {
            "type": "string"
          },
          "estimated_volume": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "HealthReport": {
        "type": "object",
        "properties": {
          "summary": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "healthy": {
                "type": "integer"
              },
              "failing": {
                "type": "integer"
              }
            }
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "slug": {
                  "$ref": "#/components/schemas/Slug"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "ok",
                    "failing"
                  ]
                },
                "bridge_version": {
                  "type": "string",
                  "example": "2"
                },
                "formatCurrency": {
                  "type": "boolean"
                },
                "latency_ms": {
                  "type": "integer"
                },
                "notes": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "paths": {
    "/api/public/v1/payment-gateways": {
      "get": {
        "tags": ["payments"],
        "summary": "Catálogo público de PSPs compatíveis",
        "description": "Sem autenticação e sem PII. Use para montar a tela de conexão: fields_json indica os campos exigidos por PSP e aceita duas formas — array [{key,label,required,secret}] ou objeto {required:[],optional:[]}.",
        "parameters": [
          { "name": "currency", "in": "query", "schema": { "type": "string", "example": "BRL" }, "description": "ISO-4217. Filtra PSPs que suportam a moeda (ou curinga *)." },
          { "name": "country", "in": "query", "schema": { "type": "string", "example": "BR" }, "description": "ISO-3166 alpha-2. Filtra PSPs habilitados no país (ou curinga *)." }
        ],
        "responses": {
          "200": {
            "description": "Lista ordenada por sort_order. Cache-Control: public, max-age=300",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "gateways": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": { "type": "string", "example": "pix_generic" },
                          "name": { "type": "string" },
                          "type": { "type": "string", "example": "pix" },
                          "currencies": { "type": "array", "items": { "type": "string" } },
                          "countries": { "type": "array", "items": { "type": "string" } },
                          "docs_url": { "type": "string", "nullable": true },
                          "fields_json": { "description": "Array de campos ou objeto {required,optional}" },
                          "sort_order": { "type": "integer" }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "500": { "description": "Erro de banco" }
        }
      }
    },
    "/api/public/v1/payments/health": {
      "get": {
        "tags": ["payments"],
        "summary": "Saúde do payment-bridge",
        "description": "Sem autenticação. Retorna contadores agregados e o contrato HMAC em uso — útil para validar integração antes de assinar requisições.",
        "responses": {
          "200": {
            "description": "Status do serviço",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": { "type": "boolean" },
                    "service": { "type": "string", "example": "payment-bridge" },
                    "version": { "type": "string" },
                    "active_gateways": { "type": "integer" },
                    "catalog_size": { "type": "integer" },
                    "pending_deposits": { "type": "integer" },
                    "hmac": {
                      "type": "object",
                      "properties": {
                        "algo": { "type": "string", "example": "HS256" },
                        "headers": { "type": "array", "items": { "type": "string" } },
                        "max_skew_seconds": { "type": "integer", "example": 300 }
                      }
                    },
                    "endpoints": { "type": "array", "items": { "type": "string" } },
                    "ts": { "type": "string", "format": "date-time" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/payments/deposit": {
      "post": {
        "tags": ["payments"],
        "summary": "Cria um depósito e a cobrança no PSP",
        "description": "Assinado com HMAC (x-pay-operator / x-pay-ts / x-pay-sig). Idempotente por (operator_id, external_tx_id); sem external_tx_id a chave é derivada da própria assinatura, então um replay do mesmo corpo+ts devolve o mesmo depósito com idempotent:true (incluindo o QR já gerado). A moeda deve ser igual à do operador. O status NÃO passa a confirmed aqui — quem confirma é /payments/callback.",
        "security": [{ "payHmac": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["player_ref", "amount_cents", "currency"],
                "properties": {
                  "player_ref": { "type": "string", "maxLength": 128, "description": "Identificador do jogador no operador" },
                  "amount_cents": { "type": "integer", "minimum": 1, "maximum": 100000000, "description": "Valor em centavos" },
                  "currency": { "type": "string", "minLength": 3, "maxLength": 3, "example": "BRL" },
                  "external_tx_id": { "type": "string", "maxLength": 128, "description": "Chave de idempotência do PSP (recomendado)" },
                  "metadata": { "type": "object", "additionalProperties": true }
                }
              },
              "example": { "player_ref": "player-123", "amount_cents": 5000, "currency": "BRL", "external_tx_id": "psp-dep-0001" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Depósito criado (ou reentrega idempotente)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": { "type": "boolean" },
                    "idempotent": { "type": "boolean" },
                    "deposit_id": { "type": "string", "format": "uuid" },
                    "status": { "type": "string", "example": "pending" },
                    "external_tx_id": { "type": "string" },
                    "checkout_url": { "type": "string", "nullable": true },
                    "qr_code": { "type": "string", "nullable": true },
                    "copy_paste": { "type": "string", "nullable": true },
                    "provider_tx_id": { "type": "string", "nullable": true },
                    "charge": {
                      "type": "object",
                      "properties": {
                        "ok": { "type": "boolean" },
                        "mode": { "type": "string", "description": "byo quando o PSP não tem adaptador mapeado" },
                        "code": { "type": "string", "nullable": true },
                        "detail": { "type": "string", "nullable": true }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": { "description": "operator_required" },
          "401": { "description": "bad_signature — HMAC inválido ou ts fora da janela de 300s" },
          "404": { "description": "gateway_not_configured — operador sem gateway ativo" },
          "422": { "description": "invalid_body | invalid_currency | currency_mismatch | below_min | above_max" },
          "500": { "description": "db_error" }
        }
      }
    },
    "/api/public/v1/payments/withdraw": {
      "post": {
        "tags": ["payments"],
        "summary": "Solicita um saque",
        "description": "Servidor-para-servidor (sem CORS). Mesmo HMAC do depósito e mesma idempotência por (operator_id, external_tx_id) com índice único parcial. Aplica, nesta ordem: limites do gateway, limites diário/semanal (RPC atômica com advisory lock por operador+jogador), limites por nível VIP e rollover. Nasce pending, ou paid quando operator_settings.auto_approve_withdrawals está ligado.",
        "security": [{ "payHmac": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["player_ref", "amount_cents", "currency"],
                "properties": {
                  "player_ref": { "type": "string", "maxLength": 128 },
                  "amount_cents": { "type": "integer", "minimum": 1, "maximum": 100000000 },
                  "currency": { "type": "string", "minLength": 3, "maxLength": 3, "example": "BRL" },
                  "external_tx_id": { "type": "string", "maxLength": 128 },
                  "destination": { "type": "object", "additionalProperties": true, "description": "Dados de destino (ex.: { pix_key })" }
                }
              },
              "example": { "player_ref": "player-123", "amount_cents": 3000, "currency": "BRL", "external_tx_id": "psp-wd-0001", "destination": { "pix_key": "cliente@email.com" } }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saque registrado (ou reentrega idempotente)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": { "type": "boolean" },
                    "idempotent": { "type": "boolean" },
                    "withdrawal_id": { "type": "string", "format": "uuid" },
                    "status": { "type": "string", "example": "pending" }
                  }
                }
              }
            }
          },
          "400": { "description": "operator_required" },
          "401": { "description": "bad_signature" },
          "404": { "description": "gateway_not_configured" },
          "422": { "description": "invalid_body | invalid_currency | currency_mismatch | below_min | above_max | limit_exceeded (com daily_limit_cents/weekly_limit_cents/used_cents) | vip_* | rollover pendente" },
          "500": { "description": "db_error | limit_check_failed" }
        }
      }
    },
    "/api/public/v1/payments/callback": {
      "post": {
        "tags": ["payments"],
        "summary": "Webhook de liquidação (PSP → portal)",
        "description": "Servidor-para-servidor (sem CORS). Assinado com o mesmo HMAC. Anti-replay por UNIQUE(operator_id, sha256(ts.body)): a reentrega do mesmo corpo assinado devolve 200 com replay:true e não escreve. Estados terminais não voltam atrás — de depósito confirmed só se aceita refunded; de saque paid só refunded. Todo callback recebido é gravado em payment_webhook_events, inclusive bad_signature e not_found.",
        "security": [{ "payHmac": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["kind", "id", "status"],
                "properties": {
                  "kind": { "type": "string", "enum": ["deposit", "withdraw"] },
                  "id": { "type": "string", "format": "uuid", "description": "deposit_id ou withdrawal_id devolvido na criação" },
                  "status": { "type": "string", "enum": ["confirmed", "failed", "cancelled", "paid", "rejected", "refunded"] },
                  "external_tx_id": { "type": "string", "maxLength": 128 },
                  "reason": { "type": "string", "maxLength": 500, "description": "Motivo detalhado em falha/recusa" }
                }
              },
              "example": { "kind": "deposit", "id": "3f7b...", "status": "confirmed", "external_tx_id": "psp-dep-0001" }
            }
          }
        },
        "responses": {
          "200": { "description": "Processado, idempotente ou replay (replay:true)" },
          "202": { "description": "Aceito" },
          "400": { "description": "operator_required" },
          "401": { "description": "bad_signature" },
          "404": { "description": "gateway_not_configured | not_found" },
          "409": { "description": "terminal_state — transição recusada a partir de estado liquidado" },
          "422": { "description": "invalid_body" },
          "500": { "description": "db_error | credit_failed" }
        }
      }
    },
    "/api/public/v1/payments/dispute-webhook": {
      "post": {
        "tags": ["payments"],
        "summary": "Webhook de contestação (Pix MED, chargeback e equivalentes)",
        "description": "Servidor-para-servidor (sem CORS). Mesmo HMAC das rotas de pagamento. Idempotente por UNIQUE(operator_id, scheme, external_case_id) — reentrega devolve idempotent:true sem escrever.",
        "security": [{ "payHmac": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["scheme", "external_case_id", "status"],
                "properties": {
                  "scheme": {
                    "type": "string",
                    "enum": ["pix_med", "card_chargeback", "spei_devolucion", "upi_chargeback", "sepa_recall", "ach_dispute", "fednow_return", "zelle_claim", "fps_indemnity", "paynow_recall", "promptpay_return", "duitnow_recall"]
                  },
                  "external_case_id": { "type": "string", "description": "Identificador do caso no PSP/arranjo" },
                  "status": { "type": "string", "description": "Estado do caso no PSP (aberto, contestado, resolvido...)" },
                  "deposit_id": { "type": "string", "format": "uuid", "description": "Depósito relacionado, quando conhecido" },
                  "amount_cents": { "type": "integer" },
                  "currency": { "type": "string", "minLength": 3, "maxLength": 3 },
                  "reason": { "type": "string", "maxLength": 500 }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Caso registrado ou atualizado (idempotent:true em reentrega)" },
          "400": { "description": "operator_required" },
          "401": { "description": "bad_signature" },
          "404": { "description": "gateway_not_configured" },
          "422": { "description": "invalid_body" },
          "500": { "description": "db_error" }
        }
      }
    },
    "/api/public/player/otp-request": {
      "post": {
        "tags": ["sms"],
        "summary": "Envia código OTP por SMS",
        "description": "Público, chamado do domínio do operador (CORS restrito às origens do tenant). Provedor por operador em operator_sms_config: twilio_default (Twilio da plataforma), gatewayapi ou disabled. Código de 6 dígitos, validade de 5 minutos, máximo 5 tentativas; gerar um novo consome os anteriores em aberto. Respostas são genéricas de propósito: operador inexistente responde igual a rate limit, para não permitir enumerar slugs, e falha do provedor não vaza detalhe.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["operator_slug", "phone"],
                "properties": {
                  "operator_slug": { "type": "string", "maxLength": 64, "example": "zell-cassino" },
                  "phone": { "type": "string", "minLength": 6, "maxLength": 20, "description": "Local ou E.164; normalizado pelo país" },
                  "country": { "type": "string", "minLength": 2, "maxLength": 2, "default": "BR" },
                  "purpose": { "type": "string", "enum": ["signup", "password_reset", "2fa"], "default": "signup" },
                  "lang": { "type": "string", "default": "pt", "description": "Idioma do texto do SMS" }
                }
              },
              "example": { "operator_slug": "zell-cassino", "phone": "11999998888", "country": "BR", "purpose": "signup", "lang": "pt" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SMS enviado",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": { "type": "boolean" },
                    "expires_at": { "type": "string", "format": "date-time" }
                  }
                }
              }
            }
          },
          "400": { "description": "invalid_phone | sms_disabled | bad_request" },
          "403": { "description": "country_not_allowed" },
          "429": { "description": "rate_limited (também devolvido para operador inexistente) ou teto diário do operador" },
          "502": { "description": "sms_send_failed — falha no provedor (detalhe fica em sms_send_log)" }
        }
      }
    },
    "/api/public/player/otp-verify": {
      "post": {
        "tags": ["sms"],
        "summary": "Valida o código OTP",
        "description": "Consome o desafio em sms_otp_challenges (comparação por hash com salt). Quando há cookie de afiliado dl_aff, a atribuição usa o affiliate_id gravado em affiliate_clicks — nunca o valor do cookie.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["operator_slug", "phone", "code"],
                "properties": {
                  "operator_slug": { "type": "string", "maxLength": 64 },
                  "phone": { "type": "string", "minLength": 6, "maxLength": 20 },
                  "country": { "type": "string", "minLength": 2, "maxLength": 2, "default": "BR" },
                  "code": { "type": "string", "pattern": "^[0-9]{6}$" },
                  "purpose": { "type": "string", "enum": ["signup", "password_reset", "2fa"], "default": "signup" }
                }
              },
              "example": { "operator_slug": "zell-cassino", "phone": "11999998888", "code": "123456", "purpose": "signup" }
            }
          }
        },
        "responses": {
          "200": { "description": "Código válido" },
          "400": { "description": "invalid_phone | invalid_code | bad_request" },
          "429": { "description": "rate_limited ou max_attempts excedido" }
        }
      }
    },
    "/api/public/player/signup": {
      "post": {
        "tags": ["sms"],
        "summary": "Cadastro de jogador no operador",
        "description": "Os campos exigidos vêm do preset de cadastro do país (operator_signup_presets): simple, br_full ou custom. País sem preset ativo é recusado com country_not_enabled. Quando o preset exige OTP, chame /player/otp-request e /player/otp-verify antes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["operator_slug", "country", "phone", "password", "password_confirm", "accept_tos"],
                "properties": {
                  "operator_slug": { "type": "string", "maxLength": 64 },
                  "country": { "type": "string", "minLength": 2, "maxLength": 2 },
                  "phone": { "type": "string", "minLength": 6, "maxLength": 20 },
                  "password": { "type": "string", "minLength": 8, "maxLength": 200 },
                  "password_confirm": { "type": "string", "minLength": 8, "maxLength": 200 },
                  "email": { "type": "string", "format": "email", "maxLength": 160 },
                  "cpf": { "type": "string", "minLength": 11, "maxLength": 14 },
                  "full_name": { "type": "string", "minLength": 2, "maxLength": 160 },
                  "dob": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" },
                  "address": {
                    "type": "object",
                    "properties": {
                      "cep": { "type": "string", "maxLength": 12 },
                      "street": { "type": "string", "maxLength": 160 },
                      "number": { "type": "string", "maxLength": 20 },
                      "city": { "type": "string", "maxLength": 80 },
                      "state": { "type": "string", "maxLength": 4 }
                    }
                  },
                  "accept_tos": { "type": "boolean" },
                  "responsible_gaming_optin": { "type": "boolean" }
                }
              },
              "example": { "operator_slug": "zell-cassino", "country": "BR", "phone": "11999998888", "password": "SenhaForte1", "password_confirm": "SenhaForte1", "accept_tos": true }
            }
          }
        },
        "responses": {
          "200": { "description": "Jogador criado" },
          "400": { "description": "password_mismatch | tos_required | invalid_phone | signup_unavailable | bad_request" },
          "403": { "description": "signup_unavailable | country_not_enabled" },
          "429": { "description": "rate_limited" }
        }
      }
    },
    "/api/public/v1/auth/check": {
      "post": {
        "tags": [
          "auth"
        ],
        "summary": "Diagnostica um token (whitelist/origin/referer)",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "operatorTokenHeader": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string"
                  },
                  "referer": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resultado de diagnóstico (sempre 200)"
          }
        }
      }
    },
    "/api/public/v1/auth/verify": {
      "get": {
        "tags": [
          "auth"
        ],
        "summary": "Verifica se o Bearer é válido para o Origin atual",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Token válido"
          },
          "401": {
            "description": "Token inválido/revogado"
          }
        }
      }
    },
    "/api/public/v1/auth/introspect": {
      "get": {
        "tags": [
          "auth"
        ],
        "summary": "Retorna metadados do token (scope, operator_id, domínios)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Metadados",
            "content": {
              "application/json": {
                "example": {
                  "ok": true,
                  "scope": "operator",
                  "operator_id": "uuid",
                  "allowed_domains": [
                    "parceiro.com"
                  ],
                  "expires_at": null
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/launch-token/mint": {
      "post": {
        "tags": [
          "launch"
        ],
        "summary": "Emite um launch token (URL do iframe)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LaunchMintRequest"
              },
              "example": {
                "game_slug": "gold-tiger-slot",
                "user_ref": "player_123",
                "currency": "BRL",
                "language": "pt-BR",
                "ttl_seconds": 120
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Token emitido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LaunchMintResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/launch-token/consume": {
      "post": {
        "tags": [
          "launch"
        ],
        "summary": "Consome/valida um launch token (uso interno do jogo)",
        "security": [
          {
            "portalHmac": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OK"
              },
              "example": {
                "token": "lt_9f8e7d6c5b4a3210"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Token válido — retorna claims da sessão"
          }
        }
      }
    },
    "/api/public/v1/demo-token": {
      "get": {
        "tags": [
          "launch"
        ],
        "summary": "Emite token demo temporário (sem autenticação)",
        "responses": {
          "200": {
            "description": "Token demo"
          }
        }
      }
    },
    "/api/public/v1/demo/launch": {
      "post": {
        "tags": [
          "launch"
        ],
        "summary": "Launch demo de um jogo específico",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "game_slug"
                ],
                "properties": {
                  "game_slug": {
                    "$ref": "#/components/schemas/Slug"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "iframe_url demo"
          }
        }
      }
    },
    "/api/public/v1/bets": {
      "post": {
        "tags": [
          "wallet"
        ],
        "summary": "Registra uma aposta (bet)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BetRequest"
              },
              "example": {
                "amount": 1,
                "game_slug": "gold-tiger-slot",
                "user_id": "player_123",
                "nonce": "abc12345",
                "ts": 1737548400
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "bet aceita",
            "content": {
              "application/json": {
                "example": {
                  "ok": true,
                  "bet_id": "uuid",
                  "balance": 99
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/bets/cashout": {
      "post": {
        "tags": [
          "wallet"
        ],
        "summary": "Realiza cashout (win) de uma aposta",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CashoutRequest"
              },
              "example": {
                "bet_id": "uuid",
                "multiplier": 2.35
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cashout ok",
            "content": {
              "application/json": {
                "example": {
                  "ok": true,
                  "payout": 2.35,
                  "balance": 101.35
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/sandbox/wallet/{path}": {
      "parameters": [
        {
          "name": "path",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Ação: bet|win|rollback|balance"
        }
      ],
      "post": {
        "tags": [
          "wallet"
        ],
        "summary": "Wallet mock de sandbox (sem debitar produção)",
        "responses": {
          "200": {
            "description": "Resposta mock"
          }
        }
      }
    },
    "/api/public/v1/rounds/open": {
      "post": {
        "tags": [
          "rounds"
        ],
        "summary": "Abre uma nova rodada (crash)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OK"
              },
              "example": {
                "operator_id": "uuid"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/rounds/settle": {
      "post": {
        "tags": [
          "rounds"
        ],
        "summary": "Liquida rodada com crash_point + server_seed",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OK"
              },
              "example": {
                "round_id": "uuid",
                "crash_point": 3.14,
                "server_seed": "..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/rounds/void": {
      "post": {
        "tags": [
          "rounds"
        ],
        "summary": "Cancela uma rodada",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OK"
              },
              "example": {
                "round_id": "uuid",
                "reason": "manual_void"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/rounds/current": {
      "get": {
        "tags": [
          "rounds"
        ],
        "summary": "Rodada crash em aberto (se houver)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/rounds/export": {
      "get": {
        "tags": [
          "rounds"
        ],
        "summary": "Exporta rodadas (CSV/JSON) por período",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/webhooks/reconcile": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "summary": "Webhook interno de reconciliação (HMAC portal)",
        "security": [
          {
            "portalHmac": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OK"
              },
              "example": {
                "event_id": "evt_1",
                "operator_id": "uuid",
                "round_id": "rnd_...",
                "total_bet": 10,
                "total_payout": 15.5,
                "settled_at": "2026-07-22T14:00:00Z"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reconciliação registrada"
          }
        }
      }
    },
    "/api/public/v1/operator": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Dados do operador autenticado",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/operator-settings": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Lê settings do operador",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "operator"
        ],
        "summary": "Atualiza settings do operador",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperatorSettingsPatch"
              },
              "example": {
                "rtp": 0.95,
                "min_bet": 1,
                "max_bet": 500,
                "deposit_min": 10,
                "deposit_max": 10000
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Atualizado"
          }
        }
      }
    },
    "/api/public/v1/global-settings": {
      "get": {
        "tags": [
          "admin"
        ],
        "summary": "Lê global settings",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "admin"
        ],
        "summary": "Atualiza global settings (super_admin)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rtp_min": {
                    "type": "number"
                  },
                  "rtp_max": {
                    "type": "number"
                  },
                  "max_bet": {
                    "type": "number"
                  },
                  "max_payout": {
                    "type": "number"
                  }
                }
              },
              "example": {
                "rtp_min": 85,
                "rtp_max": 98
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Atualizado"
          }
        }
      }
    },
    "/api/public/v1/games/list": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Lista jogos habilitados para o operador",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/game-config": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Config resolvida por jogo (moeda/limites/RTP)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/tokens": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Lista tokens do operador",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "operator"
        ],
        "summary": "Cria token (name, scope, allowed_domains)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OK"
              },
              "example": {
                "name": "Prod",
                "scope": "operator",
                "allowed_domains": [
                  "parceiro.com"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "operator"
        ],
        "summary": "Revoga token",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "reason",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revogado"
          }
        }
      }
    },
    "/api/public/v1/tokens/request": {
      "post": {
        "tags": [
          "operator"
        ],
        "summary": "Solicita emissão de token",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OK"
              },
              "example": {
                "name": "Prod Iframe",
                "scope": "operator",
                "ttl_seconds": null,
                "allowed_domains": [
                  "parceiro.com"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "operator"
        ],
        "summary": "Rotaciona token existente",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OK"
              },
              "example": {
                "id": "uuid",
                "ttl_seconds": null
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/players/{playerId}/rounds": {
      "parameters": [
        {
          "name": "playerId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Histórico de rodadas de um jogador",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/liquidity": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Saldo/liquidez agregada do operador",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/stats": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "KPIs (bet/win/net/GGR)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/config-status": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Status de configuração do operador (checklist)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/currencies": {
      "get": {
        "tags": [
          "public"
        ],
        "summary": "Lista canônica de moedas ISO 4217 suportadas",
        "description": "Fonte única de moedas aceitas pela plataforma (cadastro de operador, planos, HMAC wallet, torneios, baús, raspadinhas). Sem autenticação. Cacheado no edge por 60s (SWR 600s). Integradores devem consultar antes de enviar `currency` em qualquer request para evitar rejeição por `unsupported_currency`.",
        "responses": {
          "200": {
            "description": "Lista atualizada de moedas.",
            "headers": {
              "cache-control": {
                "schema": { "type": "string" },
                "description": "public, max-age=60, s-maxage=300, stale-while-revalidate=600"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["version", "updated_at", "count", "currencies"],
                  "properties": {
                    "version": { "type": "integer", "example": 1 },
                    "updated_at": { "type": "string", "format": "date-time" },
                    "count": { "type": "integer", "example": 76 },
                    "currencies": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$",
                        "description": "Código ISO 4217 em maiúsculas."
                      },
                      "example": ["BRL", "USD", "EUR", "GBP", "JPY", "INR", "MXN", "ARS"]
                    }
                  }
                },
                "examples": {
                  "resposta": {
                    "summary": "Resposta típica",
                    "value": {
                      "version": 1,
                      "updated_at": "2026-07-29T12:00:00.000Z",
                      "count": 76,
                      "currencies": ["BRL", "USD", "EUR", "GBP", "JPY", "INR", "MXN", "ARS", "CLP", "COP", "PEN", "UYU", "PYG", "BOB", "VES", "CAD", "AUD", "NZD", "CHF", "SEK", "NOK", "DKK", "PLN", "CZK", "HUF", "RON", "BGN", "TRY", "RUB", "UAH", "ILS", "AED", "SAR", "QAR", "KWD", "BHD", "OMR", "JOD", "EGP", "MAD", "TND", "ZAR", "NGN", "KES", "GHS", "TZS", "UGX", "XOF", "XAF", "CNY", "HKD", "TWD", "KRW", "SGD", "MYR", "THB", "IDR", "PHP", "VND", "BDT", "PKR", "LKR", "NPR", "KZT", "UZS", "AZN", "GEL", "AMD", "ISK", "MDL", "RSD", "MKD", "ALL", "BAM", "HRK"]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/preflight": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Preflight de integração (checks de whitelist/token)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/preflight/metrics": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Métricas preflight históricas",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/diagnose": {
      "get": {
        "tags": [
          "operator"
        ],
        "summary": "Diagnóstico completo do operador",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/build": {
      "get": {
        "tags": [
          "public"
        ],
        "summary": "Build/version info",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/audit/render-block": {
      "get": {
        "tags": [
          "admin"
        ],
        "summary": "Detecta bloqueios de render (embed)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/health/integration": {
      "get": {
        "tags": [
          "health"
        ],
        "summary": "Health das integrações (banco, portal, jogos)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/demo-request": {
      "post": {
        "tags": [
          "public"
        ],
        "summary": "Solicita contato/demo (formulário público)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DemoRequest"
              },
              "example": {
                "name": "Fulano",
                "company": "Casino X",
                "email": "fulano@casinox.com",
                "phone": "+55 11 99999-0000",
                "estimated_volume": "R$ 500k/mês"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recebido"
          }
        }
      }
    },
    "/api/public/dl/game-proxy/{slug}/{path}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "$ref": "#/components/schemas/Slug"
          }
        },
        {
          "name": "path",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "dl-casino"
        ],
        "summary": "Proxy do jogo (HTML/JS/assets) com routeShim injetado",
        "responses": {
          "200": {
            "description": "Conteúdo proxied"
          }
        }
      },
      "post": {
        "tags": [
          "dl-casino"
        ],
        "summary": "Proxy POST (seamless/JSON do jogo)",
        "responses": {
          "200": {
            "description": "Conteúdo proxied"
          }
        }
      }
    },
    "/api/public/dl/seamless/bet": {
      "post": {
        "tags": [
          "dl-casino"
        ],
        "summary": "Débito (bet) na wallet demo",
        "security": [
          {
            "portalHmac": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SeamlessBet"
              },
              "example": {
                "launch_token": "lt_...",
                "game_slug": "gold-tiger-slot",
                "round_id": "rnd_...",
                "amount_cents": 100,
                "idempotency_key": "bet_rnd_..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Débito ok/idempotente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeamlessResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/dl/seamless/win": {
      "post": {
        "tags": [
          "dl-casino"
        ],
        "summary": "Crédito (win) na wallet demo",
        "security": [
          {
            "portalHmac": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SeamlessWin"
              },
              "example": {
                "launch_token": "lt_...",
                "game_slug": "gold-tiger-slot",
                "round_id": "rnd_...",
                "amount_cents": 250,
                "multiplier": 2.5,
                "idempotency_key": "win_rnd_..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Crédito ok/idempotente"
          }
        }
      }
    },
    "/api/public/dl/seamless/rollback": {
      "post": {
        "tags": [
          "dl-casino"
        ],
        "summary": "Estorna uma rodada",
        "security": [
          {
            "portalHmac": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OK"
              },
              "example": {
                "launch_token": "lt_...",
                "game_slug": "gold-tiger-slot",
                "round_id": "rnd_...",
                "idempotency_key": "rb_rnd_..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rollback ok/idempotente"
          }
        }
      }
    },
    "/api/public/dl/seamless/balance": {
      "get": {
        "tags": [
          "dl-casino"
        ],
        "summary": "Saldo atual da wallet demo (launch token)",
        "security": [
          {
            "portalHmac": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/dl/launch/verify": {
      "post": {
        "tags": [
          "dl-casino"
        ],
        "summary": "Jogo valida launch token com o portal",
        "security": [
          {
            "portalHmac": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OK"
              },
              "example": {
                "token": "lt_...",
                "game_slug": "gold-tiger-slot"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/dl/session/heartbeat": {
      "post": {
        "tags": [
          "dl-casino"
        ],
        "summary": "Mantém sessão do iframe viva",
        "security": [
          {
            "portalHmac": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/dl/session/close": {
      "post": {
        "tags": [
          "dl-casino"
        ],
        "summary": "Encerra sessão do iframe",
        "security": [
          {
            "portalHmac": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/dl/round/start": {
      "post": {
        "tags": [
          "dl-casino"
        ],
        "summary": "Registra início de rodada (safety net)",
        "security": [
          {
            "portalHmac": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/dl/wallet/sync": {
      "post": {
        "tags": [
          "dl-casino"
        ],
        "summary": "Sync admin de saldo (endurecido: caps + auditoria)",
        "security": [
          {
            "hasRoleAdmin": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/dl/wallet/reconcile": {
      "get": {
        "tags": [
          "hooks"
        ],
        "summary": "Cron de reconciliação de saldo (public)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/dl/invoice": {
      "get": {
        "tags": [
          "manager"
        ],
        "summary": "GGR/invoice do operador demo",
        "security": [
          {
            "hasRoleManager": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/dl/audit/list": {
      "get": {
        "tags": [
          "manager"
        ],
        "summary": "Lista audit log da wallet demo",
        "security": [
          {
            "hasRoleManager": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/dl/audit/export": {
      "get": {
        "tags": [
          "manager"
        ],
        "summary": "Exporta audit log em CSV",
        "security": [
          {
            "hasRoleManager": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/dl/bridge-contract-health": {
      "get": {
        "tags": [
          "health"
        ],
        "summary": "Health do contrato bridge nos 20 jogos",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/dl/health-all": {
      "get": {
        "tags": [
          "health"
        ],
        "summary": "Ping HMAC agregado em todos os jogos",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/health": {
      "get": {
        "tags": [
          "health"
        ],
        "summary": "Health raiz (DB + portal)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/warm": {
      "get": {
        "tags": [
          "health"
        ],
        "summary": "Keep-warm — pinga portal + 20 jogos",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/status-summary": {
      "get": {
        "tags": [
          "health"
        ],
        "summary": "Resumo agregado de status",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/status-summary/operator/{slug}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "$ref": "#/components/schemas/Slug"
          }
        }
      ],
      "get": {
        "tags": [
          "health"
        ],
        "summary": "Status do operador (público)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/portal-ping": {
      "get": {
        "tags": [
          "health"
        ],
        "summary": "Ping HMAC do portal (diagnóstico)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/game-health-cron": {
      "get": {
        "tags": [
          "hooks"
        ],
        "summary": "Cron de health por jogo",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/null-userref-check": {
      "get": {
        "tags": [
          "hooks"
        ],
        "summary": "Verifica user_ref NULL em rounds; alerta Slack",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/reconcile-null-userrefs": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Executa reconcile_null_user_refs + notifica Slack",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/preflight-schema-alert": {
      "get": {
        "tags": [
          "hooks"
        ],
        "summary": "Alerta de mudanças de schema",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/webhooks-dispatch": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Dispatcher interno de webhooks",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/alerts/ack": {
      "post": {
        "tags": [
          "manager"
        ],
        "summary": "Ack de alerta",
        "security": [
          {
            "hasRoleManager": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/login-audit": {
      "post": {
        "tags": [
          "public"
        ],
        "summary": "Registra evento de login (login|logout|password_changed)",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "event"
                ],
                "properties": {
                  "event": {
                    "type": "string",
                    "enum": [
                      "login",
                      "logout",
                      "password_changed"
                    ]
                  },
                  "user_email": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "event": "password_changed",
                "user_email": "op@parceiro.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/login-block-check": {
      "get": {
        "tags": [
          "hooks"
        ],
        "summary": "Verifica bloqueio de login por tentativas",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/signup-decide": {
      "post": {
        "tags": [
          "admin"
        ],
        "summary": "Aprova/rejeita cadastro pendente",
        "security": [
          {
            "hasRoleAdmin": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OK"
              },
              "example": {
                "user_id": "uuid",
                "decision": "approve"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/signup-notify": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Notifica admin sobre novo cadastro",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/audit-report.pdf": {
      "get": {
        "tags": [
          "manager"
        ],
        "summary": "Baixa relatório de auditoria em PDF",
        "security": [
          {
            "hasRoleManager": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/game-announced": {
      "post": {
        "tags": [
          "admin"
        ],
        "summary": "Marca jogo como anunciado (broadcast)",
        "security": [
          {
            "hasRoleAdmin": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/admin/backfill-round-refs": {
      "post": {
        "tags": [
          "admin"
        ],
        "summary": "Backfill de user_ref em rounds órfãos",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/email/open/{mid}": {
      "parameters": [
        {
          "name": "mid",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "public"
        ],
        "summary": "Pixel de abertura de email (tracking)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/ai-daily-audit": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Auditoria diária via IA",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/auth-spike-evaluate": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Avaliação de picos de autenticação",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/close-billing-period": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Fecha período de billing (mensal)",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/cloudflare-purge": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Purge de cache Cloudflare",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/daily-audit-report": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Relatório diário de auditoria",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/daily-health-check": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Health check diário",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/daily-rtp-test": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Teste diário de RTP",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/digilive-revenue-report": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Relatório DIGILIVE de receita",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/drift-alert": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Alerta de drift de RTP/saldo",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/games-health-check": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Health check dos jogos",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/integrations-health": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Health check de integrações",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/invoice-reminders": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Lembretes de faturas",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/preflight-metrics-snapshot": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Snapshot de métricas preflight",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/reconcile-invoices": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Reconcilia faturas",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/rtp-rng-alert": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Alerta RTP/RNG",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/security-alerts-evaluate": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Avalia alertas de segurança",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/slack-backfill-24h": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Backfill Slack 24h",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/slack-backfill-7d": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Backfill Slack 7 dias",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/wallet-backfill": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Backfill de wallet",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/whatsapp-retry": {
      "post": {
        "tags": [
          "hooks"
        ],
        "summary": "Retry de mensagens WhatsApp",
        "security": [
          {
            "hookSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/hooks/evolution-webhook": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "summary": "Webhook Evolution API (WhatsApp)",
        "security": [
          {
            "webhookSignature": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/telegram/webhook": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "summary": "Webhook Telegram Bot",
        "security": [
          {
            "webhookSignature": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/telegram/setup": {
      "post": {
        "tags": [
          "admin"
        ],
        "summary": "Configura webhook do bot Telegram",
        "security": [
          {
            "hasRoleAdmin": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OK"
                }
              }
            }
          },
          "401": {
            "description": "Não autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Proibido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  }
}