{
  "openapi": "3.1.0",
  "info": {
    "title": "API de contato de Bruno Germano",
    "version": "1.0.0",
    "description": "Envia uma mensagem de contato. Esta operação envia email real."
  },
  "servers": [
    {
      "url": "https://v8ykb2j2m4.map.azionedge.net"
    }
  ],
  "paths": {
    "/api/contact": {
      "post": {
        "operationId": "sendContact",
        "summary": "Enviar mensagem de contato",
        "description": "O corpo deve ter no máximo 16384 bytes. Quando offer é seguradoras, company, role e front são obrigatórios.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "email",
                  "message",
                  "consent"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 120,
                    "description": "Ao menos dois caracteres após remover espaços."
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "message": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 5000,
                    "description": "Ao menos dez caracteres após remover espaços."
                  },
                  "consent": {
                    "const": true
                  },
                  "offer": {
                    "type": "string",
                    "description": "Use seguradoras para a oferta de seguradoras."
                  },
                  "company": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "Obrigatória e com conteúdo após remover espaços quando offer é seguradoras."
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "CTO",
                      "Gerente de tecnologia",
                      "Outro"
                    ]
                  },
                  "front": {
                    "type": "string",
                    "enum": [
                      "adocao-externa",
                      "times-internos",
                      "ambas",
                      "indefinida"
                    ]
                  }
                },
                "allOf": [
                  {
                    "if": {
                      "properties": {
                        "offer": {
                          "const": "seguradoras"
                        }
                      },
                      "required": [
                        "offer"
                      ]
                    },
                    "then": {
                      "required": [
                        "company",
                        "role",
                        "front"
                      ]
                    }
                  }
                ]
              },
              "example": {
                "name": "Ana Silva",
                "email": "ana@example.com",
                "message": "Gostaria de conversar sobre consultoria.",
                "consent": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Mensagem aceita",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "Error": {
        "description": "Erro ao validar ou enviar a mensagem.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "ok",
                "error"
              ],
              "properties": {
                "ok": {
                  "const": false
                },
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}
