{
    "openapi": "3.0.0",
    "info": {
        "title": "API Documentation",
        "version": "1.0.0"
    },
    "paths": {
        "/login": {
            "post": {
                "tags": [
                    "Autenticação"
                ],
                "summary": "Login",
                "description": "Realiza o login e retorna um token de acesso.",
                "operationId": "login",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "hash",
                                    "clientUid"
                                ],
                                "properties": {
                                    "hash": {
                                        "type": "string",
                                        "example": "DV.1.gplusPdv.$2y$10$ff.X1iaDKcBmXX.fio4lf.BMTkRY2bqX4h6qRsrC6dOP68G1cMf16"
                                    },
                                    "clientUid": {
                                        "description": "Identificador do cliente",
                                        "type": "string",
                                        "example": "1234567890"
                                    },
                                    "version": {
                                        "description": "Versão do aplicativo",
                                        "type": "string",
                                        "example": "1.0.0"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Login realizado com sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "token": {
                                            "type": "string",
                                            "example": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Erro ao realizar login"
                    },
                    "401": {
                        "description": "Permissão Negada"
                    },
                    "500": {
                        "description": "Erro interno do servidor"
                    }
                }
            }
        },
        "/resultadoIntegracao": {
            "post": {
                "tags": [
                    "Sincronização"
                ],
                "summary": "Resultado da integração",
                "description": "Recebe os resultados da integração e atualiza a lista de sincronização.",
                "operationId": "resultado",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ResultadoIntegracaoRequestBody"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Resultado da integração recebido com sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "string",
                                            "example": "OK"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Erro ao gerar lista de sincronização"
                    },
                    "401": {
                        "description": "Permissão Negada"
                    },
                    "404": {
                        "description": "Rota não encontrada"
                    },
                    "500": {
                        "description": "Erro interno do servidor"
                    }
                },
                "security": [
                    {
                        "Authorization": []
                    }
                ]
            }
        },
        "/sincronizar": {
            "post": {
                "tags": [
                    "Sincronização"
                ],
                "summary": "Sincronizar registros",
                "description": "Atualiza a lista de sincronização e retorna em chunks de 500 produtos.",
                "operationId": "sincronizar",
                "responses": {
                    "200": {
                        "description": "Lista de sincronização gerada com sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "Produto": {
                                                    "allOf": [
                                                        {
                                                            "$ref": "#/components/schemas/BaseSincronizar"
                                                        },
                                                        {
                                                            "properties": {
                                                                "Dados": {
                                                                    "$ref": "#/components/schemas/ProdutoDadosResponse"
                                                                }
                                                            },
                                                            "type": "object"
                                                        }
                                                    ]
                                                },
                                                "Observacao": {
                                                    "allOf": [
                                                        {
                                                            "$ref": "#/components/schemas/BaseSincronizar"
                                                        },
                                                        {
                                                            "properties": {
                                                                "Dados": {
                                                                    "$ref": "#/components/schemas/ObservacaoDadosResponse"
                                                                }
                                                            },
                                                            "type": "object"
                                                        }
                                                    ]
                                                },
                                                "Matriz": {
                                                    "allOf": [
                                                        {
                                                            "$ref": "#/components/schemas/BaseSincronizar"
                                                        },
                                                        {
                                                            "properties": {
                                                                "Dados": {
                                                                    "$ref": "#/components/schemas/MatrizDadosResponse"
                                                                }
                                                            },
                                                            "type": "object"
                                                        }
                                                    ]
                                                },
                                                "Grupo": {
                                                    "allOf": [
                                                        {
                                                            "$ref": "#/components/schemas/BaseSincronizar"
                                                        },
                                                        {
                                                            "properties": {
                                                                "Dados": {
                                                                    "$ref": "#/components/schemas/GrupoDadosResponse"
                                                                }
                                                            },
                                                            "type": "object"
                                                        }
                                                    ]
                                                },
                                                "Complemento": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "example": []
                                                },
                                                "Configuracao": {
                                                    "type": "object"
                                                },
                                                "Classificacao": {
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Erro ao gerar lista de sincronização"
                    },
                    "401": {
                        "description": "Permissão Negada"
                    },
                    "404": {
                        "description": "Rota não encontrado"
                    },
                    "500": {
                        "description": "Erro interno do servidor"
                    }
                },
                "security": [
                    {
                        "Authorization": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "ResultadoIntegracaoRequestBody": {
                "required": [
                    "Dados"
                ],
                "properties": {
                    "Dados": {
                        "type": "array",
                        "items": {
                            "required": [
                                "Chave",
                                "Status"
                            ],
                            "properties": {
                                "Chave": {
                                    "type": "string",
                                    "example": "663b78bb9deae16b920e4985"
                                },
                                "Status": {
                                    "type": "string",
                                    "enum": [
                                        "0",
                                        "1"
                                    ],
                                    "example": "1"
                                }
                            },
                            "type": "object"
                        }
                    }
                },
                "type": "object"
            },
            "GrupoDadosResponse": {
                "properties": {
                    "id": {
                        "description": "Identificador incremental",
                        "type": "string",
                        "default": "",
                        "example": "123"
                    },
                    "Grupo": {
                        "description": "Nome do grupo",
                        "type": "string",
                        "default": "",
                        "example": "Grupo A"
                    },
                    "Excluido": {
                        "description": "Indica se o item foi excluído",
                        "type": "string",
                        "default": "0",
                        "enum": [
                            "0",
                            "1"
                        ],
                        "example": "0"
                    },
                    "Ordem": {
                        "description": "Ordem do item",
                        "type": "string",
                        "default": "0",
                        "example": "0"
                    },
                    "Status": {
                        "description": "Status do item (ativo ou inativo)",
                        "type": "string",
                        "default": "0",
                        "enum": [
                            "0",
                            "1"
                        ],
                        "example": "1"
                    },
                    "TipoPizza": {
                        "description": "Tipo de pizza",
                        "type": "string",
                        "default": "0",
                        "example": "0"
                    },
                    "Configuracao": {
                        "description": "Configuração",
                        "type": "string",
                        "default": "",
                        "example": ""
                    }
                },
                "type": "object"
            },
            "ObservacaoDadosResponse": {
                "properties": {
                    "ID": {
                        "type": "integer",
                        "example": 1
                    },
                    "OBSERVACAO": {
                        "type": "string",
                        "example": "Observação"
                    },
                    "ID_SETOR": {
                        "type": "string",
                        "example": ""
                    },
                    "ID_GRUPO": {
                        "type": "integer",
                        "example": 2
                    },
                    "ID_SUBGRUPO": {
                        "type": "string",
                        "example": ""
                    },
                    "SITUACAO": {
                        "type": "integer",
                        "enum": [
                            0,
                            1
                        ],
                        "example": 1
                    },
                    "OBS_GLOBAL": {
                        "type": "integer",
                        "example": 0
                    }
                },
                "type": "object"
            },
            "ProdutoDadosResponse": {
                "properties": {
                    "DESCRICAO_PDV": {
                        "type": "string",
                        "example": "aut"
                    },
                    "DESCRICAO_TOUCH": {
                        "type": "string",
                        "example": "iste"
                    },
                    "CODIGO_INTERNO": {
                        "type": "integer",
                        "example": 865869869
                    },
                    "GTIN": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "example": "3783783783"
                        }
                    },
                    "CODIGO_BALANCA": {
                        "type": "string",
                        "example": "9696969"
                    },
                    "VALIDADE_BALANCA": {
                        "type": "integer",
                        "example": 100
                    },
                    "UN_COMPRA": {
                        "type": "string",
                        "enum": [
                            "UN",
                            "CX",
                            "KG",
                            "LT",
                            "G",
                            "ML"
                        ],
                        "example": "UN"
                    },
                    "UN_VENDA": {
                        "type": "string",
                        "enum": [
                            "UN",
                            "CX",
                            "KG",
                            "LT",
                            "G",
                            "ML"
                        ],
                        "example": "UN"
                    },
                    "VALOR_COMPRA": {
                        "type": "integer",
                        "example": 10
                    },
                    "VALOR_MINIMO": {
                        "type": "integer",
                        "example": 0
                    },
                    "MARGEM_LUCRO": {
                        "type": "integer",
                        "example": 400
                    },
                    "VALOR_VENDA": {
                        "type": "integer",
                        "example": 50
                    },
                    "MARGEM_LUCROPRAZO": {
                        "type": "integer",
                        "example": 1400
                    },
                    "VALOR_PRAZO": {
                        "type": "integer",
                        "example": 150
                    },
                    "TIPO_PRODUTO": {
                        "type": "string",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "S"
                    },
                    "ID_LOCAL_IMPRESSAO": {
                        "type": "string",
                        "example": ""
                    },
                    "LOCAL_ESTOQUE": {
                        "type": "string",
                        "example": ""
                    },
                    "ID_SETOR": {
                        "type": "string",
                        "example": ""
                    },
                    "ID_GRUPO": {
                        "type": "integer",
                        "example": 5
                    },
                    "ID_SUBGRUPO": {
                        "type": "string",
                        "example": ""
                    },
                    "QUANTIDADE_ESTOQUE": {
                        "type": "integer",
                        "example": 0
                    },
                    "ESTOQUE_MINIMO": {
                        "type": "integer",
                        "example": 3
                    },
                    "ESTOQUE_MAXIMO": {
                        "type": "integer",
                        "example": 500000000
                    },
                    "IPPT": {
                        "type": "string",
                        "example": "S"
                    },
                    "CNPJ_FAB": {
                        "type": "string",
                        "example": ""
                    },
                    "VALOR_PAUTA_ICMSST": {
                        "type": "integer",
                        "example": 0
                    },
                    "INDESCALA": {
                        "type": "string",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "N"
                    },
                    "SITUACAO": {
                        "type": "string",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "S"
                    },
                    "MOSTRAR_CARDAPIO": {
                        "type": "string",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "S"
                    },
                    "SOLICITA_QTD_APLICATIVO": {
                        "type": "string",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "N"
                    },
                    "ADICIONAL": {
                        "type": "string",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "N"
                    },
                    "ALTERA_PRECO": {
                        "type": "string",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "N"
                    },
                    "BALANCA_DIRETA": {
                        "type": "string",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "S"
                    },
                    "ENVIA_BALANCA": {
                        "type": "string",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "S"
                    },
                    "TICKET_UM_A_UM": {
                        "type": "string",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "N"
                    },
                    "APLICAR_TAXA_GARCOM": {
                        "type": "string",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "N"
                    },
                    "VENDE_FRACIONADO": {
                        "type": "string",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "N"
                    },
                    "IMP_PRODUCAO_SOMENTE_COMPOSTO": {
                        "type": "string",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "S"
                    },
                    "ID_NCM": {
                        "type": "integer",
                        "example": 2
                    },
                    "FATOR_CONVERSAO": {
                        "type": "string",
                        "example": ""
                    },
                    "QUANTIDADE_CONVERSAO": {
                        "type": "string",
                        "example": ""
                    },
                    "ID": {
                        "type": "integer",
                        "example": 1
                    },
                    "NOME": {
                        "type": "string",
                        "example": "Produto"
                    },
                    "URL_IMAGEM": {
                        "type": "string",
                        "example": "https://s2-techtudo.glbimg.com/L9wb1xt7tjjL-Ocvos-Ju0tVmfc=/0x0:1200x800/984x0/smart/filters:strip_icc()/i.s3.glbimg.com/v1/AUTH_08fbf48bc0524877943fe86e43087e7a/internal_photos/bs/2023/q/l/TIdfl2SA6J16XZAy56Mw/canvaai.png"
                    },
                    "IMAGE_VERSION": {
                        "type": "string",
                        "example": "0"
                    },
                    "POSSUI_CATEGORIA": {
                        "type": "integer",
                        "example": 0
                    }
                },
                "type": "object"
            },
            "MatrizDadosResponse": {
                "properties": {
                    "ID": {
                        "description": "Identificador incremental",
                        "type": "string",
                        "default": "",
                        "example": "123"
                    },
                    "NCM": {
                        "description": "Código NCM",
                        "type": "string",
                        "default": "",
                        "example": "12345678"
                    },
                    "CEST": {
                        "description": "Código CEST",
                        "type": "string",
                        "default": "",
                        "example": "1234567"
                    },
                    "MOVIMENTACAO": {
                        "description": "Tipo de movimentação",
                        "type": "string",
                        "default": "",
                        "example": "entrada"
                    },
                    "TIPO_TABELA": {
                        "description": "Tipo de tabela",
                        "type": "string",
                        "default": "",
                        "example": "preços"
                    },
                    "TIPO_CLIENTE": {
                        "description": "Tipo de cliente",
                        "type": "string",
                        "default": "",
                        "example": "atacado"
                    },
                    "CONSUMIDOR_FINAL": {
                        "description": "Indica se é consumidor final",
                        "type": "string",
                        "default": "N",
                        "enum": [
                            "S",
                            "N"
                        ],
                        "example": "S"
                    },
                    "UF_ORIGEM": {
                        "description": "Unidade federativa de origem",
                        "type": "string",
                        "default": "",
                        "example": "SP"
                    },
                    "UF_DESTINO": {
                        "description": "Unidade federativa de destino",
                        "type": "string",
                        "default": "",
                        "example": "RJ"
                    },
                    "TRIBUTACAO": {
                        "description": "Tipo de tributação",
                        "type": "string",
                        "default": "",
                        "example": "simples nacional"
                    },
                    "CST_ICMS": {
                        "description": "CST ICMS",
                        "type": "string",
                        "default": "",
                        "example": "00"
                    },
                    "ALIQUOTA_ICMS": {
                        "description": "Alíquota ICMS",
                        "type": "number",
                        "default": 0,
                        "example": 18
                    },
                    "ALIQUOTA_ICMS_ST": {
                        "description": "Alíquota ICMS ST",
                        "type": "number",
                        "default": 0,
                        "example": 12
                    },
                    "CSOSN": {
                        "description": "CSOSN",
                        "type": "string",
                        "default": "",
                        "example": "101"
                    },
                    "MVA": {
                        "description": "MVA",
                        "type": "string",
                        "default": "",
                        "example": "15.00"
                    },
                    "CST_PIS": {
                        "description": "CST PIS",
                        "type": "string",
                        "default": "",
                        "example": "01"
                    },
                    "ALIQUOTA_PIS": {
                        "description": "Alíquota PIS",
                        "type": "number",
                        "default": 0,
                        "example": 1.65
                    },
                    "CST_COFINS": {
                        "description": "CST COFINS",
                        "type": "string",
                        "default": "",
                        "example": "01"
                    },
                    "ALIQUOTA_COFINS": {
                        "description": "Alíquota COFINS",
                        "type": "number",
                        "default": 0,
                        "example": 7.6
                    },
                    "CST_IPI": {
                        "description": "CST IPI",
                        "type": "string",
                        "default": "",
                        "example": "01"
                    },
                    "ALIQUOTA_IPI": {
                        "description": "Alíquota IPI",
                        "type": "number",
                        "default": 0,
                        "example": 10
                    },
                    "ENQUADRAMENTO_IPI": {
                        "description": "Enquadramento IPI",
                        "type": "string",
                        "default": "",
                        "example": "300"
                    },
                    "ORIGEM_PRODUTO": {
                        "description": "Origem do produto",
                        "type": "string",
                        "default": "",
                        "example": "nacional"
                    },
                    "CFOP": {
                        "description": "CFOP",
                        "type": "string",
                        "default": "",
                        "example": "5102"
                    },
                    "FCP": {
                        "description": "FCP",
                        "type": "string",
                        "default": "",
                        "example": "2.00"
                    },
                    "REGIME_TRIBUTARIO": {
                        "description": "Regime tributário",
                        "type": "string",
                        "default": "",
                        "example": "simples nacional"
                    },
                    "REDUCAO_BASE_CALCULO": {
                        "description": "Redução da base de cálculo",
                        "type": "string",
                        "default": "",
                        "example": "10.00"
                    },
                    "REDUCAO_BASE_CALCULO_ST": {
                        "description": "Redução da base de cálculo ST",
                        "type": "string",
                        "default": "",
                        "example": "5.00"
                    },
                    "APELIDO": {
                        "description": "Apelido",
                        "type": "string",
                        "default": "",
                        "example": "Produto A"
                    }
                },
                "type": "object"
            },
            "BaseSincronizar": {
                "properties": {
                    "Chave": {
                        "description": "Chave de identificação",
                        "type": "string",
                        "example": "6660b4b6214ad8cb170dd710"
                    },
                    "Operacao": {
                        "description": "Operação (ex: I para inserção)",
                        "type": "string",
                        "example": "I"
                    }
                },
                "type": "object"
            },
            "ErrorResponse": {
                "properties": {
                    "code": {
                        "description": "Código de erro",
                        "type": "string",
                        "example": "UNDEFINED"
                    },
                    "message": {
                        "description": "Mensagem de erro",
                        "type": "string",
                        "example": "Ooops! Algo deu errado. Por favor, tente novamente mais tarde"
                    },
                    "detail": {
                        "description": "Detalhes do erro",
                        "type": "string",
                        "example": "Call to a member function getMainStock() on null"
                    }
                },
                "type": "object"
            },
            "Metadata": {
                "properties": {
                    "VersaoApp": {
                        "description": "Versão do aplicativo",
                        "type": "string",
                        "example": "1.0.0"
                    },
                    "VersaoMiniPDV": {
                        "description": "Versão do MiniPDV",
                        "type": "string",
                        "example": "1.0.0"
                    },
                    "ControleAtualizacao": {
                        "description": "Controle de atualização",
                        "type": "string",
                        "example": ""
                    },
                    "horaInicial": {
                        "description": "Hora inicial",
                        "type": "string",
                        "example": ""
                    }
                },
                "type": "object"
            },
            "Status": {
                "properties": {
                    "status": {
                        "description": "Status da operação",
                        "type": "string",
                        "example": "success"
                    }
                },
                "type": "object"
            }
        }
    }
}