{
    "openapi": "3.0.0",
    "info": {
        "title": "Report API",
        "version": "1.0.0"
    },
    "paths": {
        "/manager/v1/group/getById/{id}": {
            "get": {
                "tags": [
                    "Group"
                ],
                "summary": "Buscar grupo por ID",
                "description": "Busca um grupo pelo ID informado",
                "operationId": "group-getById",
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/response.groups.getById"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequestResponse"
                    },
                    "401": {
                        "$ref": "#/components/responses/UnauthorizedResponse"
                    },
                    "500": {
                        "$ref": "#/components/responses/InternalServerErrorResponse"
                    }
                }
            }
        },
        "/manager/v1/group/list": {
            "get": {
                "tags": [
                    "Group"
                ],
                "summary": "Listar grupos",
                "description": "Lista todos os grupos cadastrados no sistema",
                "operationId": "group-list",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/search"
                    },
                    {
                        "$ref": "#/components/parameters/sortBy"
                    },
                    {
                        "$ref": "#/components/parameters/asc"
                    },
                    {
                        "$ref": "#/components/parameters/cursor"
                    },
                    {
                        "$ref": "#/components/parameters/deleted"
                    },
                    {
                        "$ref": "#/components/parameters/pageSize"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/response.groups.list"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequestResponse"
                    },
                    "401": {
                        "$ref": "#/components/responses/UnauthorizedResponse"
                    },
                    "500": {
                        "$ref": "#/components/responses/InternalServerErrorResponse"
                    }
                }
            }
        },
        "/manager/v1/person/getById/{id}": {
            "get": {
                "tags": [
                    "Person"
                ],
                "summary": "Buscar pessoa por ID",
                "description": "Busca uma pessoa cadastrada no sistema pelo ID",
                "operationId": "person-getById",
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/PersonListItem"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/manager/v1/person/{type}/list": {
            "get": {
                "tags": [
                    "Person"
                ],
                "summary": "Listar pessoas",
                "description": "Lista todas as pessoas cadastradas no sistema",
                "operationId": "person-list",
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PersonListResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequestResponse"
                    },
                    "401": {
                        "$ref": "#/components/responses/UnauthorizedResponse"
                    },
                    "500": {
                        "$ref": "#/components/responses/InternalServerErrorResponse"
                    }
                }
            }
        },
        "/manager/v1/login": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Login do dispositivo",
                "description": "Realiza o login do dispositivo",
                "operationId": "login",
                "requestBody": {
                    "$ref": "#/components/requestBodies/request.terminal.login"
                },
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/response.terminal.login"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/BadRequestResponse"
                    },
                    "401": {
                        "$ref": "#/components/responses/UnauthorizedResponse"
                    },
                    "500": {
                        "$ref": "#/components/responses/InternalServerErrorResponse"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "response.groups.getById": {
                "required": [
                    "data"
                ],
                "properties": {
                    "data": {
                        "properties": {
                            "id": {
                                "type": "string",
                                "example": "65e5d042160429b3100a9465"
                            },
                            "name": {
                                "type": "string",
                                "example": "Sem Grupo"
                            },
                            "order": {
                                "type": "integer",
                                "example": 0
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "response.groups.list": {
                "required": [
                    "data",
                    "metadata"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "properties": {
                                "id": {
                                    "type": "string",
                                    "example": "65e5d042160429b3100a9465"
                                },
                                "name": {
                                    "type": "string",
                                    "example": "Sem Grupo"
                                },
                                "order": {
                                    "type": "integer",
                                    "example": 0
                                }
                            },
                            "type": "object"
                        }
                    },
                    "metadata": {
                        "properties": {
                            "pagination": {
                                "properties": {
                                    "pageSize": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "previousCursor": {
                                        "type": "string",
                                        "example": null
                                    },
                                    "nextCursor": {
                                        "type": "string",
                                        "example": null
                                    },
                                    "totalItems": {
                                        "type": "integer",
                                        "example": 10
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "PersonListResponse": {
                "required": [
                    "data",
                    "metadata"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/PersonListItem"
                        }
                    },
                    "metadata": {
                        "properties": {
                            "pagination": {
                                "properties": {
                                    "pageSize": {
                                        "type": "integer",
                                        "example": 10
                                    },
                                    "previousCursor": {
                                        "type": "string",
                                        "example": null
                                    },
                                    "nextCursor": {
                                        "type": "string",
                                        "example": null
                                    },
                                    "totalItems": {
                                        "type": "integer",
                                        "example": 4
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "response.terminal.login": {
                "properties": {
                    "data": {
                        "properties": {
                            "accessToken": {
                                "type": "string",
                                "example": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzaG9wSWQiOjEsInRlcm1pbmFsSWQiOiI2NjYzNTU4NDM2YWZlYzNhMTgwOWEzNjMiLCJyZWxlYXNlU3RhdHVzIjoiUkVMRUFTRUQiLCJzdGF0dXMiOiJBQ1RJVkUiLCJvcmlnaW4iOiJJTkZJTklURSIsInR5cGUiOiJhY2Nlc3MiLCJpc3MiOiJtYW5hZ2VyIiwiaWF0IjoxNzE3Nzg3MjI2LCJleHBpcmF0aW9uIjoxNzE3ODE2MDI2LCJraWQiOiJhY2Nlc3M6MzZhNTRlYWQtZmJmNC00ZTU5LWI5ZmYtMGIxZDE4NDViN2ZmIn0.2uS4zYAf9Z28V2xlxwQ50PU9rgUm6DI3mUd5ef-sOQQ"
                            },
                            "refreshToken": {
                                "type": "string",
                                "example": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzaG9wSWQiOjEsInRlcm1pbmFsSWQiOiI2NjYzNTU4NDM2YWZlYzNhMTgwOWEzNjMiLCJyZWxlYXNlU3RhdHVzIjoiUkVMRUFTRUQiLCJzdGF0dXMiOiJBQ1RJVkUiLCJvcmlnaW4iOiJJTkZJTklURSIsInR5cGUiOiJyZWZyZXNoIiwiaXNzIjoibWFuYWdlciIsImlhdCI6MTcxNzc4NzIyNiwiZXhwaXJhdGlvbiI6MTcxNzg0NDgyNiwia2lkIjoicmVmcmVzaDplOTgxNjA3ZS00Yjk3LTQyMDUtODY5Ny1mMDQ2NzE0OWExOTYifQ.MZYxKUdqmb1_I90DVe6EQGTc5zlfHtj9m2DQGqsowJQ"
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "request.terminal.login.body": {
                "required": [
                    "accessCode",
                    "serialNumber",
                    "model",
                    "version"
                ],
                "properties": {
                    "accessCode": {
                        "type": "string",
                        "example": "DV1.88422798"
                    },
                    "serialNumber": {
                        "type": "string",
                        "example": "123"
                    },
                    "model": {
                        "type": "string",
                        "example": "Laptop da Xuxa"
                    },
                    "version": {
                        "type": "string",
                        "example": "9.0"
                    },
                    "force": {
                        "type": "boolean",
                        "example": false
                    }
                },
                "type": "object"
            },
            "PersonListItem": {
                "required": [
                    "name",
                    "addresses",
                    "contacts",
                    "saveAs",
                    "type",
                    "brands",
                    "id",
                    "status"
                ],
                "properties": {
                    "name": {
                        "type": "string",
                        "example": "Virginia Pacheco"
                    },
                    "addresses": {
                        "type": "array",
                        "items": {
                            "properties": {
                                "alias": {
                                    "type": "string",
                                    "example": "trabalho"
                                },
                                "postalCode": {
                                    "type": "string",
                                    "example": "13481-854"
                                },
                                "streetName": {
                                    "type": "string",
                                    "example": "Rua Lázaro Teodoro da Silva"
                                },
                                "streetNumber": {
                                    "type": "string",
                                    "example": "212121"
                                },
                                "neighborhood": {
                                    "type": "string",
                                    "example": "Residencial Recanto Verde"
                                },
                                "city": {
                                    "type": "string",
                                    "example": "Limeira"
                                },
                                "state": {
                                    "type": "string",
                                    "example": "SP"
                                },
                                "country": {
                                    "type": "string",
                                    "example": "Brasil"
                                },
                                "complement": {
                                    "type": "string",
                                    "example": null
                                },
                                "reference": {
                                    "type": "string",
                                    "example": null
                                }
                            },
                            "type": "object"
                        }
                    },
                    "contacts": {
                        "type": "array",
                        "items": {}
                    },
                    "saveAs": {
                        "properties": {
                            "_id": {
                                "properties": {
                                    "$oid": {
                                        "type": "string",
                                        "example": "663cc94eb523d0df760919cd"
                                    }
                                },
                                "type": "object"
                            },
                            "customer": {
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "example": "INACTIVE"
                                    },
                                    "active": {
                                        "type": "boolean",
                                        "example": false
                                    },
                                    "removed": {
                                        "type": "boolean",
                                        "example": true
                                    }
                                },
                                "type": "object"
                            },
                            "employee": {
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "example": "ACTIVE"
                                    },
                                    "active": {
                                        "type": "boolean",
                                        "example": true
                                    },
                                    "removed": {
                                        "type": "boolean",
                                        "example": false
                                    }
                                },
                                "type": "object"
                            },
                            "manufacturer": {
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "example": "INACTIVE"
                                    },
                                    "active": {
                                        "type": "boolean",
                                        "example": false
                                    },
                                    "removed": {
                                        "type": "boolean",
                                        "example": false
                                    }
                                },
                                "type": "object"
                            },
                            "supplier": {
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "example": "ACTIVE"
                                    },
                                    "active": {
                                        "type": "boolean",
                                        "example": true
                                    },
                                    "removed": {
                                        "type": "boolean",
                                        "example": false
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "type": "object"
                    },
                    "type": {
                        "type": "string",
                        "example": "NATURAL_PERSON"
                    },
                    "config": {
                        "type": "null"
                    },
                    "finances": {
                        "properties": {
                            "creditLimit": {
                                "type": "string",
                                "example": "0.00"
                            },
                            "expirationToleranceInDays": {
                                "type": "integer",
                                "example": 0
                            },
                            "expirationType": {
                                "type": "string",
                                "example": "FIXED_DAY"
                            },
                            "pricesTableId": {
                                "type": "string",
                                "example": null
                            },
                            "expirationValue": {
                                "type": "string",
                                "example": "0"
                            },
                            "expirationLimit": {
                                "type": "integer",
                                "example": 0
                            }
                        },
                        "type": "object"
                    },
                    "brands": {
                        "type": "array",
                        "items": {
                            "properties": {
                                "name": {
                                    "type": "string",
                                    "example": "aaaaa"
                                },
                                "id": {
                                    "type": "string",
                                    "example": "6663133336afec3a1809a132"
                                }
                            },
                            "type": "object"
                        }
                    },
                    "authorizedPersons": {
                        "type": "array",
                        "items": {}
                    },
                    "goals": {
                        "type": "array",
                        "items": {
                            "properties": {
                                "value": {
                                    "type": "integer",
                                    "example": 50
                                },
                                "commission": {
                                    "type": "integer",
                                    "example": 20
                                },
                                "transferOfCommission": {
                                    "type": "integer",
                                    "example": 10
                                }
                            },
                            "type": "object"
                        }
                    },
                    "role": {
                        "properties": {
                            "id": {
                                "type": "string",
                                "example": "665454afda5752"
                            },
                            "name": {
                                "type": "string",
                                "example": "ADMIN"
                            }
                        },
                        "type": "object"
                    },
                    "status": {
                        "type": "string",
                        "example": "ACTIVE"
                    }
                },
                "type": "object"
            },
            "metadata": {
                "properties": {
                    "pagination": {
                        "properties": {
                            "pageSize": {
                                "type": "integer",
                                "example": 10
                            },
                            "previousCursor": {
                                "type": "string",
                                "example": "eyJfaWQiOiI2NjNhNWVkMDllMDFlZmE2ZDcwOTM2Y2EiLCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9"
                            },
                            "nextCursor": {
                                "type": "string",
                                "example": "eyJfaWQiOiI2NjNhNWVkMDllMDFlZmE2ZDcwOTM2Y2EiLCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9"
                            },
                            "totalItems": {
                                "type": "integer",
                                "example": 100
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            }
        },
        "responses": {
            "400": {
                "$ref": "#/components/responses/BadRequestResponse"
            },
            "401": {
                "$ref": "#/components/responses/UnauthorizedResponse"
            },
            "500": {
                "$ref": "#/components/responses/InternalServerErrorResponse"
            },
            "BadRequestResponse": {
                "description": "Erro na requisição"
            },
            "UnauthorizedResponse": {
                "description": "Permissão Negada"
            },
            "InternalServerErrorResponse": {
                "description": "Erro interno do servidor"
            }
        },
        "parameters": {
            "search": {
                "name": "search",
                "in": "query",
                "description": "Termo de busca",
                "required": false,
                "schema": {
                    "type": "string",
                    "example": "Galeria 1"
                }
            },
            "sortBy": {
                "name": "sortBy",
                "in": "query",
                "description": "Campo para ordenação",
                "required": false,
                "schema": {
                    "type": "string",
                    "example": "name"
                }
            },
            "asc": {
                "name": "asc",
                "in": "query",
                "description": "Ordenação crescente ou decrescente",
                "required": false,
                "schema": {
                    "type": "string",
                    "enum": [
                        "true",
                        "false"
                    ],
                    "example": "true"
                }
            },
            "cursor": {
                "name": "cursor",
                "in": "query",
                "description": "Cursor da paginação",
                "required": false,
                "schema": {
                    "type": "string",
                    "example": "eyJfaWQiOiI2NjNhNWVkMDllMDFlZmE2ZDcwOTM2Y2EiLCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9"
                }
            },
            "deleted": {
                "name": "deleted",
                "in": "query",
                "description": "Listar registros excluídos",
                "required": false,
                "schema": {
                    "type": "string",
                    "enum": [
                        "true",
                        "false"
                    ],
                    "example": "true"
                }
            },
            "pageSize": {
                "name": "pageSize",
                "in": "query",
                "description": "Quantidade de registros por página",
                "required": false,
                "schema": {
                    "type": "string",
                    "example": "10"
                }
            }
        },
        "requestBodies": {
            "request.terminal.login": {
                "required": true,
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/request.terminal.login.body"
                        },
                        "examples": {
                            "default": {
                                "summary": "Exemplo de payload",
                                "value": {
                                    "accessCode": "DV1.88422798",
                                    "serialNumber": "123",
                                    "model": "Laptop da Xuxa",
                                    "version": "9.0",
                                    "force": false
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}