{
  "openapi": "3.1.0",
  "info": {
    "title": "Noori ACS — Minha Conta",
    "version": "1.0.0",
    "description": "Autosserviço autenticado por sessão TENANT. Identidade obtida exclusivamente da sessão; parâmetros de tenant/user/role são rejeitados. Senha e MFA afetam a identidade global; sessões e histórico são filtrados pela empresa. SMTP compartilhado, convites, recuperação e alteração de e-mail implementados. Eventos publicados por consulta autenticada em /api/v1/users/events. Recuperação por SMTP do tenant é restrita a identidades exclusivas; identidades compartilhadas/plataforma exigem SMTP global explicitamente autorizado. Links são de uso único, expiram em 30 minutos e não substituem MFA. O convite aceita nome, telefone e requireMfa, com bloqueio operacional até verificação do fator."
  },
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "paths": {
    "/api/v1/me": {
      "get": {
        "summary": "Consultar identidade global e vínculo da empresa atual",
        "operationId": "getApiV1Me",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Profile"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Atualizar somente campos pessoais permitidos",
        "operationId": "patchApiV1Me",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Profile"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProfilePatch"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ]
      }
    },
    "/api/v1/me/change-password": {
      "post": {
        "summary": "Alterar senha local global e revogar outras sessões por padrão",
        "operationId": "postApiV1MeChange-Password",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Updated"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordChange"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ]
      }
    },
    "/api/platform/v1/me/change-password": {
      "post": {
        "summary": "Alterar senha local global e revogar outras sessões por padrão (painel SaaS)",
        "description": "Mesma regra e mesmo caso de uso da rota de tenant, acessada pela sessão de plataforma (cookie nooriacs_platform_session). A senha pertence à identidade global; a auditoria é gravada em platform_audit_logs porque o contexto de plataforma não tem tenant. Não exige permissão de plataforma: qualquer sessão válida troca a própria senha.",
        "operationId": "platformChangeOwnPassword",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Updated"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordChange"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ]
      }
    },
    "/api/v1/me/permissions": {
      "get": {
        "summary": "Consultar permissões efetivas, sem editá-las",
        "operationId": "getApiV1MePermissions",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tenantId": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string"
                    },
                    "permissions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "tenantId",
                    "role",
                    "permissions"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/me/sessions": {
      "get": {
        "summary": "Consultar até 100 sessões próprias da empresa atual",
        "operationId": "getApiV1MeSessions",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Session"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/me/sessions/revoke-others": {
      "post": {
        "summary": "Revogar outras sessões próprias da empresa atual",
        "operationId": "postApiV1MeSessionsRevoke-Others",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "revoked": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "revoked"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ]
      }
    },
    "/api/v1/me/sessions/{sessionId}": {
      "delete": {
        "summary": "Revogar sessão própria preservando motivo e data anteriores",
        "operationId": "deleteApiV1MeSessionsSessionid",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "revoked": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "revoked"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          },
          {
            "in": "path",
            "name": "sessionId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/api/v1/me/security-events": {
      "get": {
        "summary": "Consultar somente eventos ACCOUNT do próprio usuário e empresa",
        "operationId": "getApiV1MeSecurity-Events",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SecurityEvent"
                      }
                    },
                    "page": {
                      "type": "integer"
                    },
                    "hasMore": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "items",
                    "page",
                    "hasMore"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "event",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "result",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ip",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "device",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "from",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "to",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 1
            }
          }
        ]
      }
    },
    "/api/v1/me/mfa": {
      "get": {
        "summary": "Consultar estado do autenticador",
        "operationId": "getApiV1MeMfa",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MfaState"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/me/mfa/totp/setup": {
      "post": {
        "summary": "Iniciar TOTP com reautenticação; segredo retornado uma vez, sem cache",
        "operationId": "postApiV1MeMfaTotpSetup",
        "responses": {
          "201": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MfaSetup"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MfaInput"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ]
      }
    },
    "/api/v1/me/mfa/totp/enroll": {
      "post": {
        "summary": "Iniciar TOTP com reautenticação; segredo retornado uma vez, sem cache",
        "operationId": "postApiV1MeMfaTotpEnroll",
        "responses": {
          "201": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MfaSetup"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MfaInput"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ]
      }
    },
    "/api/v1/me/mfa/totp/confirm": {
      "post": {
        "summary": "Confirmar TOTP; retornar códigos de recuperação uma vez",
        "operationId": "postApiV1MeMfaTotpConfirm",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MfaResult"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MfaInput"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ]
      }
    },
    "/api/v1/me/mfa/totp/verify": {
      "post": {
        "summary": "Confirmar TOTP; retornar códigos de recuperação uma vez",
        "operationId": "postApiV1MeMfaTotpVerify",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MfaResult"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MfaInput"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ]
      }
    },
    "/api/v1/me/mfa/disable": {
      "post": {
        "summary": "Reautenticar e consumir TOTP ou recuperação antes da ação global",
        "operationId": "postApiV1MeMfaDisable",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MfaResult"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MfaInput"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ]
      }
    },
    "/api/v1/me/mfa/recovery-codes": {
      "post": {
        "summary": "Reautenticar e consumir TOTP ou recuperação antes da ação global",
        "operationId": "postApiV1MeMfaRecovery-Codes",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MfaResult"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MfaInput"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ]
      }
    },
    "/api/v1/me/avatar": {
      "get": {
        "summary": "Ler a foto privada da própria identidade",
        "operationId": "getApiV1MeAvatar",
        "responses": {
          "200": {
            "description": "Imagem privada; Cache-Control no-store, nosniff",
            "content": {
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Salvar imagem validada no storage existente, até 2 MiB",
        "operationId": "postApiV1MeAvatar",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "updated": {
                      "type": "boolean"
                    },
                    "hasAvatar": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "updated",
                    "hasAvatar"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary",
                "maxLength": 2097152
              }
            },
            "image/png": {
              "schema": {
                "type": "string",
                "format": "binary",
                "maxLength": 2097152
              }
            },
            "image/webp": {
              "schema": {
                "type": "string",
                "format": "binary",
                "maxLength": 2097152
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Remover vínculo da foto atual",
        "operationId": "deleteApiV1MeAvatar",
        "responses": {
          "200": {
            "description": "Resposta atual da conta autenticada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "updated": {
                      "type": "boolean"
                    },
                    "hasAvatar": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "updated",
                    "hasAvatar"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ]
      }
    },
    "/api/v1/users/{id}": {
      "get": {
        "operationId": "getTenantUser",
        "summary": "Consultar usuário da equipe",
        "description": "Exige users:manage e membership do alvo na empresa da sessão. Mutação exige Origin legítima. Nunca afeta sessões de outra empresa.",
        "responses": {
          "200": {
            "description": "Resultado autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantUser"
                }
              }
            }
          },
          "400": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ]
    },
    "/api/v1/users/{id}/sessions": {
      "get": {
        "operationId": "getTenantUserSessions",
        "summary": "Consultar sessões da equipe",
        "description": "Exige users:manage e membership do alvo na empresa da sessão. Mutação exige Origin legítima. Nunca afeta sessões de outra empresa.",
        "responses": {
          "200": {
            "description": "Resultado autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AdminSession"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ]
    },
    "/api/v1/users/{id}/audit": {
      "get": {
        "operationId": "getTenantUserAudit",
        "summary": "Consultar atividades da equipe",
        "description": "Exige users:manage e membership do alvo na empresa da sessão. Mutação exige Origin legítima. Nunca afeta sessões de outra empresa.",
        "responses": {
          "200": {
            "description": "Resultado autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AdminEvent"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ]
    },
    "/api/v1/users/{id}/permissions": {
      "get": {
        "operationId": "getTenantUserPermissions",
        "summary": "Consultar permissões efetivas",
        "description": "Exige users:manage e membership do alvo na empresa da sessão. Mutação exige Origin legítima. Nunca afeta sessões de outra empresa.",
        "responses": {
          "200": {
            "description": "Resultado autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminPermissions"
                }
              }
            }
          },
          "400": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ]
    },
    "/api/v1/users/{id}/roles": {
      "put": {
        "operationId": "assignTenantUserRoles",
        "summary": "Substituir seleção de papéis",
        "description": "Exige users:manage e membership do alvo na empresa da sessão. Mutação exige Origin legítima. Nunca afeta sessões de outra empresa.",
        "responses": {
          "200": {
            "description": "Resultado autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoleAssignment"
                }
              }
            }
          },
          "400": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RoleAssignment"
              }
            }
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ]
    },
    "/api/v1/users/{id}/sessions/revoke": {
      "post": {
        "operationId": "revokeTenantUserSessions",
        "summary": "Encerrar sessões da equipe",
        "description": "Exige users:manage e membership do alvo na empresa da sessão. Mutação exige Origin legítima. Nunca afeta sessões de outra empresa.",
        "responses": {
          "200": {
            "description": "Resultado autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "revoked": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "required": [
                    "revoked"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ]
    },
    "/api/v1/users/role-matrix": {
      "get": {
        "operationId": "getTenantRoleMatrix",
        "summary": "Consultar matriz de papéis",
        "description": "Exige users:manage e membership do alvo na empresa da sessão. Mutação exige Origin legítima. Nunca afeta sessões de outra empresa.",
        "responses": {
          "200": {
            "description": "Resultado autorizado",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoleMatrix"
                }
              }
            }
          },
          "400": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/users/{id}/avatar": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getTenantUserAvatar",
        "summary": "Consultar foto privada da equipe",
        "description": "Exige users:manage e membership do alvo na empresa da sessão. Mutação exige Origin legítima. Nunca afeta sessões de outra empresa.",
        "responses": {
          "200": {
            "description": "Imagem privada, Cache-Control no-store e nosniff",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro seguro",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/forgot-password": {
      "post": {
        "summary": "Solicitar recuperação com resposta neutra",
        "operationId": "postApiV1AuthForgotPassword",
        "responses": {
          "202": {
            "description": "Solicitar recuperação com resposta neutra",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailMessage"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [],
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForgotPassword"
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/reset-password": {
      "post": {
        "summary": "Consumir link de recuperação uma única vez",
        "operationId": "postApiV1AuthResetPassword",
        "responses": {
          "200": {
            "description": "Consumir link de recuperação uma única vez",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailUpdated"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [],
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResetPassword"
              }
            }
          }
        }
      }
    },
    "/api/v1/me/email/change-request": {
      "post": {
        "summary": "Solicitar confirmação de novo e-mail",
        "operationId": "postApiV1MeEmailChangeRequest",
        "responses": {
          "202": {
            "description": "Solicitar confirmação de novo e-mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailMessage"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailChange"
              }
            }
          }
        }
      }
    },
    "/api/v1/me/email/confirm": {
      "post": {
        "summary": "Confirmar e-mail e invalidar links antigos",
        "operationId": "postApiV1MeEmailConfirm",
        "responses": {
          "200": {
            "description": "Confirmar e-mail e invalidar links antigos",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailUpdated"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailConfirmation"
              }
            }
          }
        }
      }
    },
    "/api/v1/me/mfa/session/verify": {
      "post": {
        "summary": "Verificar fator existente na sessão atual",
        "operationId": "postApiV1MeMfaSessionVerify",
        "responses": {
          "200": {
            "description": "Verificar fator existente na sessão atual",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MfaSessionVerified"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MfaSessionVerification"
              }
            }
          }
        }
      }
    },
    "/api/v1/account-mail/settings": {
      "get": {
        "summary": "Consultar configuração sem credenciais",
        "operationId": "getApiV1AccountMailSettings",
        "responses": {
          "200": {
            "description": "Consultar configuração sem credenciais",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailSettings"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Exige users:manage e settings:manage no tenant atual."
      },
      "put": {
        "summary": "Configurar envio por empresa com revisão",
        "operationId": "putApiV1AccountMailSettings",
        "responses": {
          "200": {
            "description": "Configurar envio por empresa com revisão",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailSettings"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Exige users:manage e settings:manage no tenant atual.",
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MailSettingsUpdate"
              }
            }
          }
        }
      }
    },
    "/api/v1/account-mail/logs": {
      "get": {
        "summary": "Histórico sanitizado dos envios",
        "operationId": "getApiV1AccountMailLogs",
        "responses": {
          "200": {
            "description": "Histórico sanitizado dos envios",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailLogPage"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Exige users:manage e settings:manage no tenant atual.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          }
        ]
      }
    },
    "/api/v1/account-mail/test": {
      "post": {
        "summary": "Agendar teste para o próprio e-mail",
        "operationId": "postApiV1AccountMailTest",
        "responses": {
          "202": {
            "description": "Agendar teste para o próprio e-mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailTest"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Exige users:manage e settings:manage no tenant atual.",
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/v1/users/events": {
      "get": {
        "summary": "Consultar eventos versionados de identidade",
        "operationId": "getApiV1UsersEvents",
        "responses": {
          "200": {
            "description": "Consultar eventos versionados de identidade",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountEventPage"
                }
              }
            }
          },
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Exige users:manage e audit:read no tenant atual. Journal de eventos consultável; não há entrega HTTP externa configurada por este contrato.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          }
        ]
      }
    },
    "/api/v1/invitations": {
      "get": {
        "summary": "Listar convites pendentes da empresa",
        "operationId": "listAccountInvitations",
        "responses": {
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Listar convites pendentes da empresa",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantInvitationPage"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Convidar usuário com papel permitido e MFA opcionalmente obrigatório",
        "operationId": "createAccountInvitation",
        "responses": {
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "201": {
            "description": "Convidar usuário com papel permitido e MFA opcionalmente obrigatório",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantInvitationCreated"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantInvitationInput"
              }
            }
          }
        }
      }
    },
    "/api/v1/invitations/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "summary": "Revogar convite pendente da empresa",
        "operationId": "revokeAccountInvitation",
        "responses": {
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Revogar convite pendente da empresa",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Revoked"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/public/invitations/accept": {
      "post": {
        "summary": "Aceitar convite de uso único",
        "operationId": "acceptAccountInvitation",
        "responses": {
          "400": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Erro estável, sem dados sensíveis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Aceitar convite de uso único",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantInvitationAccepted"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Origem exata configurada no painel; mutação com cookie exige proteção CSRF."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TenantInvitationAccept"
              }
            }
          }
        },
        "security": []
      }
    }
  },
  "components": {
    "securitySchemes": {
      "sessionCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "nooriacs_session"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "Updated": {
        "type": "object",
        "properties": {
          "updated": {
            "type": "boolean"
          }
        },
        "required": [
          "updated"
        ],
        "additionalProperties": false
      },
      "Preferences": {
        "type": "object",
        "properties": {
          "securityEmail": {
            "type": "boolean"
          }
        },
        "required": [
          "securityEmail"
        ],
        "additionalProperties": false
      },
      "ProfilePatch": {
        "type": "object",
        "properties": {
          "fullName": {
            "type": "string",
            "maxLength": 160
          },
          "displayName": {
            "type": "string",
            "minLength": 2,
            "maxLength": 128
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "alternatePhone": {
            "type": [
              "string",
              "null"
            ]
          },
          "jobTitle": {
            "type": "string",
            "maxLength": 128
          },
          "department": {
            "type": "string",
            "maxLength": 128
          },
          "locale": {
            "enum": [
              "pt-BR",
              "en-US",
              "es"
            ]
          },
          "timezone": {
            "type": "string"
          },
          "notificationPreferences": {
            "$ref": "#/components/schemas/Preferences"
          }
        },
        "required": [],
        "additionalProperties": false,
        "minProperties": 1
      },
      "Profile": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "fullName": {
            "type": [
              "string",
              "null"
            ]
          },
          "displayName": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "alternatePhone": {
            "type": [
              "string",
              "null"
            ]
          },
          "phoneVerifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "emailVerifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "locale": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "notificationPreferences": {
            "$ref": "#/components/schemas/Preferences"
          },
          "jobTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "department": {
            "type": [
              "string",
              "null"
            ]
          },
          "localLoginEnabled": {
            "type": "boolean"
          },
          "avatarUpdatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "hasAvatar": {
            "type": "boolean"
          },
          "tenant": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "role": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "role"
            ],
            "additionalProperties": false
          },
          "release": {
            "type": "object",
            "properties": {
              "channel": {
                "type": "string"
              },
              "environment": {
                "type": "string"
              },
              "version": {
                "type": "string"
              },
              "plan": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [],
            "additionalProperties": false
          },
          "options": {
            "type": "object",
            "properties": {
              "locales": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "timezones": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "locales",
              "timezones"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "email",
          "fullName",
          "displayName",
          "phone",
          "alternatePhone",
          "phoneVerifiedAt",
          "emailVerifiedAt",
          "locale",
          "timezone",
          "notificationPreferences",
          "jobTitle",
          "department",
          "localLoginEnabled",
          "avatarUpdatedAt",
          "hasAvatar",
          "tenant",
          "release",
          "options"
        ],
        "additionalProperties": false
      },
      "Session": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "ipCreated": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastIp": {
            "type": [
              "string",
              "null"
            ]
          },
          "userAgent": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastSeenAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "revokedReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "current": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "ipCreated",
          "lastIp",
          "userAgent",
          "createdAt",
          "lastSeenAt",
          "expiresAt",
          "revokedAt",
          "revokedReason",
          "current"
        ],
        "additionalProperties": false
      },
      "SecurityEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "event": {
            "type": "string"
          },
          "result": {
            "type": [
              "string",
              "null"
            ]
          },
          "ipAddress": {
            "type": [
              "string",
              "null"
            ]
          },
          "userAgent": {
            "type": [
              "string",
              "null"
            ]
          },
          "requestId": {
            "type": "string"
          },
          "timestamp": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "event",
          "result",
          "ipAddress",
          "userAgent",
          "requestId",
          "timestamp"
        ],
        "additionalProperties": false
      },
      "MfaState": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "pending": {
            "type": "boolean"
          },
          "verifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "recoveryCodesRemaining": {
            "type": "integer",
            "minimum": 0
          },
          "verificationRequired": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled",
          "pending",
          "verifiedAt",
          "recoveryCodesRemaining",
          "verificationRequired"
        ],
        "additionalProperties": false
      },
      "PasswordChange": {
        "type": "object",
        "properties": {
          "currentPassword": {
            "type": "string",
            "writeOnly": true,
            "maxLength": 128
          },
          "newPassword": {
            "type": "string",
            "writeOnly": true,
            "minLength": 12,
            "maxLength": 128
          },
          "mfaCode": {
            "type": "string",
            "writeOnly": true,
            "maxLength": 128
          },
          "revokeOthers": {
            "type": "boolean",
            "default": true
          }
        },
        "required": [
          "currentPassword",
          "newPassword"
        ],
        "additionalProperties": false
      },
      "MfaInput": {
        "type": "object",
        "properties": {
          "currentPassword": {
            "type": "string",
            "writeOnly": true
          },
          "code": {
            "type": "string",
            "writeOnly": true
          },
          "mfaCode": {
            "type": "string",
            "writeOnly": true
          }
        },
        "required": [
          "currentPassword"
        ],
        "additionalProperties": false
      },
      "MfaSetup": {
        "type": "object",
        "properties": {
          "secret": {
            "type": "string"
          },
          "uri": {
            "type": "string"
          }
        },
        "required": [
          "secret",
          "uri"
        ],
        "additionalProperties": false
      },
      "MfaResult": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "recoveryCodes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "enabled"
        ],
        "additionalProperties": false
      },
      "TenantUser": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "is_owner": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string"
          },
          "last_login_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "has_avatar": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "email",
          "display_name",
          "role",
          "active",
          "is_owner",
          "created_at"
        ],
        "additionalProperties": false
      },
      "AdminSession": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "expires_at": {
            "type": "string"
          },
          "last_seen_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "ip": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_ip": {
            "type": [
              "string",
              "null"
            ]
          },
          "user_agent": {
            "type": [
              "string",
              "null"
            ]
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "revoked_reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "created_at",
          "expires_at",
          "last_seen_at",
          "ip",
          "last_ip",
          "user_agent",
          "revoked_at",
          "revoked_reason"
        ],
        "additionalProperties": false
      },
      "AdminEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "outcome": {
            "type": "string"
          },
          "ip": {
            "type": [
              "string",
              "null"
            ]
          },
          "user_agent": {
            "type": [
              "string",
              "null"
            ]
          },
          "request_id": {
            "type": "string"
          },
          "actor_user_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "created_at",
          "action",
          "outcome",
          "ip",
          "user_agent",
          "request_id",
          "actor_user_id"
        ],
        "additionalProperties": false
      },
      "AssignedRole": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "name"
        ],
        "additionalProperties": false
      },
      "RoleRule": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "permission_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "effect": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "name",
          "permission_code",
          "effect"
        ],
        "additionalProperties": false
      },
      "AdminPermissions": {
        "type": "object",
        "properties": {
          "roles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssignedRole"
            }
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoleRule"
            }
          }
        },
        "required": [
          "roles",
          "permissions",
          "rules"
        ],
        "additionalProperties": false
      },
      "RoleMatrix": {
        "type": "object",
        "properties": {
          "roles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssignedRole"
            }
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoleRule"
            }
          }
        },
        "required": [
          "roles",
          "rules"
        ],
        "additionalProperties": false
      },
      "RoleAssignment": {
        "type": "object",
        "properties": {
          "roles": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "minItems": 1,
            "maxItems": 8,
            "uniqueItems": true
          }
        },
        "required": [
          "roles"
        ],
        "additionalProperties": false
      },
      "MailMessage": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        },
        "required": [
          "message"
        ],
        "additionalProperties": false
      },
      "MailUpdated": {
        "type": "object",
        "properties": {
          "updated": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "updated",
          "message"
        ],
        "additionalProperties": false
      },
      "ForgotPassword": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          }
        },
        "required": [
          "email"
        ],
        "additionalProperties": false
      },
      "ResetPassword": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "writeOnly": true
          },
          "newPassword": {
            "type": "string",
            "minLength": 12,
            "maxLength": 128,
            "writeOnly": true
          },
          "mfaCode": {
            "type": "string",
            "maxLength": 32,
            "writeOnly": true
          }
        },
        "required": [
          "token",
          "newPassword"
        ],
        "additionalProperties": false
      },
      "EmailChange": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          },
          "currentPassword": {
            "type": "string",
            "maxLength": 128,
            "writeOnly": true
          },
          "mfaCode": {
            "type": "string",
            "maxLength": 32,
            "writeOnly": true
          }
        },
        "required": [
          "email",
          "currentPassword"
        ],
        "additionalProperties": false
      },
      "EmailConfirmation": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "writeOnly": true
          }
        },
        "required": [
          "token"
        ],
        "additionalProperties": false
      },
      "MfaSessionVerification": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "maxLength": 32,
            "writeOnly": true
          }
        },
        "required": [
          "code"
        ],
        "additionalProperties": false
      },
      "MfaSessionVerified": {
        "type": "object",
        "properties": {
          "verified": {
            "type": "boolean"
          }
        },
        "required": [
          "verified"
        ],
        "additionalProperties": false
      },
      "MailSettings": {
        "type": "object",
        "properties": {
          "featureEnabled": {
            "type": "boolean"
          },
          "allowedHosts": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "revision": {
            "type": "integer"
          },
          "useGlobal": {
            "type": "boolean"
          },
          "globalAllowed": {
            "type": "boolean"
          },
          "host": {
            "type": "string"
          },
          "port": {
            "type": "integer"
          },
          "security": {
            "enum": [
              "TLS",
              "STARTTLS"
            ]
          },
          "fromEmail": {
            "type": "string"
          },
          "fromName": {
            "type": "string"
          },
          "credentialsPresent": {
            "type": "boolean"
          },
          "lastTestedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastErrorCode": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "featureEnabled",
          "allowedHosts",
          "enabled",
          "revision",
          "useGlobal",
          "globalAllowed",
          "host",
          "port",
          "security",
          "fromEmail",
          "fromName",
          "credentialsPresent",
          "lastTestedAt",
          "lastErrorCode"
        ],
        "additionalProperties": false
      },
      "MailSettingsUpdate": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "useGlobal": {
            "type": "boolean"
          },
          "host": {
            "type": "string"
          },
          "port": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          },
          "security": {
            "enum": [
              "TLS",
              "STARTTLS"
            ]
          },
          "username": {
            "type": "string",
            "maxLength": 254,
            "writeOnly": true
          },
          "password": {
            "type": "string",
            "maxLength": 2048,
            "writeOnly": true
          },
          "fromEmail": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          },
          "fromName": {
            "type": "string",
            "maxLength": 128
          }
        },
        "required": [
          "enabled",
          "revision",
          "useGlobal"
        ],
        "additionalProperties": false
      },
      "MailTest": {
        "type": "object",
        "properties": {
          "notificationId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "notificationId",
          "message"
        ],
        "additionalProperties": false
      },
      "MailLog": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "event": {
            "type": "string"
          },
          "recipientMasked": {
            "type": "string"
          },
          "status": {
            "enum": [
              "PENDING",
              "SENDING",
              "SENT",
              "FAILED",
              "UNKNOWN"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3
          },
          "failureCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "sentAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "requestId": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "event",
          "recipientMasked",
          "status",
          "attempts",
          "failureCode",
          "createdAt",
          "sentAt",
          "requestId"
        ],
        "additionalProperties": false
      },
      "AccountEvent": {
        "type": "object",
        "properties": {
          "specversion": {
            "const": "1.0"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "source": {
            "const": "nooriacs/account"
          },
          "time": {
            "type": "string",
            "format": "date-time"
          },
          "tenantId": {
            "type": "string",
            "format": "uuid"
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "requestId": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "properties": {
              "actorUserId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "resourceType": {
                "type": "string"
              },
              "result": {
                "type": "string"
              }
            },
            "required": [
              "actorUserId",
              "resourceType",
              "result"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "specversion",
          "id",
          "type",
          "source",
          "time",
          "tenantId",
          "subject",
          "requestId",
          "data"
        ],
        "additionalProperties": false
      },
      "TenantInvitationInput": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          },
          "role": {
            "enum": [
              "TENANT_ADMIN",
              "SUPERVISOR",
              "ATTENDANT",
              "TECHNICIAN",
              "READ_ONLY"
            ]
          },
          "displayName": {
            "type": "string",
            "minLength": 2,
            "maxLength": 128
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 40
          },
          "requireMfa": {
            "type": "boolean"
          }
        },
        "required": [
          "email",
          "role"
        ],
        "additionalProperties": false
      },
      "MailLogPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MailLog"
            }
          },
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "hasMore": {
            "type": "boolean"
          }
        },
        "required": [
          "items",
          "page",
          "hasMore"
        ],
        "additionalProperties": false
      },
      "AccountEventPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountEvent"
            }
          },
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "hasMore": {
            "type": "boolean"
          }
        },
        "required": [
          "items",
          "page",
          "hasMore"
        ],
        "additionalProperties": false
      },
      "TenantInvitation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "email",
          "role",
          "expires_at",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING"
            ]
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "TENANT_ADMIN",
              "SUPERVISOR",
              "ATTENDANT",
              "TECHNICIAN",
              "READ_ONLY"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TenantInvitationCreated": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "email",
          "role",
          "expires_at",
          "created_at",
          "inviteUrl",
          "delivery"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING"
            ]
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "TENANT_ADMIN",
              "SUPERVISOR",
              "ATTENDANT",
              "TECHNICIAN",
              "READ_ONLY"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "inviteUrl": {
            "type": "string",
            "format": "uri",
            "description": "Link secreto emitido uma única vez; não registrar em logs."
          },
          "delivery": {
            "type": "string",
            "enum": [
              "QUEUED",
              "UNAVAILABLE",
              "DISABLED"
            ]
          }
        }
      },
      "TenantInvitationPage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TenantInvitation"
            }
          }
        }
      },
      "TenantInvitationAccept": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "token",
          "displayName",
          "password"
        ],
        "properties": {
          "token": {
            "type": "string",
            "writeOnly": true,
            "minLength": 40,
            "maxLength": 128
          },
          "displayName": {
            "type": "string",
            "minLength": 2,
            "maxLength": 128
          },
          "password": {
            "type": "string",
            "writeOnly": true,
            "minLength": 12,
            "maxLength": 128
          }
        }
      },
      "TenantInvitationAccepted": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "accepted",
          "tenant",
          "email"
        ],
        "properties": {
          "accepted": {
            "const": true
          },
          "tenant": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          }
        }
      },
      "Revoked": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "revoked"
        ],
        "properties": {
          "revoked": {
            "const": true
          }
        }
      }
    }
  }
}
