{
 "openapi": "3.1.0",
 "info": {
  "title": "API do plicflix",
  "version": "1.0.0",
  "description": "A API pública do plicflix para estúdios (e as rotas do jogador úteis para testes automáticos). Guia: https://developers.plicflix.com/docs/COMECE . Erros: {\"erro\": \"...\", \"codigo\"?: \"...\"}.",
  "contact": {
   "email": "suporte@plicflix.com"
  }
 },
 "servers": [
  {
   "url": "https://api.plicflix.com"
  }
 ],
 "components": {
  "securitySchemes": {
   "chavePlicflix": {
    "type": "http",
    "scheme": "bearer",
    "description": "A chave do estúdio (pk_…). Só no servidor."
   },
   "tokenJogador": {
    "type": "http",
    "scheme": "bearer",
    "description": "O token de login do jogador (de /v1/entrar)."
   },
   "basicoOAuth": {
    "type": "http",
    "scheme": "basic",
    "description": "client_id (o slug) : client_secret (a chave pk_…)"
   },
   "acessoOAuth": {
    "type": "http",
    "scheme": "bearer",
    "description": "O access token do Entrar com Plicflix (pfa_…, 1 h)."
   },
   "entrarComPlicflix": {
    "type": "oauth2",
    "description": "Guia: https://developers.plicflix.com/docs/OAUTH . PKCE S256 obrigatório.",
    "flows": {
     "authorizationCode": {
      "authorizationUrl": "https://plicflix.com/oauth/authorize",
      "tokenUrl": "https://api.plicflix.com/v1/oauth/token",
      "scopes": {
       "perfil": "o id pf_… deste jogo, o apelido e se é assinante"
      }
     }
    }
   }
  },
  "schemas": {
   "Erro": {
    "type": "object",
    "properties": {
     "erro": {
      "type": "string"
     },
     "codigo": {
      "type": "string",
      "description": "ex.: email_nao_confirmado, codigo_errado, codigo_vencido, codigo_esgotado"
     }
    },
    "required": [
     "erro"
    ]
   },
   "Troca": {
    "type": "object",
    "properties": {
     "jogador": {
      "type": "object",
      "properties": {
       "id": {
        "type": "string",
        "description": "pf_ + 24, fixo por pessoa e jogo"
       },
       "nome": {
        "type": "string",
        "description": "apelido"
       }
      },
      "required": [
       "id",
       "nome"
      ]
     },
     "jogo": {
      "type": "string",
      "description": "o slug"
     },
     "partida": {
      "type": "string"
     },
     "assinante": {
      "type": "boolean"
     },
     "contexto": {
      "type": "object",
      "properties": {
       "ref": {
        "type": "string"
       },
       "idioma": {
        "type": "string"
       },
       "plataforma": {
        "type": "string"
       }
      }
     },
     "pelo_navegador": {
      "type": "boolean"
     }
    },
    "required": [
     "jogador",
     "jogo",
     "partida",
     "assinante",
     "contexto"
    ]
   },
   "Login": {
    "type": "object",
    "properties": {
     "token": {
      "type": "string"
     },
     "conta": {
      "type": "object",
      "properties": {
       "id": {
        "type": "integer"
       },
       "email": {
        "type": "string"
       },
       "apelido": {
        "type": "string"
       },
       "codigo_amigo": {
        "type": "string"
       },
       "privacidade": {
        "type": "string"
       },
       "email_confirmado": {
        "type": "boolean"
       }
      }
     }
    },
    "required": [
     "token",
     "conta"
    ]
   },
   "Onde": {
    "type": "object",
    "properties": {
     "texto": {
      "type": "string",
      "description": "até 60"
     },
     "area": {
      "type": "string",
      "description": "até 60; a-z 0-9 / _ . -"
     },
     "ponto": {
      "type": "object",
      "description": "até 1 KB"
     }
    },
    "required": [
     "texto"
    ]
   },
   "Caso": {
    "type": "object",
    "properties": {
     "id": {
      "type": "integer"
     },
     "jogo": {
      "type": "string"
     },
     "mes": {
      "type": "string"
     },
     "situacao": {
      "type": "string",
      "enum": [
       "aberto",
       "em_analise",
       "corrigido",
       "perdido"
      ]
     },
     "aberto_em": {
      "type": "string"
     },
     "prazo": {
      "type": "string"
     },
     "prova": {
      "type": "string"
     },
     "prova_em": {
      "type": "string"
     },
     "decidido_em": {
      "type": "string"
     },
     "motivos": {
      "type": "array",
      "items": {
       "type": "string"
      }
     }
    }
   },
   "Vitrine": {
    "type": "object",
    "properties": {
     "nome": {
      "type": "string"
     },
     "subtitulo": {
      "type": "string"
     },
     "descricao": {
      "type": "string"
     },
     "descricao_longa": {
      "type": "string"
     },
     "estudio": {
      "type": "string"
     },
     "generos": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "tags": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "classificacao": {
      "type": "string",
      "enum": [
       "L",
       "10",
       "12",
       "14",
       "16",
       "18"
      ]
     },
     "plataformas": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "multijogador": {
      "type": "boolean"
     },
     "cor": {
      "type": "string",
      "description": "#rrggbb"
     },
     "status_url": {
      "type": "string"
     }
    }
   }
  }
 },
 "paths": {
  "/v1/oauth/token": {
   "post": {
    "tags": [
     "entrar com plicflix"
    ],
    "summary": "Trocar o código do \"Entrar com Plicflix\" pelo jogador (PKCE; a chave pk_ é opcional: Basic, client_secret ou Bearer)",
    "security": [
     {},
     {
      "chavePlicflix": []
     },
     {
      "basicoOAuth": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "grant_type": {
          "type": "string",
          "description": "authorization_code"
         },
         "code": {
          "type": "string",
          "description": "pfc_…"
         },
         "redirect_uri": {
          "type": "string"
         },
         "code_verifier": {
          "type": "string",
          "description": "43 a 128"
         },
         "client_id": {
          "type": "string",
          "description": "o slug do jogo"
         },
         "client_secret": {
          "type": "string",
          "description": "pk_… (opcional)"
         }
        },
        "required": [
         "grant_type",
         "code",
         "redirect_uri",
         "code_verifier",
         "client_id"
        ]
       }
      },
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "grant_type": {
          "type": "string",
          "description": "authorization_code"
         },
         "code": {
          "type": "string",
          "description": "pfc_…"
         },
         "redirect_uri": {
          "type": "string"
         },
         "code_verifier": {
          "type": "string",
          "description": "43 a 128"
         },
         "client_id": {
          "type": "string",
          "description": "o slug do jogo"
         },
         "client_secret": {
          "type": "string",
          "description": "pk_… (opcional)"
         }
        },
        "required": [
         "grant_type",
         "code",
         "redirect_uri",
         "code_verifier",
         "client_id"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "O jogador",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "jogador": {
           "type": "object",
           "properties": {
            "id": {
             "type": "string",
             "description": "pf_…, o MESMO da troca do ingresso"
            },
            "nome": {
             "type": "string"
            }
           },
           "required": [
            "id",
            "nome"
           ]
          },
          "jogo": {
           "type": "string"
          },
          "assinante": {
           "type": "boolean"
          },
          "sub": {
           "type": "string"
          },
          "name": {
           "type": "string"
          },
          "access_token": {
           "type": "string",
           "description": "pfa_…"
          },
          "token_type": {
           "type": "string",
           "description": "Bearer"
          },
          "expires_in": {
           "type": "integer"
          },
          "scope": {
           "type": "string"
          }
         },
         "required": [
          "jogador",
          "jogo",
          "assinante",
          "access_token",
          "token_type",
          "expires_in"
         ]
        }
       }
      }
     },
     "400": {
      "description": "Erro do OAuth (RFC 6749 §5.2)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string",
           "description": "invalid_grant | invalid_request | invalid_client | unsupported_grant_type | invalid_token"
          },
          "error_description": {
           "type": "string"
          }
         },
         "required": [
          "error"
         ]
        }
       }
      }
     },
     "401": {
      "description": "Erro do OAuth (RFC 6749 §5.2)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string",
           "description": "invalid_grant | invalid_request | invalid_client | unsupported_grant_type | invalid_token"
          },
          "error_description": {
           "type": "string"
          }
         },
         "required": [
          "error"
         ]
        }
       }
      }
     },
     "429": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/oauth/userinfo": {
   "get": {
    "tags": [
     "entrar com plicflix"
    ],
    "summary": "Quem é (Authorization: Bearer pfa_…, 1 h)",
    "security": [
     {
      "acessoOAuth": []
     }
    ],
    "responses": {
     "200": {
      "description": "O jogador",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "jogador": {
           "type": "object",
           "properties": {
            "id": {
             "type": "string"
            },
            "nome": {
             "type": "string"
            }
           }
          },
          "jogo": {
           "type": "string"
          },
          "assinante": {
           "type": "boolean"
          },
          "sub": {
           "type": "string"
          },
          "name": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Erro do OAuth (RFC 6749 §5.2)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string",
           "description": "invalid_grant | invalid_request | invalid_client | unsupported_grant_type | invalid_token"
          },
          "error_description": {
           "type": "string"
          }
         },
         "required": [
          "error"
         ]
        }
       }
      }
     }
    }
   }
  },
  "/v1/oauth/revogar": {
   "post": {
    "tags": [
     "entrar com plicflix"
    ],
    "summary": "Revogar um access token (RFC 7009: sempre 200)",
    "security": [],
    "requestBody": {
     "required": true,
     "content": {
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "object",
        "properties": {
         "token": {
          "type": "string",
          "description": "pfa_…"
         }
        },
        "required": [
         "token"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "ok",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/v1/oauth/descoberta": {
   "get": {
    "tags": [
     "entrar com plicflix"
    ],
    "summary": "A descoberta (RFC 8414) — também em https://plicflix.com/.well-known/oauth-authorization-server",
    "security": [],
    "responses": {
     "200": {
      "description": "Metadados",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/v1/parceiro/jogos/{slug}/oauth": {
   "get": {
    "tags": [
     "estúdio"
    ],
    "summary": "Os endereços de volta (redirect_uri) do Entrar com Plicflix",
    "security": [
     {
      "chavePlicflix": []
     }
    ],
    "parameters": [
     {
      "name": "slug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Os endereços",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "client_id": {
           "type": "string"
          },
          "redirect_uris": {
           "type": "array",
           "items": {
            "type": "string"
           }
          },
          "authorization_endpoint": {
           "type": "string"
          },
          "token_endpoint": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "404": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   },
   "put": {
    "tags": [
     "estúdio"
    ],
    "summary": "Trocar a lista inteira (até 10; https, http só em localhost, ou com.estudio.jogo:/… em app nativo; sem #)",
    "security": [
     {
      "chavePlicflix": []
     }
    ],
    "parameters": [
     {
      "name": "slug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "redirect_uris": {
          "type": "array",
          "items": {
           "type": "string"
          }
         }
        },
        "required": [
         "redirect_uris"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Os endereços",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "client_id": {
           "type": "string"
          },
          "redirect_uris": {
           "type": "array",
           "items": {
            "type": "string"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "401": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "404": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/ingresso/trocar": {
   "post": {
    "tags": [
     "estúdio"
    ],
    "summary": "Trocar o token do jogador (no SEU servidor)",
    "security": [
     {
      "chavePlicflix": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "token": {
          "type": "string",
          "description": "pft_ + 43 caracteres"
         }
        },
        "required": [
         "token"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "O jogador",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Troca"
        }
       }
      }
     },
     "401": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/ingresso/navegador": {
   "post": {
    "tags": [
     "navegador"
    ],
    "summary": "Troca pelo navegador (jogos sem servidor). Origin = origem do jogo.",
    "security": [],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "token": {
          "type": "string"
         }
        },
        "required": [
         "token"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "O jogador (pelo_navegador: true)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Troca"
        }
       }
      }
     },
     "401": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "403": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "429": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/parceiro/jogos": {
   "get": {
    "tags": [
     "estúdio"
    ],
    "summary": "Os seus jogos",
    "security": [
     {
      "chavePlicflix": []
     }
    ],
    "responses": {
     "200": {
      "description": "Jogos",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "parceiro": {
           "type": "string"
          },
          "jogos": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "slug": {
              "type": "string"
             },
             "nome": {
              "type": "string"
             },
             "url": {
              "type": "string"
             },
             "tipo": {
              "type": "string"
             },
             "ativo": {
              "type": "boolean"
             },
             "situacao": {
              "type": "string",
              "enum": [
               "rascunho",
               "em_revisao",
               "recusado",
               "publicado"
              ]
             },
             "motivo_recusa": {
              "type": "string"
             },
             "status": {
              "type": "string"
             },
             "status_url": {
              "type": "string"
             }
            }
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/parceiro/jogos/{slug}": {
   "put": {
    "tags": [
     "estúdio"
    ],
    "summary": "Editar os textos da vitrine (parcial: só os campos enviados mudam; a mídia só pelo painel)",
    "security": [
     {
      "chavePlicflix": []
     }
    ],
    "parameters": [
     {
      "name": "slug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Vitrine"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "O cartão do jogo atualizado",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "401": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "404": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/parceiro/casos": {
   "get": {
    "tags": [
     "estúdio"
    ],
    "summary": "Casos de reclamação",
    "security": [
     {
      "chavePlicflix": []
     }
    ],
    "responses": {
     "200": {
      "description": "Casos",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "casos": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Caso"
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/parceiro/casos/{id}/prova": {
   "post": {
    "tags": [
     "estúdio"
    ],
    "summary": "Mandar a prova da correção (até 48 h úteis)",
    "security": [
     {
      "chavePlicflix": []
     }
    ],
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "prova": {
          "type": "string"
         }
        },
        "required": [
         "prova"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "O caso vai para análise",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "situacao": {
           "type": "string",
           "description": "em_analise"
          }
         }
        }
       }
      }
     },
     "409": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "401": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/parceiro/repasses": {
   "get": {
    "tags": [
     "estúdio"
    ],
    "summary": "Extrato do repasse",
    "security": [
     {
      "chavePlicflix": []
     }
    ],
    "responses": {
     "200": {
      "description": "Repasses",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "repasses": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "mes": {
              "type": "string",
              "description": "AAAA-MM"
             },
             "jogo": {
              "type": "string"
             },
             "jogadores": {
              "type": "integer"
             },
             "segundos": {
              "type": "integer"
             },
             "pago_centavos": {
              "type": "integer"
             },
             "retido_centavos": {
              "type": "integer"
             }
            }
           }
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/saude": {
   "get": {
    "tags": [
     "pública"
    ],
    "summary": "A API está de pé",
    "security": [],
    "responses": {
     "200": {
      "description": "ok",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/v1/jogos/{slug}/status": {
   "get": {
    "tags": [
     "pública"
    ],
    "summary": "O status do servidor do jogo (a vigia)",
    "security": [],
    "parameters": [
     {
      "name": "slug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Status",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string",
           "enum": [
            "online",
            "instavel",
            "offline",
            "desconhecido"
           ]
          },
          "ms": {
           "type": "integer"
          },
          "em": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/v1/contas": {
   "post": {
    "tags": [
     "jogador"
    ],
    "summary": "Criar conta (o código de confirmação vai por e-mail)",
    "security": [],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "email": {
          "type": "string"
         },
         "senha": {
          "type": "string",
          "description": "8 a 72"
         },
         "apelido": {
          "type": "string",
          "description": "2 a 24"
         }
        },
        "required": [
         "email",
         "senha",
         "apelido"
        ]
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Login",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Login"
        }
       }
      }
     },
     "400": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "409": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "429": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/entrar": {
   "post": {
    "tags": [
     "jogador"
    ],
    "summary": "Entrar",
    "security": [],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "email": {
          "type": "string"
         },
         "senha": {
          "type": "string"
         }
        },
        "required": [
         "email",
         "senha"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Login",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Login"
        }
       }
      }
     },
     "401": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "429": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/eu": {
   "get": {
    "tags": [
     "jogador"
    ],
    "summary": "A conta, a assinatura e o que está jogando",
    "security": [
     {
      "tokenJogador": []
     }
    ],
    "responses": {
     "200": {
      "description": "Eu",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/eu/confirmar": {
   "post": {
    "tags": [
     "jogador"
    ],
    "summary": "Confirmar o e-mail com o código de 6 dígitos",
    "security": [
     {
      "tokenJogador": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "codigo": {
          "type": "string",
          "description": "6 dígitos"
         }
        },
        "required": [
         "codigo"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "ok",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          },
          "email_confirmado": {
           "type": "boolean"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/eu/confirmar/reenviar": {
   "post": {
    "tags": [
     "jogador"
    ],
    "summary": "Mandar outro código de confirmação",
    "security": [
     {
      "tokenJogador": []
     }
    ],
    "responses": {
     "200": {
      "description": "ok",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/v1/senha/esqueci": {
   "post": {
    "tags": [
     "jogador"
    ],
    "summary": "Esqueci a senha (manda o código; resposta sempre igual)",
    "security": [],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "email": {
          "type": "string"
         }
        },
        "required": [
         "email"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "ok",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/v1/senha/trocar": {
   "post": {
    "tags": [
     "jogador"
    ],
    "summary": "Trocar a senha com o código (já devolve login)",
    "security": [],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "email": {
          "type": "string"
         },
         "codigo": {
          "type": "string"
         },
         "senha": {
          "type": "string"
         }
        },
        "required": [
         "email",
         "codigo",
         "senha"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Login",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Login"
        }
       }
      }
     },
     "400": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/jogos/{slug}/jogar": {
   "post": {
    "tags": [
     "jogador"
    ],
    "summary": "Abrir a partida: devolve a URL do jogo com o token",
    "security": [
     {
      "tokenJogador": []
     }
    ],
    "parameters": [
     {
      "name": "slug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "plataforma": {
          "type": "string",
          "description": "web|android|ios|desktop|tv"
         },
         "idioma": {
          "type": "string"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "A partida",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "partida": {
           "type": "string"
          },
          "url": {
           "type": "string"
          },
          "origem": {
           "type": "string"
          },
          "pulso_segundos": {
           "type": "integer"
          },
          "limite_carga_s": {
           "type": "integer"
          }
         }
        }
       }
      }
     },
     "402": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "403": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "404": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "503": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/partidas/{id}/carregou": {
   "post": {
    "tags": [
     "jogador"
    ],
    "summary": "O jogo ficou pronto (ou falhou)",
    "security": [
     {
      "tokenJogador": []
     }
    ],
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "ms": {
          "type": "integer"
         },
         "falha": {
          "type": "string",
          "enum": [
           "",
           "demorou",
           "erro",
           "desistiu"
          ]
         }
        },
        "required": [
         "ms",
         "falha"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "ok",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          }
         }
        }
       }
      }
     },
     "410": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/partidas/{id}/onde": {
   "post": {
    "tags": [
     "jogador"
    ],
    "summary": "Onde o jogador está",
    "security": [
     {
      "tokenJogador": []
     }
    ],
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Onde"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "ok",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     },
     "410": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/partidas/{id}/pulso": {
   "post": {
    "tags": [
     "jogador"
    ],
    "summary": "Tempo ativo (a cada 30 s)",
    "security": [
     {
      "tokenJogador": []
     }
    ],
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "ativo_ms": {
          "type": "integer"
         },
         "onde": {
          "$ref": "#/components/schemas/Onde"
         }
        },
        "required": [
         "ativo_ms"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "ok",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "410": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  },
  "/v1/partidas/{id}/fim": {
   "post": {
    "tags": [
     "jogador"
    ],
    "summary": "Encerrar a partida",
    "security": [
     {
      "tokenJogador": []
     }
    ],
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "ok",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "410": {
      "description": "Erro",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Erro"
        }
       }
      }
     }
    }
   }
  }
 }
}