{
  "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)"
    }
  ],
  "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"
      },
      "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/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/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"
                }
              }
            }
          }
        }
      }
    }
  }
}