{
    "openapi": "3.0.0",
    "info": {
        "title": "Fluxo Condominium API",
        "description": "API multi-tenant para gestão de condomínios. O tenant ativo é selecionado pelo claim JWT tenant_id ou pelo header X-Tenant-ID, sempre com validação de vínculo do usuário.",
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "/",
            "description": "Servidor atual"
        }
    ],
    "paths": {
        "/api/v1/access-logs": {
            "get": {
                "tags": [
                    "Access Logs"
                ],
                "summary": "Lista autorizações acessíveis ao usuário",
                "operationId": "7ada9aafe5aa09df4825c040afb4f768",
                "parameters": [
                    {
                        "name": "expected_date",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "visitante",
                                "prestador_servico",
                                "entrega"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Autorizações paginadas"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Access Logs"
                ],
                "summary": "Cria autorização de entrada sem check-in",
                "operationId": "c672a08dee80972c1d66116b8e3db372",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/AccessLogWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Autorização criada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/access-logs/today": {
            "get": {
                "tags": [
                    "Access Logs"
                ],
                "summary": "Lista autorizações previstas para hoje",
                "operationId": "744bf6510d96400360f15839a043608e",
                "responses": {
                    "200": {
                        "description": "Autorizações do dia"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/access-logs/{accessLog}": {
            "get": {
                "tags": [
                    "Access Logs"
                ],
                "summary": "Exibe autorização/registro acessível",
                "operationId": "405ec8f5f10cd96b16f499d05da5ebb3",
                "responses": {
                    "200": {
                        "description": "Registro de acesso"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Access Logs"
                ],
                "summary": "Cancela/arquiva autorização ainda não utilizada",
                "operationId": "68c18465164f2aeb59e76ea45997c74b",
                "responses": {
                    "204": {
                        "description": "Autorização arquivada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/access-logs/{accessLog}/check-in": {
            "patch": {
                "tags": [
                    "Access Logs"
                ],
                "summary": "Registra entrada pela Portaria",
                "operationId": "93a6d85714c7ef9c0a06ba5d53b980ee",
                "responses": {
                    "200": {
                        "description": "Check-in registrado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/access-logs/{accessLog}/check-out": {
            "patch": {
                "tags": [
                    "Access Logs"
                ],
                "summary": "Registra saída pela Portaria",
                "operationId": "eb338ec1fbdcd2fb98074fe2d09e70b4",
                "responses": {
                    "200": {
                        "description": "Check-out registrado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/announcements": {
            "get": {
                "tags": [
                    "Announcements"
                ],
                "summary": "Lista avisos visíveis ao usuário no tenant ativo",
                "operationId": "b02afaa4b0757c9fe2cb79bfdc60749e",
                "parameters": [
                    {
                        "name": "X-Tenant-ID",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    },
                    {
                        "name": "include_expired",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Avisos paginados"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Announcements"
                ],
                "summary": "Cria aviso com anexos opcionais",
                "operationId": "f649aacdbf1ef6f1ae12e532656bd2f7",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/AnnouncementWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Aviso criado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Announcement"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Falha de validação"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/announcements/{announcement}": {
            "get": {
                "tags": [
                    "Announcements"
                ],
                "summary": "Exibe aviso acessível ao usuário",
                "operationId": "c24f48dec04541aaa684b44bd5ace26c",
                "parameters": [
                    {
                        "name": "announcement",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Aviso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Announcement"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Aviso inexistente ou fora da audiência"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Announcements"
                ],
                "summary": "Arquiva um aviso por SoftDelete",
                "operationId": "fa0e62c75634923d058cf9e55faf32df",
                "responses": {
                    "204": {
                        "description": "Aviso arquivado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "patch": {
                "tags": [
                    "Announcements"
                ],
                "summary": "Atualiza aviso e permite adicionar anexos",
                "operationId": "5b1720f45e47d55c387b9c972cf99d00",
                "parameters": [
                    {
                        "name": "announcement",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/AnnouncementWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Aviso atualizado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/auth/login": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Autentica e emite JWT contextualizado por tenant",
                "operationId": "a7997e7c1e3bfed64d4e56de82415931",
                "parameters": [
                    {
                        "name": "X-Tenant-ID",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/LoginRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Autenticado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TokenResponse"
                                }
                            }
                        }
                    },
                    "202": {
                        "description": "Senha válida; 2FA obrigatório para concluir o login",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TwoFactorChallengeResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Credenciais inválidas"
                    },
                    "403": {
                        "description": "Tenant não pertence ao usuário"
                    },
                    "409": {
                        "description": "Usuário possui múltiplos tenants; selecione um"
                    }
                }
            }
        },
        "/api/v1/auth/me": {
            "get": {
                "tags": [
                    "Auth"
                ],
                "summary": "Retorna a identidade global e os condomínios disponíveis",
                "operationId": "37d33f0281f67d31d05b4c45eea0143b",
                "responses": {
                    "200": {
                        "description": "Usuário autenticado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/auth/switch-tenant": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Troca o tenant ativo, invalida o JWT atual e emite um novo token",
                "operationId": "3341996a0cb98227f23d02ecc2356d7a",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "tenant_id": {
                                        "type": "string",
                                        "format": "ulid"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Tenant alterado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TokenResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Tenant não acessível"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/auth/refresh": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Renova o JWT mantendo os claims atuais",
                "operationId": "c42c3cd7fd7fe0dbd5bcc42962059e90",
                "responses": {
                    "200": {
                        "description": "Token renovado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/auth/logout": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Invalida o JWT atual",
                "operationId": "f6b8957b4c0b25636613a9f0512a8ba9",
                "responses": {
                    "204": {
                        "description": "Sessão encerrada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/blocks": {
            "get": {
                "tags": [
                    "Blocks"
                ],
                "summary": "Lista blocos do condomínio ativo",
                "operationId": "9138098dbe3a41b5170742d5cc0de4e7",
                "parameters": [
                    {
                        "name": "X-Tenant-ID",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Lista paginada de blocos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Blocks"
                ],
                "summary": "Cria um bloco ou torre",
                "operationId": "f6504ad4b3f52cc7a933842de73c7de7",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/BlockWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Bloco criado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Block"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Falha de validação"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/blocks/{block}": {
            "get": {
                "tags": [
                    "Blocks"
                ],
                "summary": "Exibe um bloco do condomínio ativo",
                "operationId": "ed54e9db79aedae68f6d665685a41fbc",
                "parameters": [
                    {
                        "name": "block",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Bloco encontrado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Block"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Bloco inexistente ou fora do tenant ativo"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Blocks"
                ],
                "summary": "Arquiva um bloco e mantém suas unidades sem subdivisão",
                "operationId": "7a19157c9bbdab74026490c2da0187bc",
                "parameters": [
                    {
                        "name": "block",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Bloco arquivado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "patch": {
                "tags": [
                    "Blocks"
                ],
                "summary": "Atualiza um bloco",
                "operationId": "53ad518f6ec8903029bdeff81585528b",
                "parameters": [
                    {
                        "name": "block",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/BlockWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Bloco atualizado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/common-areas": {
            "get": {
                "tags": [
                    "Common Areas"
                ],
                "summary": "Lista áreas comuns do condomínio ativo",
                "operationId": "809b62bcc29407145d331df8fea3e820",
                "responses": {
                    "200": {
                        "description": "Lista paginada de áreas comuns"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Common Areas"
                ],
                "summary": "Cria uma área comum",
                "operationId": "c48c4fef0ce00357f27a009c0b68b612",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CommonAreaWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Área comum criada",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CommonArea"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Falha de validação"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/common-areas/{commonArea}": {
            "get": {
                "tags": [
                    "Common Areas"
                ],
                "summary": "Exibe uma área comum",
                "operationId": "58f637871802385758fbb37d14f649a4",
                "parameters": [
                    {
                        "name": "commonArea",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Área comum encontrada",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CommonArea"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Área inexistente ou fora do tenant ativo"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Common Areas"
                ],
                "summary": "Arquiva uma área comum",
                "operationId": "7dd372aa2c13ec426c15d59fc40e5756",
                "parameters": [
                    {
                        "name": "commonArea",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Área comum arquivada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "patch": {
                "tags": [
                    "Common Areas"
                ],
                "summary": "Atualiza uma área comum",
                "operationId": "07b5e94d9ed8f40aa7e95df71dccaac1",
                "parameters": [
                    {
                        "name": "commonArea",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CommonAreaWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Área comum atualizada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/document-categories": {
            "get": {
                "tags": [
                    "Document Categories"
                ],
                "summary": "Lista categorias de documentos do tenant",
                "operationId": "17a14e81df68bc33d7d427cc64cc686d",
                "responses": {
                    "200": {
                        "description": "Categorias paginadas"
                    },
                    "403": {
                        "description": "Sem permissão"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Document Categories"
                ],
                "summary": "Cria categoria de documentos",
                "operationId": "76f245069fcaab39965006dd5b6040d3",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "example": "Atas"
                                    },
                                    "description": {
                                        "type": "string",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Categoria criada"
                    },
                    "403": {
                        "description": "Sem permissão"
                    },
                    "422": {
                        "description": "Validação"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/document-categories/{documentCategory}": {
            "get": {
                "tags": [
                    "Document Categories"
                ],
                "summary": "Exibe categoria",
                "operationId": "d3b06444c9ae8b7809970a7182180607",
                "parameters": [
                    {
                        "name": "documentCategory",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Categoria"
                    },
                    "404": {
                        "description": "Não encontrada no tenant"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Document Categories"
                ],
                "summary": "Arquiva categoria vazia",
                "operationId": "e19b0144a5c5f2cd7b8eeb4f78f4e47a",
                "responses": {
                    "204": {
                        "description": "Categoria arquivada"
                    },
                    "422": {
                        "description": "Categoria possui documentos ativos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "patch": {
                "tags": [
                    "Document Categories"
                ],
                "summary": "Atualiza categoria",
                "operationId": "097c00d64577c38fde2bd5753e14f194",
                "parameters": [
                    {
                        "name": "documentCategory",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Categoria atualizada"
                    },
                    "403": {
                        "description": "Sem permissão"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/documents": {
            "get": {
                "tags": [
                    "Documents"
                ],
                "summary": "Lista documentos acessíveis no tenant",
                "operationId": "a3f72d0f1040078409cdb8a1ee21d40b",
                "parameters": [
                    {
                        "name": "document_category_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Documentos paginados"
                    },
                    "403": {
                        "description": "Sem permissão"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Documents"
                ],
                "summary": "Envia documento privado para o tenant",
                "operationId": "5c98d63549356cb0e0900901fd142d56",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "title",
                                    "document_category_id",
                                    "file"
                                ],
                                "properties": {
                                    "title": {
                                        "type": "string"
                                    },
                                    "description": {
                                        "type": "string",
                                        "nullable": true
                                    },
                                    "document_category_id": {
                                        "type": "string",
                                        "format": "ulid"
                                    },
                                    "file": {
                                        "type": "string",
                                        "format": "binary"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Documento criado"
                    },
                    "403": {
                        "description": "Sem permissão"
                    },
                    "422": {
                        "description": "Validação"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/documents/{document}": {
            "get": {
                "tags": [
                    "Documents"
                ],
                "summary": "Exibe metadados de documento",
                "operationId": "c5241de6309b57267ad914888f95ca9a",
                "parameters": [
                    {
                        "name": "document",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Documento"
                    },
                    "404": {
                        "description": "Não encontrado no tenant"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Documents"
                ],
                "summary": "Arquiva documento por SoftDelete",
                "operationId": "867bc0947afcbba0319db67b27716bea",
                "responses": {
                    "204": {
                        "description": "Documento arquivado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "patch": {
                "tags": [
                    "Documents"
                ],
                "summary": "Atualiza metadados ou substitui o arquivo",
                "operationId": "ddcaa80c86f61a9ae2fe231479de7206",
                "parameters": [
                    {
                        "name": "document",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Documento atualizado"
                    },
                    "403": {
                        "description": "Sem permissão"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/documents/{document}/download": {
            "get": {
                "tags": [
                    "Documents"
                ],
                "summary": "Baixa documento após Policy de leitura",
                "operationId": "2269b642a56d2b65df5ba7eea5bf721b",
                "parameters": [
                    {
                        "name": "document",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Arquivo"
                    },
                    "403": {
                        "description": "Sem permissão"
                    },
                    "404": {
                        "description": "Arquivo ou registro não encontrado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/financial-reports": {
            "get": {
                "tags": [
                    "Financial Reports"
                ],
                "summary": "Lista balancetes acessíveis no tenant",
                "operationId": "4e839ef117d5e3a4a6d1e73c11e11e13",
                "parameters": [
                    {
                        "name": "reference_year",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "reference_month",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "maximum": 12,
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Relatórios paginados"
                    },
                    "403": {
                        "description": "Sem permissão"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Financial Reports"
                ],
                "summary": "Envia balancete/prestação de contas privada",
                "operationId": "921da6c6047b7202ba61e7f6b299a058",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "title",
                                    "reference_month",
                                    "reference_year",
                                    "type",
                                    "file"
                                ],
                                "properties": {
                                    "title": {
                                        "type": "string"
                                    },
                                    "reference_month": {
                                        "type": "integer",
                                        "maximum": 12,
                                        "minimum": 1
                                    },
                                    "reference_year": {
                                        "type": "integer"
                                    },
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "balancete",
                                            "prestacao_contas",
                                            "comprovantes",
                                            "outros"
                                        ]
                                    },
                                    "file": {
                                        "type": "string",
                                        "format": "binary"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Relatório criado"
                    },
                    "403": {
                        "description": "Sem permissão"
                    },
                    "422": {
                        "description": "Validação"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/financial-reports/{financialReport}": {
            "get": {
                "tags": [
                    "Financial Reports"
                ],
                "summary": "Exibe relatório financeiro",
                "operationId": "6644d0f58953990b3a9388efff44c883",
                "parameters": [
                    {
                        "name": "financialReport",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Relatório"
                    },
                    "404": {
                        "description": "Não encontrado no tenant"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Financial Reports"
                ],
                "summary": "Arquiva relatório por SoftDelete",
                "operationId": "78c3c7576b8013c74e45b11f32a8bbd2",
                "responses": {
                    "204": {
                        "description": "Relatório arquivado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "patch": {
                "tags": [
                    "Financial Reports"
                ],
                "summary": "Atualiza relatório ou substitui arquivo",
                "operationId": "1160d70f12b2a2b8df89fcf36cb7c0ac",
                "parameters": [
                    {
                        "name": "financialReport",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Relatório atualizado"
                    },
                    "403": {
                        "description": "Sem permissão"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/financial-reports/{financialReport}/download": {
            "get": {
                "tags": [
                    "Financial Reports"
                ],
                "summary": "Baixa relatório após Policy financeira",
                "operationId": "72288ab4e0952dbf25ab4d76bdfc3de8",
                "parameters": [
                    {
                        "name": "financialReport",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Arquivo"
                    },
                    "403": {
                        "description": "Sem permissão"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/reservations": {
            "get": {
                "tags": [
                    "Reservations"
                ],
                "summary": "Lista reservas acessíveis ao usuário",
                "operationId": "1fea0748719a5cbced2b611e67240778",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "pendente",
                                "aprovada",
                                "rejeitada",
                                "cancelada"
                            ]
                        }
                    },
                    {
                        "name": "date",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "common_area_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Reservas paginadas"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Reservations"
                ],
                "summary": "Solicita uma reserva",
                "operationId": "8a099249c009bb79e91d5ded3b235096",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ReservationWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Reserva criada"
                    },
                    "422": {
                        "description": "Horário indisponível ou dados inválidos"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/reservations/{reservation}": {
            "get": {
                "tags": [
                    "Reservations"
                ],
                "summary": "Exibe uma reserva acessível",
                "operationId": "15165381ba7907842404d8e363a2a98c",
                "responses": {
                    "200": {
                        "description": "Reserva"
                    },
                    "404": {
                        "description": "Reserva inexistente ou não acessível"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Reservations"
                ],
                "summary": "Arquiva uma reserva por SoftDelete; exclusivo para gestores",
                "operationId": "3e422747b7a83b28311436004de796a6",
                "responses": {
                    "204": {
                        "description": "Reserva arquivada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "patch": {
                "tags": [
                    "Reservations"
                ],
                "summary": "Edita dados da reserva; morador somente enquanto pendente",
                "operationId": "26213f9d0dc362e8ac3610ec9b82564c",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ReservationWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Reserva atualizada"
                    },
                    "422": {
                        "description": "Conflito de horário"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/reservations/{reservation}/status": {
            "patch": {
                "tags": [
                    "Reservations"
                ],
                "summary": "Aprova ou rejeita uma reserva",
                "operationId": "a31201ab67c3cd2e5dfe8bd91380be5b",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "pendente",
                                            "aprovada",
                                            "rejeitada",
                                            "cancelada"
                                        ]
                                    },
                                    "reason_rejection": {
                                        "type": "string",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Status atualizado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/reservations/{reservation}/cancel": {
            "patch": {
                "tags": [
                    "Reservations"
                ],
                "summary": "Cancela uma reserva própria ou administrativa",
                "operationId": "da1d8909a140ec0d165f06e466f561a5",
                "responses": {
                    "200": {
                        "description": "Reserva cancelada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/tenants": {
            "get": {
                "tags": [
                    "Tenants"
                ],
                "summary": "Lista os condomínios do usuário autenticado",
                "operationId": "211e3c0b41e29db47adb477222c4d8f9",
                "responses": {
                    "200": {
                        "description": "Lista paginada de condomínios"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Tenants"
                ],
                "summary": "Cria um condomínio e torna o usuário atual Super Admin dele",
                "operationId": "adc30b034c7d5a398d1a217f0ae4bf5a",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/TenantWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Condomínio criado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Tenant"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Falha de validação"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/tenants/{tenant}": {
            "get": {
                "tags": [
                    "Tenants"
                ],
                "summary": "Exibe o condomínio ativo",
                "operationId": "83fc29069c4093c7ee654c4e54070aa9",
                "parameters": [
                    {
                        "name": "tenant",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    },
                    {
                        "name": "X-Tenant-ID",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Condomínio",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Tenant"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Condomínio não acessível"
                    },
                    "404": {
                        "description": "Condomínio não encontrado no contexto atual"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Tenants"
                ],
                "summary": "Atualiza o condomínio ativo",
                "operationId": "982c028ae58fafb5c82a0161929f4deb",
                "parameters": [
                    {
                        "name": "tenant",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    },
                    {
                        "name": "X-Tenant-ID",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/TenantWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Condomínio atualizado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Tenant"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Sem permissão"
                    },
                    "422": {
                        "description": "Falha de validação"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Tenants"
                ],
                "summary": "Desativa logicamente um condomínio",
                "operationId": "1c5519547b0c8081cf0965012a4c0bf2",
                "parameters": [
                    {
                        "name": "tenant",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    },
                    {
                        "name": "X-Tenant-ID",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Condomínio removido por SoftDelete"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "patch": {
                "tags": [
                    "Tenants"
                ],
                "summary": "Atualiza parcialmente o condomínio ativo",
                "operationId": "9601ae8e62c530555925eb96721cc003",
                "parameters": [
                    {
                        "name": "tenant",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    },
                    {
                        "name": "X-Tenant-ID",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/TenantWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Condomínio atualizado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/tickets": {
            "get": {
                "tags": [
                    "Tickets"
                ],
                "summary": "Lista chamados; moradores veem somente os próprios e gestores veem todo o tenant",
                "operationId": "63410598a093cab144b5580f73c75839",
                "responses": {
                    "200": {
                        "description": "Chamados paginados"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Tickets"
                ],
                "summary": "Abre um chamado para uma unidade do tenant ativo",
                "operationId": "64c186f3265e66b70e42d675d1821d84",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/TicketWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Chamado criado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Ticket"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Falha de validação ou unidade não vinculada ao morador"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/tickets/{ticket}": {
            "get": {
                "tags": [
                    "Tickets"
                ],
                "summary": "Exibe um chamado e sua thread",
                "operationId": "e2613cc563dfe0a0af38c6d29f96ae93",
                "parameters": [
                    {
                        "name": "ticket",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Chamado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Ticket"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Chamado inexistente ou não acessível ao usuário"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Tickets"
                ],
                "summary": "Arquiva um chamado por SoftDelete; exclusivo para gestores",
                "operationId": "45e1430ea3ebfaf9be45563dae6802f0",
                "responses": {
                    "204": {
                        "description": "Chamado arquivado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/tickets/{ticket}/status": {
            "patch": {
                "tags": [
                    "Tickets"
                ],
                "summary": "Atualiza o status do chamado; exclusivo para gestores",
                "operationId": "0d91fc2b4cd2555cb22e0788b2dcde63",
                "parameters": [
                    {
                        "name": "ticket",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "aberto",
                                            "em_andamento",
                                            "resolvido",
                                            "fechado",
                                            "cancelado"
                                        ]
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Status atualizado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/tickets/{ticket}/messages": {
            "get": {
                "tags": [
                    "Ticket Messages"
                ],
                "summary": "Lista a conversa do chamado acessível ao usuário",
                "operationId": "b7861bcdad0a9fef5a8dd1023a4c5c20",
                "parameters": [
                    {
                        "name": "ticket",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Mensagens do chamado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Ticket Messages"
                ],
                "summary": "Adiciona uma mensagem à thread usando a identidade autenticada",
                "operationId": "3edd5614b2768c5294a22d1feb33226c",
                "parameters": [
                    {
                        "name": "ticket",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/TicketMessageWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Mensagem criada",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TicketMessage"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Chamado não acessível"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/auth/two-factor/status": {
            "get": {
                "tags": [
                    "Two-Factor Authentication"
                ],
                "summary": "Retorna o status global do 2FA do usuário autenticado",
                "operationId": "dd7a5ef9e8ef02f058083e4c789ebfc5",
                "responses": {
                    "200": {
                        "description": "Status do 2FA",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TwoFactorStatus"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/auth/two-factor/setup": {
            "post": {
                "tags": [
                    "Two-Factor Authentication"
                ],
                "summary": "Inicia ou reinicia a configuração do TOTP",
                "operationId": "d58df922df9f863845f79e8b2138d280",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "current_password"
                                ],
                                "properties": {
                                    "current_password": {
                                        "type": "string",
                                        "format": "password"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Segredo e URI de provisionamento",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TwoFactorSetupResponse"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "2FA já está ativo"
                    },
                    "422": {
                        "description": "Senha atual inválida"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/auth/two-factor/confirm": {
            "post": {
                "tags": [
                    "Two-Factor Authentication"
                ],
                "summary": "Confirma o primeiro código TOTP e ativa o 2FA",
                "operationId": "b092851093d8d0930f0a6614c87e820d",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "code"
                                ],
                                "properties": {
                                    "code": {
                                        "type": "string",
                                        "pattern": "^\\d{6}$"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "2FA ativado e recovery codes emitidos uma única vez"
                    },
                    "401": {
                        "description": "Código TOTP inválido"
                    },
                    "409": {
                        "description": "Setup inexistente ou 2FA já ativo"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/auth/two-factor/recovery-codes": {
            "post": {
                "tags": [
                    "Two-Factor Authentication"
                ],
                "summary": "Revoga os recovery codes existentes e gera um novo conjunto",
                "operationId": "020b0f9c21fc66d3af43ff69beb157c2",
                "responses": {
                    "200": {
                        "description": "Novos recovery codes"
                    },
                    "401": {
                        "description": "Segundo fator inválido"
                    },
                    "409": {
                        "description": "2FA não está ativo"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/auth/two-factor": {
            "delete": {
                "tags": [
                    "Two-Factor Authentication"
                ],
                "summary": "Desativa o 2FA ou cancela um setup ainda não confirmado",
                "operationId": "305e3a52510fa0215234aa3fc2d64c5a",
                "responses": {
                    "204": {
                        "description": "2FA desativado"
                    },
                    "401": {
                        "description": "Segundo fator inválido"
                    },
                    "422": {
                        "description": "Segundo fator obrigatório para desativar 2FA ativo"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/auth/two-factor/challenge": {
            "post": {
                "tags": [
                    "Two-Factor Authentication"
                ],
                "summary": "Conclui um login pendente de 2FA e emite o JWT normal",
                "operationId": "e843da8e35edd5809c2b78f6627ef736",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/TwoFactorChallengeRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "2FA validado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TokenResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Challenge expirado ou segundo fator inválido"
                    },
                    "429": {
                        "description": "Challenge já está sendo processado"
                    }
                }
            }
        },
        "/api/v1/units": {
            "get": {
                "tags": [
                    "Units"
                ],
                "summary": "Lista unidades do condomínio ativo",
                "operationId": "96e0cb05ce298f2cc394b8ef9f845448",
                "responses": {
                    "200": {
                        "description": "Lista paginada de unidades"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Units"
                ],
                "summary": "Cria uma unidade; block_id é opcional",
                "operationId": "dd89f9b6436b7339046452af38a85b4a",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/UnitWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Unidade criada",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unit"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Falha de validação, inclusive bloco de outro tenant"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/units/{unit}": {
            "get": {
                "tags": [
                    "Units"
                ],
                "summary": "Exibe uma unidade do condomínio ativo",
                "operationId": "c04d30481b354639dc52cbbdd138d75f",
                "parameters": [
                    {
                        "name": "unit",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Unidade encontrada",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unit"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unidade inexistente ou fora do tenant ativo"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Units"
                ],
                "summary": "Arquiva uma unidade e encerra vínculos ativos sem apagar o histórico",
                "operationId": "55697380ebb6c4b3b8aad7a2bc2f43c2",
                "parameters": [
                    {
                        "name": "unit",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Unidade arquivada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "patch": {
                "tags": [
                    "Units"
                ],
                "summary": "Atualiza uma unidade",
                "operationId": "129b12c40cd0ad0dac1c88cf4c1d7a2d",
                "parameters": [
                    {
                        "name": "unit",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/UnitWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Unidade atualizada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/units/{unit}/occupants": {
            "get": {
                "tags": [
                    "Unit Occupancies"
                ],
                "summary": "Lista vínculos históricos da unidade",
                "operationId": "8fb6335ea5157bc723cf83f4856a927e",
                "parameters": [
                    {
                        "name": "unit",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Histórico de ocupação"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Unit Occupancies"
                ],
                "summary": "Vincula proprietário, inquilino ou dependente à unidade",
                "operationId": "779adde4910524d9bae249a58e483e08",
                "parameters": [
                    {
                        "name": "unit",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/UnitOccupancyWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Vínculo criado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/UnitOccupancy"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Usuário fora do tenant ou vínculo ativo duplicado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/units/{unit}/occupants/{occupancy}/deactivate": {
            "patch": {
                "tags": [
                    "Unit Occupancies"
                ],
                "summary": "Encerra um vínculo sem apagar seu histórico",
                "operationId": "4e3cf9ca1a38e321915c8d13d2f6bfe2",
                "parameters": [
                    {
                        "name": "unit",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    },
                    {
                        "name": "occupancy",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Vínculo inativado e preservado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/UnitOccupancy"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Vínculo inexistente, de outra unidade ou outro tenant"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/users": {
            "get": {
                "tags": [
                    "Users"
                ],
                "summary": "Lista somente usuários do condomínio ativo",
                "operationId": "12e989554c281d650dff75443acabf54",
                "parameters": [
                    {
                        "name": "X-Tenant-ID",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Lista paginada"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Users"
                ],
                "summary": "Cria um usuário global e vincula ao condomínio ativo",
                "operationId": "64da9b5a20fa4f20e947ed61b2bbb6da",
                "parameters": [
                    {
                        "name": "X-Tenant-ID",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/UserWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Usuário criado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/User"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Sem permissão"
                    },
                    "422": {
                        "description": "Falha de validação"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/users/{user}": {
            "get": {
                "tags": [
                    "Users"
                ],
                "summary": "Exibe um usuário do condomínio ativo",
                "operationId": "919fd317e275a070bcadcf4874123e45",
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    },
                    {
                        "name": "X-Tenant-ID",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Usuário",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/User"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Usuário fora do tenant atual ou inexistente"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Users"
                ],
                "summary": "Atualiza os dados globais do usuário vinculado ao tenant atual",
                "operationId": "df2f483fc27e7b42e89953bad0cf1485",
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    },
                    {
                        "name": "X-Tenant-ID",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/UserWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Usuário atualizado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Users"
                ],
                "summary": "Remove o usuário do tenant atual e aplica SoftDelete global somente se ele não possuir outros vínculos",
                "operationId": "17c42665206652a0fd309e2f348f97ed",
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    },
                    {
                        "name": "X-Tenant-ID",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Vínculo removido"
                    },
                    "422": {
                        "description": "O usuário atual não pode remover o próprio vínculo"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "patch": {
                "tags": [
                    "Users"
                ],
                "summary": "Atualiza parcialmente os dados do usuário",
                "operationId": "31318f75f8ec03dcf063a1333fde6b01",
                "parameters": [
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    },
                    {
                        "name": "X-Tenant-ID",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "ulid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/UserWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Usuário atualizado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/visitors": {
            "get": {
                "tags": [
                    "Visitors"
                ],
                "summary": "Lista visitantes do tenant ativo",
                "operationId": "69155c5bab263bc9fd2daed5174e1928",
                "parameters": [
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Visitantes paginados"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Visitors"
                ],
                "summary": "Cadastra visitante/prestador com foto opcional",
                "operationId": "be0c29f3162ed718637d141a6e7a7939",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/VisitorWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Visitante criado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/v1/visitors/{visitor}": {
            "get": {
                "tags": [
                    "Visitors"
                ],
                "summary": "Exibe visitante do tenant ativo",
                "operationId": "ba7b7a34c152fa7f04c5dc3ece91e127",
                "responses": {
                    "200": {
                        "description": "Visitante"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Visitors"
                ],
                "summary": "Arquiva visitante por SoftDelete",
                "operationId": "7fad2f76673a4f72c0c387b182e5b82e",
                "responses": {
                    "204": {
                        "description": "Visitante arquivado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "patch": {
                "tags": [
                    "Visitors"
                ],
                "summary": "Atualiza visitante; gestores/Portaria",
                "operationId": "e755df7cc8164bf5e30ce6a8c96e4222",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "$ref": "#/components/schemas/VisitorWrite"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Visitante atualizado"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "AnnouncementAttachment": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "original_name": {
                        "type": "string"
                    },
                    "mime_type": {
                        "type": "string"
                    },
                    "size": {
                        "type": "integer"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    }
                },
                "type": "object"
            },
            "Announcement": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "title": {
                        "type": "string"
                    },
                    "content": {
                        "description": "HTML rico sanitizado, limitado a tags de formatação sem atributos",
                        "type": "string"
                    },
                    "expires_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "is_expired": {
                        "type": "boolean"
                    },
                    "is_pinned": {
                        "type": "boolean"
                    },
                    "block": {
                        "type": "object",
                        "nullable": true
                    },
                    "attachments": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/AnnouncementAttachment"
                        }
                    }
                },
                "type": "object"
            },
            "AnnouncementWrite": {
                "required": [
                    "title",
                    "content"
                ],
                "properties": {
                    "title": {
                        "type": "string",
                        "maxLength": 180
                    },
                    "content": {
                        "type": "string",
                        "maxLength": 50000
                    },
                    "expires_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "is_pinned": {
                        "type": "boolean"
                    },
                    "block_id": {
                        "type": "string",
                        "format": "ulid",
                        "nullable": true
                    },
                    "attachments[]": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "format": "binary"
                        },
                        "maxItems": 10
                    }
                },
                "type": "object"
            },
            "TicketAttachment": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "original_name": {
                        "type": "string"
                    },
                    "mime_type": {
                        "type": "string",
                        "example": "image/webp"
                    },
                    "size": {
                        "type": "integer"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    }
                },
                "type": "object"
            },
            "TicketMessage": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "message": {
                        "type": "string"
                    },
                    "user": {
                        "type": "object"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                },
                "type": "object"
            },
            "TicketMessageWrite": {
                "required": [
                    "message"
                ],
                "properties": {
                    "message": {
                        "type": "string",
                        "maxLength": 10000
                    }
                },
                "type": "object"
            },
            "Ticket": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "subject": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "category": {
                        "type": "string",
                        "enum": [
                            "manutencao",
                            "reclamacao",
                            "sugestao",
                            "duvida",
                            "outros"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "aberto",
                            "em_andamento",
                            "resolvido",
                            "fechado",
                            "cancelado"
                        ]
                    },
                    "opened_by": {
                        "type": "object"
                    },
                    "unit": {
                        "type": "object"
                    },
                    "common_area": {
                        "type": "object",
                        "nullable": true
                    },
                    "attachments": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/TicketAttachment"
                        }
                    },
                    "messages": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/TicketMessage"
                        }
                    }
                },
                "type": "object"
            },
            "TicketWrite": {
                "required": [
                    "subject",
                    "description",
                    "category",
                    "unit_id"
                ],
                "properties": {
                    "subject": {
                        "type": "string",
                        "maxLength": 180
                    },
                    "description": {
                        "type": "string",
                        "maxLength": 10000
                    },
                    "category": {
                        "type": "string",
                        "enum": [
                            "manutencao",
                            "reclamacao",
                            "sugestao",
                            "duvida",
                            "outros"
                        ]
                    },
                    "unit_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "common_area_id": {
                        "type": "string",
                        "format": "ulid",
                        "nullable": true
                    },
                    "images[]": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "format": "binary"
                        },
                        "maxItems": 5
                    }
                },
                "type": "object"
            },
            "LoginRequest": {
                "required": [
                    "email",
                    "password"
                ],
                "properties": {
                    "email": {
                        "type": "string",
                        "format": "email",
                        "example": "admin@condominio.com.br"
                    },
                    "password": {
                        "type": "string",
                        "format": "password",
                        "example": "SenhaForte123"
                    }
                },
                "type": "object"
            },
            "TokenResponse": {
                "properties": {
                    "access_token": {
                        "type": "string"
                    },
                    "token_type": {
                        "type": "string",
                        "example": "bearer"
                    },
                    "expires_in": {
                        "type": "integer",
                        "example": 3600
                    },
                    "active_tenant": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Tenant"
                            }
                        ],
                        "nullable": true
                    },
                    "user": {
                        "$ref": "#/components/schemas/User"
                    }
                },
                "type": "object"
            },
            "Address": {
                "properties": {
                    "street": {
                        "type": "string",
                        "nullable": true
                    },
                    "number": {
                        "type": "string",
                        "nullable": true
                    },
                    "complement": {
                        "type": "string",
                        "nullable": true
                    },
                    "neighborhood": {
                        "type": "string",
                        "nullable": true
                    },
                    "city": {
                        "type": "string",
                        "nullable": true
                    },
                    "state": {
                        "type": "string",
                        "nullable": true
                    },
                    "postal_code": {
                        "type": "string",
                        "nullable": true
                    },
                    "country": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "Tenant": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "cnpj": {
                        "type": "string",
                        "example": "11222333000181"
                    },
                    "corporate_name": {
                        "type": "string"
                    },
                    "trade_name": {
                        "type": "string"
                    },
                    "state_registration": {
                        "type": "string",
                        "nullable": true
                    },
                    "municipal_registration": {
                        "type": "string",
                        "nullable": true
                    },
                    "email": {
                        "type": "string",
                        "format": "email",
                        "nullable": true
                    },
                    "phone": {
                        "type": "string",
                        "nullable": true
                    },
                    "website": {
                        "type": "string",
                        "format": "uri",
                        "nullable": true
                    },
                    "address": {
                        "$ref": "#/components/schemas/Address"
                    },
                    "units_count": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "logo_url": {
                        "type": "string",
                        "format": "uri",
                        "nullable": true
                    },
                    "timezone": {
                        "type": "string",
                        "example": "America/Sao_Paulo"
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "settings": {
                        "type": "object",
                        "nullable": true
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                },
                "type": "object"
            },
            "TenantWrite": {
                "required": [
                    "cnpj",
                    "corporate_name",
                    "trade_name",
                    "address_street",
                    "address_number",
                    "address_neighborhood",
                    "address_city",
                    "address_state",
                    "address_postal_code",
                    "units_count"
                ],
                "properties": {
                    "cnpj": {
                        "type": "string",
                        "example": "11222333000181"
                    },
                    "corporate_name": {
                        "type": "string"
                    },
                    "trade_name": {
                        "type": "string"
                    },
                    "state_registration": {
                        "type": "string",
                        "nullable": true
                    },
                    "municipal_registration": {
                        "type": "string",
                        "nullable": true
                    },
                    "email": {
                        "type": "string",
                        "format": "email",
                        "nullable": true
                    },
                    "phone": {
                        "type": "string",
                        "nullable": true
                    },
                    "website": {
                        "type": "string",
                        "format": "uri",
                        "nullable": true
                    },
                    "address_street": {
                        "type": "string"
                    },
                    "address_number": {
                        "type": "string"
                    },
                    "address_complement": {
                        "type": "string",
                        "nullable": true
                    },
                    "address_neighborhood": {
                        "type": "string"
                    },
                    "address_city": {
                        "type": "string"
                    },
                    "address_state": {
                        "type": "string",
                        "maxLength": 2,
                        "minLength": 2
                    },
                    "address_postal_code": {
                        "type": "string",
                        "maxLength": 8,
                        "minLength": 8
                    },
                    "address_country": {
                        "type": "string",
                        "default": "BR"
                    },
                    "units_count": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "timezone": {
                        "type": "string",
                        "nullable": true
                    },
                    "is_active": {
                        "type": "boolean",
                        "nullable": true
                    },
                    "settings": {
                        "type": "object",
                        "nullable": true
                    },
                    "logo": {
                        "type": "string",
                        "format": "binary",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "User": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "name": {
                        "type": "string"
                    },
                    "cpf": {
                        "type": "string",
                        "example": "52998224725"
                    },
                    "email": {
                        "type": "string",
                        "format": "email"
                    },
                    "phone": {
                        "type": "string",
                        "nullable": true
                    },
                    "mobile_phone": {
                        "type": "string",
                        "nullable": true
                    },
                    "birth_date": {
                        "type": "string",
                        "format": "date",
                        "nullable": true
                    },
                    "rg": {
                        "type": "string",
                        "nullable": true
                    },
                    "rg_issuing_authority": {
                        "type": "string",
                        "nullable": true
                    },
                    "address": {
                        "$ref": "#/components/schemas/Address"
                    },
                    "avatar_url": {
                        "type": "string",
                        "format": "uri",
                        "nullable": true
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "two_factor_enabled": {
                        "type": "boolean"
                    },
                    "roles": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                },
                "type": "object"
            },
            "UserWrite": {
                "required": [
                    "name",
                    "cpf",
                    "email",
                    "password"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "cpf": {
                        "type": "string",
                        "example": "52998224725"
                    },
                    "email": {
                        "type": "string",
                        "format": "email"
                    },
                    "password": {
                        "type": "string",
                        "format": "password",
                        "minLength": 12
                    },
                    "password_confirmation": {
                        "type": "string",
                        "format": "password"
                    },
                    "phone": {
                        "type": "string",
                        "nullable": true
                    },
                    "mobile_phone": {
                        "type": "string",
                        "nullable": true
                    },
                    "birth_date": {
                        "type": "string",
                        "format": "date",
                        "nullable": true
                    },
                    "rg": {
                        "type": "string",
                        "nullable": true
                    },
                    "rg_issuing_authority": {
                        "type": "string",
                        "nullable": true
                    },
                    "address_street": {
                        "type": "string",
                        "nullable": true
                    },
                    "address_number": {
                        "type": "string",
                        "nullable": true
                    },
                    "address_complement": {
                        "type": "string",
                        "nullable": true
                    },
                    "address_neighborhood": {
                        "type": "string",
                        "nullable": true
                    },
                    "address_city": {
                        "type": "string",
                        "nullable": true
                    },
                    "address_state": {
                        "type": "string",
                        "nullable": true
                    },
                    "address_postal_code": {
                        "type": "string",
                        "nullable": true
                    },
                    "address_country": {
                        "type": "string",
                        "nullable": true
                    },
                    "is_active": {
                        "type": "boolean",
                        "nullable": true
                    },
                    "role": {
                        "type": "string",
                        "nullable": true,
                        "enum": [
                            "Administrador",
                            "Síndico",
                            "Condômino",
                            "Portaria"
                        ]
                    },
                    "avatar": {
                        "type": "string",
                        "format": "binary",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "Reservation": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "date": {
                        "type": "string",
                        "format": "date"
                    },
                    "start_time": {
                        "type": "string",
                        "example": "10:00"
                    },
                    "end_time": {
                        "type": "string",
                        "example": "12:00"
                    },
                    "guest_count": {
                        "type": "integer",
                        "minimum": 0
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "pendente",
                            "aprovada",
                            "rejeitada",
                            "cancelada"
                        ]
                    },
                    "reason_rejection": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "ReservationWrite": {
                "required": [
                    "common_area_id",
                    "date",
                    "start_time",
                    "end_time",
                    "guest_count"
                ],
                "properties": {
                    "common_area_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "date": {
                        "type": "string",
                        "format": "date"
                    },
                    "start_time": {
                        "type": "string",
                        "example": "10:00"
                    },
                    "end_time": {
                        "type": "string",
                        "example": "12:00"
                    },
                    "guest_count": {
                        "type": "integer",
                        "minimum": 0
                    }
                },
                "type": "object"
            },
            "Visitor": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "name": {
                        "type": "string"
                    },
                    "document": {
                        "type": "string"
                    },
                    "phone": {
                        "type": "string",
                        "nullable": true
                    },
                    "photo_url": {
                        "type": "string",
                        "format": "uri",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "VisitorWrite": {
                "required": [
                    "name",
                    "document"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "document": {
                        "type": "string"
                    },
                    "phone": {
                        "type": "string",
                        "nullable": true
                    },
                    "photo": {
                        "type": "string",
                        "format": "binary",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "AccessLog": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "visitante",
                            "prestador_servico",
                            "entrega"
                        ]
                    },
                    "expected_date": {
                        "type": "string",
                        "format": "date"
                    },
                    "check_in": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "check_out": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "notes": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "AccessLogWrite": {
                "required": [
                    "visitor_id",
                    "unit_id",
                    "type",
                    "expected_date"
                ],
                "properties": {
                    "visitor_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "unit_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "visitante",
                            "prestador_servico",
                            "entrega"
                        ]
                    },
                    "expected_date": {
                        "type": "string",
                        "format": "date"
                    },
                    "notes": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "ParkingSpace": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "identifier": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "car",
                            "motorcycle",
                            "mixed",
                            "visitor",
                            "other"
                        ]
                    },
                    "floor": {
                        "type": "string",
                        "nullable": true
                    },
                    "is_covered": {
                        "type": "boolean"
                    },
                    "is_accessible": {
                        "type": "boolean"
                    },
                    "has_charger": {
                        "type": "boolean"
                    },
                    "charger_power_kw": {
                        "type": "number",
                        "format": "float",
                        "nullable": true
                    },
                    "is_active": {
                        "type": "boolean"
                    }
                },
                "type": "object"
            },
            "ParkingSpaceAssignment": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "parking_space_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "unit_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "started_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "ended_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "Vehicle": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "plate": {
                        "type": "string",
                        "example": "ABC1D23"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "car",
                            "motorcycle",
                            "pickup",
                            "van",
                            "truck",
                            "other"
                        ]
                    },
                    "brand": {
                        "type": "string",
                        "nullable": true
                    },
                    "model": {
                        "type": "string",
                        "nullable": true
                    },
                    "color": {
                        "type": "string",
                        "nullable": true
                    },
                    "year": {
                        "type": "integer",
                        "nullable": true
                    },
                    "is_electric": {
                        "type": "boolean"
                    },
                    "tag_identifier": {
                        "type": "string",
                        "nullable": true
                    },
                    "photo_url": {
                        "type": "string",
                        "format": "uri",
                        "nullable": true
                    },
                    "is_active": {
                        "type": "boolean"
                    }
                },
                "type": "object"
            },
            "VehicleAssignment": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "vehicle_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "unit_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "parking_space_id": {
                        "type": "string",
                        "format": "ulid",
                        "nullable": true
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "started_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "ended_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "Block": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "tenant_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "name": {
                        "type": "string",
                        "example": "Bloco A"
                    },
                    "description": {
                        "type": "string",
                        "nullable": true
                    },
                    "units_count": {
                        "type": "integer",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "BlockWrite": {
                "required": [
                    "name"
                ],
                "properties": {
                    "name": {
                        "type": "string",
                        "maxLength": 120
                    },
                    "description": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "Unit": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "tenant_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "block_id": {
                        "type": "string",
                        "format": "ulid",
                        "nullable": true
                    },
                    "identifier": {
                        "type": "string",
                        "example": "Apto 101"
                    },
                    "floor": {
                        "type": "integer",
                        "nullable": true
                    },
                    "ideal_fraction": {
                        "type": "string"
                    },
                    "total_area": {
                        "type": "string"
                    },
                    "block": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Block"
                            }
                        ],
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "UnitWrite": {
                "required": [
                    "identifier",
                    "ideal_fraction",
                    "total_area"
                ],
                "properties": {
                    "identifier": {
                        "type": "string",
                        "maxLength": 120
                    },
                    "block_id": {
                        "type": "string",
                        "format": "ulid",
                        "nullable": true
                    },
                    "floor": {
                        "type": "integer",
                        "nullable": true
                    },
                    "ideal_fraction": {
                        "type": "number",
                        "format": "double",
                        "minimum": 0
                    },
                    "total_area": {
                        "type": "number",
                        "format": "double",
                        "minimum": 0
                    }
                },
                "type": "object"
            },
            "UnitOccupancy": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "tenant_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "unit_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "user_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "proprietario",
                            "inquilino",
                            "dependente"
                        ]
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "started_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "ended_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "user": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/User"
                            }
                        ],
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "UnitOccupancyWrite": {
                "required": [
                    "user_id",
                    "type"
                ],
                "properties": {
                    "user_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "proprietario",
                            "inquilino",
                            "dependente"
                        ]
                    },
                    "started_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "CommonArea": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "tenant_id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "name": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string",
                        "nullable": true
                    },
                    "maximum_capacity": {
                        "type": "integer",
                        "nullable": true
                    },
                    "usage_rules": {
                        "type": "string",
                        "nullable": true
                    },
                    "is_reservable": {
                        "type": "boolean"
                    }
                },
                "type": "object"
            },
            "CommonAreaWrite": {
                "required": [
                    "name",
                    "is_reservable"
                ],
                "properties": {
                    "name": {
                        "type": "string",
                        "maxLength": 160
                    },
                    "description": {
                        "type": "string",
                        "nullable": true
                    },
                    "maximum_capacity": {
                        "type": "integer",
                        "nullable": true,
                        "minimum": 1
                    },
                    "usage_rules": {
                        "type": "string",
                        "nullable": true
                    },
                    "is_reservable": {
                        "type": "boolean"
                    }
                },
                "type": "object"
            },
            "DocumentCategory": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "name": {
                        "type": "string",
                        "example": "Atas"
                    },
                    "description": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "Document": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "title": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string",
                        "nullable": true
                    },
                    "file_type": {
                        "type": "string",
                        "example": "pdf"
                    },
                    "file_size": {
                        "type": "integer"
                    },
                    "download_url": {
                        "type": "string",
                        "format": "uri"
                    }
                },
                "type": "object"
            },
            "FinancialReport": {
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "ulid"
                    },
                    "title": {
                        "type": "string",
                        "example": "Balancete Março/2026"
                    },
                    "reference_month": {
                        "type": "integer",
                        "maximum": 12,
                        "minimum": 1
                    },
                    "reference_year": {
                        "type": "integer"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "balancete",
                            "prestacao_contas",
                            "comprovantes",
                            "outros"
                        ]
                    },
                    "download_url": {
                        "type": "string",
                        "format": "uri"
                    }
                },
                "type": "object"
            },
            "TwoFactorChallengeResponse": {
                "required": [
                    "requires_two_factor",
                    "challenge_token",
                    "expires_in"
                ],
                "properties": {
                    "requires_two_factor": {
                        "type": "boolean",
                        "example": true
                    },
                    "challenge_token": {
                        "description": "Token opaco e temporário; não é um JWT",
                        "type": "string"
                    },
                    "expires_in": {
                        "type": "integer",
                        "example": 300
                    }
                },
                "type": "object"
            },
            "TwoFactorChallengeRequest": {
                "required": [
                    "challenge_token"
                ],
                "properties": {
                    "challenge_token": {
                        "type": "string"
                    },
                    "code": {
                        "type": "string",
                        "pattern": "^\\d{6}$",
                        "nullable": true
                    },
                    "recovery_code": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "TwoFactorSetupResponse": {
                "required": [
                    "secret",
                    "otpauth_uri",
                    "issuer"
                ],
                "properties": {
                    "secret": {
                        "description": "Exibido apenas durante o setup; deve ser tratado como credencial sensível",
                        "type": "string"
                    },
                    "otpauth_uri": {
                        "type": "string",
                        "example": "otpauth://totp/Fluxo%20Condominium%20API:user@example.com?..."
                    },
                    "issuer": {
                        "type": "string",
                        "example": "Fluxo Condominium API"
                    }
                },
                "type": "object"
            },
            "TwoFactorStatus": {
                "properties": {
                    "enabled": {
                        "type": "boolean"
                    },
                    "confirmed_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "recovery_codes_remaining": {
                        "type": "integer",
                        "minimum": 0
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "bearerFormat": "JWT",
                "scheme": "bearer"
            }
        }
    },
    "tags": [
        {
            "name": "Access Logs",
            "description": "Autorizações e registros de portaria"
        },
        {
            "name": "Announcements",
            "description": "Mural de avisos do condomínio"
        },
        {
            "name": "Auth",
            "description": "Autenticação JWT e seleção segura do tenant ativo"
        },
        {
            "name": "Blocks",
            "description": "Gestão opcional de blocos e torres do condomínio ativo"
        },
        {
            "name": "Common Areas",
            "description": "Gestão de áreas comuns e sua disponibilidade para reservas"
        },
        {
            "name": "Document Categories",
            "description": "Categorias do repositório documental"
        },
        {
            "name": "Documents",
            "description": "Repositório privado de documentos do condomínio"
        },
        {
            "name": "Financial Reports",
            "description": "Transparência e balancetes do condomínio"
        },
        {
            "name": "Reservations",
            "description": "Reservas de áreas comuns"
        },
        {
            "name": "Tenants",
            "description": "Gestão dos condomínios e bootstrap do contexto multi-tenant"
        },
        {
            "name": "Tickets",
            "description": "Ocorrências e chamados do condomínio"
        },
        {
            "name": "Ticket Messages",
            "description": "Thread de atendimento dentro de um chamado"
        },
        {
            "name": "Two-Factor Authentication",
            "description": "2FA TOTP opcional por usuário, com códigos de recuperação de uso único"
        },
        {
            "name": "Units",
            "description": "Gestão de apartamentos, casas e demais unidades do condomínio ativo"
        },
        {
            "name": "Unit Occupancies",
            "description": "Histórico de vínculos entre usuários e unidades"
        },
        {
            "name": "Users",
            "description": "Gestão de usuários vinculados ao condomínio ativo"
        },
        {
            "name": "Visitors",
            "description": "Cadastro de visitantes e prestadores"
        }
    ]
}