{
  "openapi": "3.0.4",
  "info": {
    "title": "LightHouse — Almoxarifado (GPT pack, somente leitura)",
    "description": "API principal do Leankeep — gestão de manutenção predial (preventiva e corretiva). Documentação gerada a partir do Swagger real da aplicação.\n\n## Rate limiting\n\nLimite: **250 requisições/hora** por credencial (janela de 1 hora; valor pode variar por ambiente - confirme o vigente com o time). Ao exceder, a API responde **429 Too Many Requests**. A integração deve respeitar o código 429 (não reenviar imediatamente), aplicar **backoff exponencial** antes de tentar de novo e distribuir chamadas ao longo do tempo em vez de picos. Ver o guia [Rate limiting](/guides/rate-limiting).",
    "version": "2.0.0.5",
    "contact": {
      "name": "Leankeep Software"
    }
  },
  "servers": [
    {
      "url": "https://lighthouse.lkp.dev.br",
      "description": "Sandbox"
    },
    {
      "url": "https://lighthousev2.lkp.app.br",
      "description": "Produção"
    }
  ],
  "security": [
    {
      "Bearer": []
    }
  ],
  "paths": {
    "/v1/usuarios": {
      "get": {
        "tags": [
          "Usuarios (V1)"
        ],
        "parameters": [
          {
            "name": "SiteId",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "integer",
                "format": "int32"
              },
              "deprecated": true
            }
          },
          {
            "name": "Fornecedores",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "integer",
                "format": "int32"
              },
              "deprecated": true
            }
          },
          {
            "name": "Search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "UsuarioId",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "description": "Filtro genérico por usuário; prefira ExecutorId ou EmitenteId quando a intenção for clara."
          },
          {
            "name": "EmpresaId",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "TipoUsuario",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/ETipoUsuario"
            }
          },
          {
            "name": "UnidadeId",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "integer",
                "format": "int32"
              }
            }
          },
          {
            "name": "GrupoUnidadeId",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "integer",
                "format": "int32"
              }
            }
          },
          {
            "name": "SubGrupoUnidadeId",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "integer",
                "format": "int32"
              }
            }
          },
          {
            "name": "EstadoId",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "integer",
                "format": "int32"
              }
            }
          },
          {
            "name": "CidadeId",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "integer",
                "format": "int32"
              }
            }
          },
          {
            "name": "FornecedorId",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "integer",
                "format": "int32"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Usuarios"
                  }
                },
                "example": [
                  {
                    "usuario": 1,
                    "nome": "Fulano de Tal",
                    "email": "usuario@empresa.com.br",
                    "inativo": false,
                    "superUsuario": false,
                    "login": "⚠️ A confirmar",
                    "usuarioDesignado": false,
                    "filtrosDefault": false,
                    "filtrosAlteracaoDefault": false,
                    "filtrosTodosTiposAnomalias": false,
                    "tipo": 1,
                    "cargo": 1,
                    "setor": 1,
                    "assinaturaPath": "/uploads/exemplo.png",
                    "celular": "11999998888",
                    "dataCadastro": "2026-06-29T10:00:00Z",
                    "acessoTodasAreas": false,
                    "tipoNome": "⚠️ A confirmar",
                    "image": "⚠️ A confirmar",
                    "emailValido": false
                  }
                ]
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Usuarios"
                  }
                },
                "example": [
                  {
                    "usuario": 1,
                    "nome": "Fulano de Tal",
                    "email": "usuario@empresa.com.br",
                    "inativo": false,
                    "superUsuario": false,
                    "login": "⚠️ A confirmar",
                    "usuarioDesignado": false,
                    "filtrosDefault": false,
                    "filtrosAlteracaoDefault": false,
                    "filtrosTodosTiposAnomalias": false,
                    "tipo": 1,
                    "cargo": 1,
                    "setor": 1,
                    "assinaturaPath": "/uploads/exemplo.png",
                    "celular": "11999998888",
                    "dataCadastro": "2026-06-29T10:00:00Z",
                    "acessoTodasAreas": false,
                    "tipoNome": "⚠️ A confirmar",
                    "image": "⚠️ A confirmar",
                    "emailValido": false
                  }
                ]
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Usuarios"
                  }
                },
                "example": [
                  {
                    "usuario": 1,
                    "nome": "Fulano de Tal",
                    "email": "usuario@empresa.com.br",
                    "inativo": false,
                    "superUsuario": false,
                    "login": "⚠️ A confirmar",
                    "usuarioDesignado": false,
                    "filtrosDefault": false,
                    "filtrosAlteracaoDefault": false,
                    "filtrosTodosTiposAnomalias": false,
                    "tipo": 1,
                    "cargo": 1,
                    "setor": 1,
                    "assinaturaPath": "/uploads/exemplo.png",
                    "celular": "11999998888",
                    "dataCadastro": "2026-06-29T10:00:00Z",
                    "acessoTodasAreas": false,
                    "tipoNome": "⚠️ A confirmar",
                    "image": "⚠️ A confirmar",
                    "emailValido": false
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Bad Request - payload inválido (ver a mensagem retornada para o campo/motivo específico).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
                  "title": "Bad Request",
                  "status": 400,
                  "detail": "Um ou mais campos do payload são inválidos.",
                  "instance": null
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
                  "title": "Bad Request",
                  "status": 400,
                  "detail": "Um ou mais campos do payload são inválidos.",
                  "instance": null
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
                  "title": "Bad Request",
                  "status": 400,
                  "detail": "Um ou mais campos do payload são inválidos.",
                  "instance": null
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
                  "title": "Bad Request",
                  "status": 400,
                  "detail": "Um ou mais campos do payload são inválidos.",
                  "instance": null
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - autenticado, mas sem permissão para o recurso/empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.3",
                  "title": "Forbidden",
                  "status": 403,
                  "detail": "Usuário autenticado, mas sem permissão para este recurso/empresa.",
                  "instance": null
                }
              }
            }
          },
          "404": {
            "description": "Not Found - recurso inexistente para o identificador informado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.4",
                  "title": "Not Found",
                  "status": 404,
                  "detail": "Recurso inexistente para o identificador informado.",
                  "instance": null
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - limite de 250 req/h excedido. Aguarde e aplique backoff exponencial (ver guia Rate limiting).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "example": {
                  "type": "https://tools.ietf.org/html/rfc6585#section-4",
                  "title": "Too Many Requests",
                  "status": 429,
                  "detail": "Limite de 250 requisições/hora excedido. Aguarde e aplique backoff exponencial antes de tentar novamente.",
                  "instance": null
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              }
            }
          }
        },
        "operationId": "buscarUsuariosV1",
        "summary": "Buscar usuários",
        "description": "Busca usuários pelo nome via parâmetro Search. Use o campo 'usuario' da resposta como ID nos filtros UsuarioId/ExecutorId/EmitenteId.",
        "x-openai-isConsequential": false
      }
    },
    "/v1/almoxarifados": {
      "get": {
        "tags": [
          "Almoxarifados (V1)"
        ],
        "parameters": [
          {
            "name": "unidadeId",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "description": "Filtra os almoxarifados que atendem esta unidade."
          },
          {
            "name": "EmpresaId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "UnidadeId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Almoxarifados"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Almoxarifados"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Almoxarifados"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              }
            }
          }
        },
        "operationId": "get__v1_almoxarifados_v1",
        "summary": "Listar almoxarifados",
        "description": "Lista os almoxarifados ativos da empresa; com unidadeId, só os que atendem aquela unidade. Use para descobrir o almoxarifadoId exigido pelos demais endpoints do fluxo de material. Somente leitura.",
        "x-openai-isConsequential": false
      }
    },
    "/v1/materiais": {
      "get": {
        "tags": [
          "Materiais (V1)"
        ],
        "parameters": [
          {
            "name": "codigo",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "almoxarifadoId",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "EmpresaId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "UnidadeId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Materiais"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Materiais"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Materiais"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              }
            }
          }
        },
        "operationId": "get__v1_materiais_v1",
        "summary": "Listar materiais",
        "description": "Lista os materiais ativos da empresa (exceto EPIs); filtre por codigo (igualdade exata) ou almoxarifadoId. O header UnidadeId restringe à unidade. Não retorna saldo de estoque. Somente leitura.",
        "x-openai-isConsequential": false
      }
    },
    "/v1/materiais/tipos": {
      "get": {
        "tags": [
          "Materiais (V1)"
        ],
        "operationId": "listarTiposMaterialV1",
        "summary": "Listar tipos de material",
        "parameters": [
          {
            "name": "EmpresaId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "UnidadeId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tipos de material da empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TiposMateriaisList"
                  }
                },
                "example": [
                  {
                    "tipoMaterialId": 1,
                    "nome": "Consumível"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Não autenticado — token ausente, inválido ou expirado."
          },
          "500": {
            "description": "Erro interno.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              }
            }
          }
        },
        "description": "Lista os tipos de material da empresa (tipoMaterialId, nome). Em POST/PUT de material o tipo é informado pelo NOME, não pelo ID. Somente leitura.",
        "x-openai-isConsequential": false
      }
    },
    "/v1/materiais/categorias": {
      "get": {
        "tags": [
          "Materiais (V1)"
        ],
        "operationId": "listarCategoriasMaterialV1",
        "summary": "Listar categorias de material",
        "parameters": [
          {
            "name": "EmpresaId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "UnidadeId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Categorias de material da empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CategoriasMateriaisList"
                  }
                },
                "example": [
                  {
                    "categoriaMaterialId": 1,
                    "nome": "Elétrica"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Não autenticado — token ausente, inválido ou expirado."
          },
          "500": {
            "description": "Erro interno.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              }
            }
          }
        },
        "description": "Lista as categorias de material da empresa (categoriaMaterialId, nome). Em POST/PUT de material a categoria é informada pelo NOME, não pelo ID. Somente leitura.",
        "x-openai-isConsequential": false
      }
    },
    "/v1/solicitacoes-materiais": {
      "get": {
        "tags": [
          "SolicitacoesMateriais (V1)"
        ],
        "parameters": [
          {
            "name": "SiteId",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "AlmoxarifadoId",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "SolicitanteId",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "Status",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Lista de status separados por vírgula (ex.: `1,3`). `0` (padrão) = todos."
          },
          {
            "name": "DataInicial",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "DataFinal",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "ComCompraMaterial",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "CompraMaterialId",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "Search",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Texto livre: cada palavra é buscada (E lógico) em número, almoxarifado, solicitante e status."
          },
          {
            "name": "Page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "PageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "EmpresaId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SolicitacoesMateriaisList"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              }
            }
          }
        },
        "operationId": "get__v1_solicitacoes-materiais_v1",
        "summary": "Listar solicitações de materiais",
        "description": "Lista solicitações de material (Page=1 e PageSize=50 por padrão; total em `totalRows` em cada linha). Status: lista CSV (ex.: 1,3), 0 = todos. Período máximo de 12 meses. Somente leitura.",
        "x-openai-isConsequential": false
      }
    },
    "/v1/solicitacoes-materiais/{id}/itens": {
      "get": {
        "tags": [
          "SolicitacoesMateriais (V1)"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "EmpresaId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "UnidadeId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SolicitacoesMateriaisItensList"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              }
            }
          }
        },
        "operationId": "get__v1_solicitacoes-materiais_id_itens_v1",
        "summary": "Listar itens da solicitação",
        "description": "Lista os itens de uma solicitação: quantidade, estoque atual/mínimo/máximo, status de compra e quantidade entregue. Só aparecem itens cujo material está cadastrado no almoxarifado da solicitação. Somente leitura.",
        "x-openai-isConsequential": false
      }
    },
    "/v1/solicitacoes-materiais/{id}/historico": {
      "get": {
        "tags": [
          "SolicitacoesMateriais (V1)"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          },
          {
            "name": "EmpresaId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "UnidadeId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AndamentosSolicitacaoList"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              }
            }
          }
        },
        "operationId": "get__v1_solicitacoes-materiais_id_historico_v1",
        "summary": "Consultar histórico da solicitação",
        "description": "Histórico de andamentos (status) da solicitação, em ordem cronológica, paginado (Page=1, PageSize=50). Somente leitura.",
        "x-openai-isConsequential": false
      }
    },
    "/v1/compras-materiais": {
      "get": {
        "tags": [
          "ComprasMateriais (V1)"
        ],
        "parameters": [
          {
            "name": "AlmoxarifadoId",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "FornecedorId",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "Status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "DataInicial",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "DataFinal",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "Search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "PageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "EmpresaId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "UnidadeId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ComprasMateriaisList"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              }
            }
          }
        },
        "operationId": "get__v1_compras-materiais_v1",
        "summary": "Listar compras de materiais",
        "description": "Lista ordens de compra de material (Page=1, PageSize=50; total em `totalRows`). Status: lista CSV, 0 = todos; compras agrupadas (status 5) não aparecem. Somente leitura.",
        "x-openai-isConsequential": false
      }
    },
    "/v1/compras-materiais/{id}/solicitacoes": {
      "get": {
        "tags": [
          "ComprasMateriais (V1)"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "EmpresaId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "UnidadeId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SolicitacoesMateriaisList"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              }
            }
          }
        },
        "operationId": "get__v1_compras-materiais_id_solicitacoes_v1",
        "summary": "Listar solicitações da compra",
        "description": "Lista as solicitações vinculadas à compra (no máximo 50, sem paginação). Somente leitura.",
        "x-openai-isConsequential": false
      }
    },
    "/v1/entradas-materiais": {
      "get": {
        "tags": [
          "EntradasMateriais (V1)"
        ],
        "parameters": [
          {
            "name": "AlmoxarifadoId",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "OrdemCompra",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "DataInicial",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "DataFinal",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "Search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "PageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "EmpresaId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "UnidadeId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EntradasMateriaisList"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              }
            }
          }
        },
        "operationId": "get__v1_entradas-materiais_v1",
        "summary": "Listar entradas de materiais",
        "description": "Lista as entradas de material (Page=1, PageSize=50; total em `totalRows`). O filtro de datas usa a data da COMPRA, não a da entrada. Para saldo pendente, use GET /v1/entradas-materiais/compras. Somente leitura.",
        "x-openai-isConsequential": false
      }
    },
    "/v1/entradas-materiais/compras": {
      "get": {
        "tags": [
          "EntradasMateriais (V1)"
        ],
        "parameters": [
          {
            "name": "almoxarifadoId",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "EmpresaId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "UnidadeId",
            "in": "header",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ComprasMateriaisList"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorCommandResult"
                }
              }
            }
          }
        },
        "operationId": "get__v1_entradas-materiais_compras_v1",
        "summary": "Listar compras para entrada",
        "description": "Lista as compras com saldo pendente de recebimento (quantidade comprada − já recebida > 0). Consulte antes de criar uma entrada. Somente leitura.",
        "x-openai-isConsequential": false
      }
    }
  },
  "components": {
    "securitySchemes": {
      "Bearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "JWT emitido pelo AuthCenter. Cole apenas o token (sem o prefixo Bearer)."
      }
    },
    "schemas": {
      "ETipoUsuario": {
        "enum": [
          1,
          2,
          3,
          4
        ],
        "type": "integer",
        "format": "int32",
        "description": "Tipo do usuário: 2 = Administrador, 3 = Operacional, 4 = Chamado. Determina as permissões geradas na criação."
      },
      "Usuarios": {
        "type": "object",
        "properties": {
          "usuario": {
            "type": "integer",
            "format": "int32"
          },
          "nome": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "inativo": {
            "type": "boolean"
          },
          "superUsuario": {
            "type": "boolean",
            "nullable": true
          },
          "login": {
            "type": "string",
            "nullable": true
          },
          "usuarioDesignado": {
            "type": "boolean",
            "nullable": true
          },
          "filtrosDefault": {
            "type": "boolean",
            "nullable": true
          },
          "filtrosAlteracaoDefault": {
            "type": "boolean",
            "nullable": true
          },
          "filtrosTodosTiposAnomalias": {
            "type": "boolean",
            "nullable": true
          },
          "tipo": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "cargo": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "setor": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "assinaturaPath": {
            "type": "string",
            "nullable": true
          },
          "celular": {
            "type": "string",
            "nullable": true
          },
          "dataCadastro": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "acessoTodasAreas": {
            "type": "boolean"
          },
          "tipoNome": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "image": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "emailValido": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": {}
      },
      "ErrorCommandResult": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "hash": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "Almoxarifados": {
        "type": "object",
        "properties": {
          "almoxarifado": {
            "type": "integer",
            "format": "int32"
          },
          "nome": {
            "type": "string",
            "nullable": true
          },
          "site": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "grupoArea": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "area": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "subgrupoArea": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "Materiais": {
        "type": "object",
        "properties": {
          "material": {
            "type": "integer",
            "format": "int32"
          },
          "empresa": {
            "type": "integer",
            "format": "int32"
          },
          "site": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "tipoMaterial": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "codigo": {
            "type": "string",
            "nullable": true
          },
          "nome": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32"
          },
          "custo": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "custoMaoObra": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "fabricante": {
            "type": "string",
            "nullable": true
          },
          "modelo": {
            "type": "string",
            "nullable": true
          },
          "marca": {
            "type": "string",
            "nullable": true
          },
          "categoriaMaterial": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "unidadeConsumo": {
            "$ref": "#/components/schemas/EUnidadeConsumo"
          },
          "ratearMaoObraProporcionalAQuantidade": {
            "type": "boolean"
          },
          "classe": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "nomeFormatted": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "isAtivo": {
            "type": "boolean",
            "readOnly": true
          },
          "isEpi": {
            "type": "boolean",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "TiposMateriaisList": {
        "type": "object",
        "properties": {
          "tipoMaterialId": {
            "type": "integer",
            "format": "int32"
          },
          "nome": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CategoriasMateriaisList": {
        "type": "object",
        "properties": {
          "categoriaMaterialId": {
            "type": "integer",
            "format": "int32"
          },
          "nome": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SolicitacoesMateriaisList": {
        "type": "object",
        "properties": {
          "solicitacaoMaterialId": {
            "type": "integer",
            "format": "int32"
          },
          "almoxarifado": {
            "type": "integer",
            "format": "int32"
          },
          "site": {
            "type": "integer",
            "format": "int32"
          },
          "solicitante": {
            "type": "integer",
            "format": "int32"
          },
          "almoxarifado_Nome": {
            "type": "string",
            "nullable": true
          },
          "solicitante_Nome": {
            "type": "string",
            "nullable": true
          },
          "listaStatusAndamentoSolicitacao": {
            "type": "string",
            "nullable": true
          },
          "statusAndamentoSolicitacao": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "statusAndamentoSolicitacao_Nome": {
            "type": "string",
            "nullable": true
          },
          "ocorrencias": {
            "type": "string",
            "nullable": true
          },
          "concluidoComRessalvas": {
            "type": "boolean"
          },
          "rowNumber": {
            "type": "integer",
            "format": "int32"
          },
          "totalRows": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "SolicitacoesMateriaisItensList": {
        "type": "object",
        "properties": {
          "solicitacaoMaterialItemId": {
            "type": "integer",
            "format": "int32"
          },
          "solicitacaoMaterialId": {
            "type": "integer",
            "format": "int32"
          },
          "material": {
            "type": "integer",
            "format": "int32"
          },
          "material_Nome": {
            "type": "string",
            "nullable": true
          },
          "quantidade": {
            "type": "number",
            "format": "double"
          },
          "estoqueAtual": {
            "type": "number",
            "format": "double"
          },
          "estoqueMinimo": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "estoqueMaximo": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "statusCompra": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "statusCompraMaterial_Nome": {
            "type": "string",
            "nullable": true
          },
          "quantidadeEntregue": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "statusAndamentoSolicitacao": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "statusAndamentoSolicitacao_Nome": {
            "type": "string",
            "nullable": true
          },
          "ocorrencias": {
            "type": "string",
            "nullable": true
          },
          "valorUnitario": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "valorTotal": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "prazoDevolucao": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "compraMaterialItem": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "rowNumber": {
            "type": "integer",
            "format": "int32"
          },
          "destinacaoTipo": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "destinacaoId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "ocorrenciasRelacionadasCount": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "AndamentosSolicitacaoList": {
        "type": "object",
        "properties": {
          "andamentoSolicitacao": {
            "type": "integer",
            "format": "int32"
          },
          "solicitacaoMaterial": {
            "type": "integer",
            "format": "int32"
          },
          "responsavelSaidaMaterial": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "responsavelRetirada": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32"
          },
          "data": {
            "type": "string",
            "format": "date-time"
          },
          "site_Nome": {
            "type": "string",
            "nullable": true
          },
          "almoxarifado_Nome": {
            "type": "string",
            "nullable": true
          },
          "solicitante": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "solicitante_Nome": {
            "type": "string",
            "nullable": true
          },
          "responsavelSaidaMaterial_Nome": {
            "type": "string",
            "nullable": true
          },
          "responsavelRetirada_Nome": {
            "type": "string",
            "nullable": true
          },
          "statusAndamentoSolicitacao_Nome": {
            "type": "string",
            "nullable": true
          },
          "rowNumber": {
            "type": "integer",
            "format": "int32"
          },
          "totalRows": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "ComprasMateriaisList": {
        "type": "object",
        "properties": {
          "compraMaterialId": {
            "type": "integer",
            "format": "int32"
          },
          "almoxarifado": {
            "type": "integer",
            "format": "int32"
          },
          "numero": {
            "type": "integer",
            "format": "int32"
          },
          "data": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "integer",
            "format": "int32"
          },
          "fornecedor": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "fornecedor_Nome": {
            "type": "string",
            "nullable": true
          },
          "statusComprasMaterial_Nome": {
            "type": "string",
            "nullable": true
          },
          "almoxarifado_Nome": {
            "type": "string",
            "nullable": true
          },
          "agrupamentoId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "agrupamentoOrigem": {
            "type": "boolean"
          },
          "responsavel": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "responsavel_Nome": {
            "type": "string",
            "nullable": true
          },
          "rowNumber": {
            "type": "integer",
            "format": "int32"
          },
          "totalRows": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "EntradasMateriaisList": {
        "type": "object",
        "properties": {
          "entradaMaterialId": {
            "type": "integer",
            "format": "int32"
          },
          "ordemCompra": {
            "type": "integer",
            "format": "int32"
          },
          "data": {
            "type": "string",
            "format": "date-time"
          },
          "responsavel": {
            "type": "integer",
            "format": "int32"
          },
          "responsavelNome": {
            "type": "string",
            "nullable": true
          },
          "statusCompraMaterialNome": {
            "type": "string",
            "nullable": true
          },
          "almoxarifadoNome": {
            "type": "string",
            "nullable": true
          },
          "parcial": {
            "type": "boolean"
          },
          "rowNumber": {
            "type": "integer",
            "format": "int32"
          },
          "totalRows": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "EUnidadeConsumo": {
        "enum": [
          1,
          2,
          3,
          4,
          5,
          6,
          7,
          8,
          9,
          10,
          11,
          12,
          13,
          14
        ],
        "type": "integer",
        "format": "int32"
      }
    }
  }
}