{
  "openapi": "3.0.0",
  "paths": {
    "/v1/customers": {
      "post": {
        "operationId": "CustomersPublicController_create",
        "summary": "Cria um cliente",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCustomerDto"
              },
              "example": {
                "name": "Cliente Exemplo",
                "doc": "12345678900",
                "email": "maria@example.com"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "tenantId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerType": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "firstName": {
                      "nullable": true
                    },
                    "lastName": {
                      "nullable": true
                    },
                    "nameOfficial": {
                      "nullable": true
                    },
                    "nameDisplay": {
                      "nullable": true
                    },
                    "stateRegistration": {
                      "nullable": true
                    },
                    "municipalRegistration": {
                      "nullable": true
                    },
                    "phone": {
                      "type": "string"
                    },
                    "doc": {
                      "nullable": true
                    },
                    "email": {
                      "type": "string"
                    },
                    "street": {
                      "nullable": true
                    },
                    "number": {
                      "nullable": true
                    },
                    "complement": {
                      "nullable": true
                    },
                    "district": {
                      "nullable": true
                    },
                    "city": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    },
                    "postalCode": {
                      "nullable": true
                    },
                    "country": {
                      "nullable": true
                    },
                    "address": {
                      "nullable": true
                    },
                    "notes": {
                      "nullable": true
                    },
                    "priceTableId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedByUserId": {
                      "nullable": true
                    },
                    "deletedAt": {
                      "nullable": true
                    },
                    "cityIbgeCode": {
                      "nullable": true
                    },
                    "emailOptOutAt": {
                      "nullable": true
                    },
                    "birthDate": {
                      "nullable": true
                    },
                    "creditLimitCents": {
                      "nullable": true
                    },
                    "preferences": {
                      "nullable": true
                    },
                    "lat": {
                      "nullable": true
                    },
                    "lng": {
                      "nullable": true
                    },
                    "geoSource": {
                      "nullable": true
                    },
                    "geoAt": {
                      "nullable": true
                    },
                    "geoStatus": {
                      "type": "string"
                    },
                    "catalogOcultarPrecos": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "id": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                  "customerType": "PF",
                  "name": "Maria Souza",
                  "firstName": null,
                  "lastName": null,
                  "nameOfficial": null,
                  "nameDisplay": null,
                  "stateRegistration": null,
                  "municipalRegistration": null,
                  "phone": "11987654321",
                  "doc": null,
                  "email": "maria.souza@exemplo.com.br",
                  "street": null,
                  "number": null,
                  "complement": null,
                  "district": null,
                  "city": "Itaí",
                  "state": "SP",
                  "postalCode": null,
                  "country": null,
                  "address": null,
                  "notes": null,
                  "priceTableId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "updatedByUserId": null,
                  "deletedAt": null,
                  "cityIbgeCode": null,
                  "emailOptOutAt": null,
                  "birthDate": null,
                  "creditLimitCents": null,
                  "preferences": null,
                  "lat": null,
                  "lng": null,
                  "geoSource": null,
                  "geoAt": null,
                  "geoStatus": "no_cep",
                  "catalogOcultarPrecos": true
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Clientes"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Operador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/customers \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\": \"Cliente Exemplo\", \"doc\": \"12345678900\", \"email\": \"maria@example.com\"}'"
          }
        ],
        "x-papeis": [
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      },
      "get": {
        "operationId": "CustomersPublicController_findAll",
        "summary": "Lista clientes",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Texto a buscar."
          },
          {
            "name": "take",
            "required": false,
            "in": "query",
            "description": "Padrão 50, máximo 200",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Quantos itens pular, para paginar com `take`."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "tenantId": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "customerType": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "firstName": {
                        "nullable": true
                      },
                      "lastName": {
                        "nullable": true
                      },
                      "nameOfficial": {
                        "nullable": true
                      },
                      "nameDisplay": {
                        "nullable": true
                      },
                      "stateRegistration": {
                        "nullable": true
                      },
                      "municipalRegistration": {
                        "nullable": true
                      },
                      "phone": {
                        "type": "string"
                      },
                      "doc": {
                        "nullable": true
                      },
                      "email": {
                        "type": "string"
                      },
                      "street": {
                        "nullable": true
                      },
                      "number": {
                        "nullable": true
                      },
                      "complement": {
                        "nullable": true
                      },
                      "district": {
                        "nullable": true
                      },
                      "city": {
                        "type": "string"
                      },
                      "state": {
                        "type": "string"
                      },
                      "postalCode": {
                        "nullable": true
                      },
                      "country": {
                        "nullable": true
                      },
                      "address": {
                        "nullable": true
                      },
                      "notes": {
                        "nullable": true
                      },
                      "priceTableId": {
                        "nullable": true
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "updatedByUserId": {
                        "nullable": true
                      },
                      "deletedAt": {
                        "nullable": true
                      },
                      "cityIbgeCode": {
                        "nullable": true
                      },
                      "emailOptOutAt": {
                        "nullable": true
                      },
                      "birthDate": {
                        "nullable": true
                      },
                      "creditLimitCents": {
                        "nullable": true
                      },
                      "preferences": {
                        "nullable": true
                      },
                      "lat": {
                        "nullable": true
                      },
                      "lng": {
                        "nullable": true
                      },
                      "geoSource": {
                        "nullable": true
                      },
                      "geoAt": {
                        "nullable": true
                      },
                      "geoStatus": {
                        "type": "string"
                      },
                      "catalogOcultarPrecos": {
                        "type": "boolean"
                      },
                      "hasPendingReceivables": {
                        "type": "boolean"
                      }
                    }
                  }
                },
                "example": [
                  {
                    "id": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                    "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                    "customerType": "PF",
                    "name": "Maria Souza",
                    "firstName": null,
                    "lastName": null,
                    "nameOfficial": null,
                    "nameDisplay": null,
                    "stateRegistration": null,
                    "municipalRegistration": null,
                    "phone": "11987654321",
                    "doc": null,
                    "email": "maria.souza@exemplo.com.br",
                    "street": null,
                    "number": null,
                    "complement": null,
                    "district": null,
                    "city": "Itaí",
                    "state": "SP",
                    "postalCode": null,
                    "country": null,
                    "address": null,
                    "notes": null,
                    "priceTableId": null,
                    "createdAt": "2026-11-12T14:30:00.000Z",
                    "updatedAt": "2026-11-12T14:30:00.000Z",
                    "updatedByUserId": null,
                    "deletedAt": null,
                    "cityIbgeCode": null,
                    "emailOptOutAt": null,
                    "birthDate": null,
                    "creditLimitCents": null,
                    "preferences": null,
                    "lat": null,
                    "lng": null,
                    "geoSource": null,
                    "geoAt": null,
                    "geoStatus": "no_cep",
                    "catalogOcultarPrecos": true,
                    "hasPendingReceivables": false
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Clientes"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Visualizador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl \"https://api.nivro.app/api/v1/customers?search=maria&take=20\" \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Visualizador",
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/customers/{id}": {
      "get": {
        "operationId": "CustomersPublicController_findOne",
        "summary": "Busca um cliente por id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "tenantId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerType": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "firstName": {
                      "nullable": true
                    },
                    "lastName": {
                      "nullable": true
                    },
                    "nameOfficial": {
                      "nullable": true
                    },
                    "nameDisplay": {
                      "nullable": true
                    },
                    "stateRegistration": {
                      "nullable": true
                    },
                    "municipalRegistration": {
                      "nullable": true
                    },
                    "phone": {
                      "type": "string"
                    },
                    "doc": {
                      "nullable": true
                    },
                    "email": {
                      "type": "string"
                    },
                    "street": {
                      "nullable": true
                    },
                    "number": {
                      "nullable": true
                    },
                    "complement": {
                      "nullable": true
                    },
                    "district": {
                      "nullable": true
                    },
                    "city": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    },
                    "postalCode": {
                      "nullable": true
                    },
                    "country": {
                      "nullable": true
                    },
                    "address": {
                      "nullable": true
                    },
                    "notes": {
                      "nullable": true
                    },
                    "priceTableId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedByUserId": {
                      "nullable": true
                    },
                    "deletedAt": {
                      "nullable": true
                    },
                    "cityIbgeCode": {
                      "nullable": true
                    },
                    "emailOptOutAt": {
                      "nullable": true
                    },
                    "birthDate": {
                      "nullable": true
                    },
                    "creditLimitCents": {
                      "nullable": true
                    },
                    "preferences": {
                      "nullable": true
                    },
                    "lat": {
                      "nullable": true
                    },
                    "lng": {
                      "nullable": true
                    },
                    "geoSource": {
                      "nullable": true
                    },
                    "geoAt": {
                      "nullable": true
                    },
                    "geoStatus": {
                      "type": "string"
                    },
                    "catalogOcultarPrecos": {
                      "type": "boolean"
                    },
                    "cepLat": {
                      "nullable": true
                    },
                    "cepLng": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "id": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                  "customerType": "PF",
                  "name": "Maria Souza",
                  "firstName": null,
                  "lastName": null,
                  "nameOfficial": null,
                  "nameDisplay": null,
                  "stateRegistration": null,
                  "municipalRegistration": null,
                  "phone": "11987654321",
                  "doc": null,
                  "email": "maria.souza@exemplo.com.br",
                  "street": null,
                  "number": null,
                  "complement": null,
                  "district": null,
                  "city": "Itaí",
                  "state": "SP",
                  "postalCode": null,
                  "country": null,
                  "address": null,
                  "notes": null,
                  "priceTableId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "updatedByUserId": null,
                  "deletedAt": null,
                  "cityIbgeCode": null,
                  "emailOptOutAt": null,
                  "birthDate": null,
                  "creditLimitCents": null,
                  "preferences": null,
                  "lat": null,
                  "lng": null,
                  "geoSource": null,
                  "geoAt": null,
                  "geoStatus": "no_cep",
                  "catalogOcultarPrecos": true,
                  "cepLat": null,
                  "cepLng": null
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Clientes"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Visualizador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl https://api.nivro.app/api/v1/customers/CUSTOMER_ID \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Visualizador",
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/products": {
      "post": {
        "operationId": "ProductsPublicController_create",
        "summary": "Cria um produto ou serviço",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProductDto"
              },
              "example": {
                "name": "Refrigerante 2L",
                "type": "PRODUCT",
                "sku": "REF-2L",
                "price": "8.90",
                "cost": "5.50",
                "unit": "UN"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "tenantId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "sku": {
                      "type": "string"
                    },
                    "price": {
                      "type": "string"
                    },
                    "cost": {
                      "type": "string"
                    },
                    "avgCost": {
                      "nullable": true
                    },
                    "avgCostUpdatedAt": {
                      "nullable": true
                    },
                    "unit": {
                      "type": "string"
                    },
                    "categoryId": {
                      "nullable": true
                    },
                    "photoUrl": {
                      "nullable": true
                    },
                    "photoKey": {
                      "nullable": true
                    },
                    "photoThumbUrl": {
                      "nullable": true
                    },
                    "photoThumbKey": {
                      "nullable": true
                    },
                    "minStock": {
                      "type": "integer"
                    },
                    "maxStock": {
                      "nullable": true
                    },
                    "reorderPoint": {
                      "nullable": true
                    },
                    "hiddenFromSales": {
                      "type": "boolean"
                    },
                    "allowsFractionalQty": {
                      "nullable": true
                    },
                    "costingMethod": {
                      "type": "string"
                    },
                    "trackingMode": {
                      "type": "string"
                    },
                    "commissionPercentage": {
                      "nullable": true
                    },
                    "ncm": {
                      "nullable": true
                    },
                    "cest": {
                      "nullable": true
                    },
                    "cfopDefault": {
                      "nullable": true
                    },
                    "origem": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedByUserId": {
                      "nullable": true
                    },
                    "deletedAt": {
                      "nullable": true
                    },
                    "itemListaServico": {
                      "nullable": true
                    },
                    "icmsCst": {
                      "nullable": true
                    },
                    "icmsAliquota": {
                      "nullable": true
                    },
                    "cfopSufixoVenda": {
                      "nullable": true
                    },
                    "tracksExpiry": {
                      "nullable": true
                    },
                    "pisCst": {
                      "nullable": true
                    },
                    "pisAliquota": {
                      "nullable": true
                    },
                    "cofinsCst": {
                      "nullable": true
                    },
                    "cofinsAliquota": {
                      "nullable": true
                    },
                    "cBenef": {
                      "nullable": true
                    },
                    "ibsCbsCst": {
                      "nullable": true
                    },
                    "ibsCbsClassTrib": {
                      "nullable": true
                    },
                    "brand": {
                      "type": "string"
                    },
                    "promotionalPrice": {
                      "nullable": true
                    },
                    "promotionStartsAt": {
                      "nullable": true
                    },
                    "promotionEndsAt": {
                      "nullable": true
                    },
                    "bomYield": {
                      "type": "string"
                    },
                    "bomProcessLossPercent": {
                      "type": "string"
                    },
                    "promotionPercent": {
                      "nullable": true
                    },
                    "rentable": {
                      "type": "boolean"
                    },
                    "rentPrice": {
                      "nullable": true
                    },
                    "rentUnit": {
                      "nullable": true
                    },
                    "rentMinPeriods": {
                      "type": "integer"
                    },
                    "replacementPrice": {
                      "nullable": true
                    },
                    "defaultVariantId": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "id": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                  "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                  "name": "Camiseta básica",
                  "type": "PRODUCT",
                  "sku": "CAM-001",
                  "price": "59.9",
                  "cost": "24",
                  "avgCost": null,
                  "avgCostUpdatedAt": null,
                  "unit": "un",
                  "categoryId": null,
                  "photoUrl": null,
                  "photoKey": null,
                  "photoThumbUrl": null,
                  "photoThumbKey": null,
                  "minStock": 0,
                  "maxStock": null,
                  "reorderPoint": null,
                  "hiddenFromSales": false,
                  "allowsFractionalQty": null,
                  "costingMethod": "WEIGHTED_AVERAGE",
                  "trackingMode": "NONE",
                  "commissionPercentage": null,
                  "ncm": null,
                  "cest": null,
                  "cfopDefault": null,
                  "origem": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "updatedByUserId": null,
                  "deletedAt": null,
                  "itemListaServico": null,
                  "icmsCst": null,
                  "icmsAliquota": null,
                  "cfopSufixoVenda": null,
                  "tracksExpiry": null,
                  "pisCst": null,
                  "pisAliquota": null,
                  "cofinsCst": null,
                  "cofinsAliquota": null,
                  "cBenef": null,
                  "ibsCbsCst": null,
                  "ibsCbsClassTrib": null,
                  "brand": "Nivro",
                  "promotionalPrice": null,
                  "promotionStartsAt": null,
                  "promotionEndsAt": null,
                  "bomYield": "1",
                  "bomProcessLossPercent": "0",
                  "promotionPercent": null,
                  "rentable": false,
                  "rentPrice": null,
                  "rentUnit": null,
                  "rentMinPeriods": 1,
                  "replacementPrice": null,
                  "defaultVariantId": "bf22bdb9-161b-49c9-8030-3e3ccbb63001"
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Produtos"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/products \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\": \"Refrigerante 2L\", \"type\": \"PRODUCT\", \"sku\": \"REF-2L\", \"price\": \"8.90\", \"cost\": \"5.50\", \"unit\": \"UN\"}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      },
      "get": {
        "operationId": "ProductsPublicController_findAll",
        "summary": "Lista produtos e serviços",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Texto a buscar."
          },
          {
            "name": "type",
            "required": false,
            "in": "query",
            "description": "Filtra pelo tipo do item do catálogo",
            "schema": {
              "enum": [
                "PRODUCT",
                "SERVICE"
              ],
              "type": "string"
            }
          },
          {
            "name": "take",
            "required": false,
            "in": "query",
            "description": "Padrão 50, máximo 200",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Quantos itens pular, para paginar com `take`."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "name": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string"
                      },
                      "sku": {
                        "type": "string"
                      },
                      "brand": {
                        "type": "string"
                      },
                      "price": {
                        "type": "string"
                      },
                      "promotionalPrice": {
                        "nullable": true
                      },
                      "promotionPercent": {
                        "nullable": true
                      },
                      "promotionStartsAt": {
                        "nullable": true
                      },
                      "promotionEndsAt": {
                        "nullable": true
                      },
                      "cost": {
                        "type": "string"
                      },
                      "avgCost": {
                        "type": "string"
                      },
                      "ncm": {
                        "nullable": true
                      },
                      "cest": {
                        "nullable": true
                      },
                      "cfopDefault": {
                        "nullable": true
                      },
                      "origem": {
                        "nullable": true
                      },
                      "unit": {
                        "type": "string"
                      },
                      "categoryId": {
                        "nullable": true
                      },
                      "photoUrl": {
                        "nullable": true
                      },
                      "photoKey": {
                        "nullable": true
                      },
                      "photoThumbUrl": {
                        "nullable": true
                      },
                      "photoThumbKey": {
                        "nullable": true
                      },
                      "minStock": {
                        "type": "integer"
                      },
                      "maxStock": {
                        "nullable": true
                      },
                      "reorderPoint": {
                        "nullable": true
                      },
                      "allowsFractionalQty": {
                        "nullable": true
                      },
                      "hiddenFromSales": {
                        "type": "boolean"
                      },
                      "trackingMode": {
                        "type": "string"
                      },
                      "rentable": {
                        "type": "boolean"
                      },
                      "rentPrice": {
                        "nullable": true
                      },
                      "rentUnit": {
                        "nullable": true
                      },
                      "rentMinPeriods": {
                        "type": "integer"
                      },
                      "replacementPrice": {
                        "nullable": true
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "stock_quantity": {
                        "type": "string"
                      },
                      "na_rua": {
                        "type": "integer"
                      },
                      "abaixo_do_minimo": {
                        "type": "boolean"
                      },
                      "category_name": {
                        "nullable": true
                      },
                      "category_slug": {
                        "nullable": true
                      },
                      "category_hidden_from_sales": {
                        "nullable": true
                      },
                      "variant_count": {
                        "type": "integer"
                      },
                      "variant_labels": {
                        "nullable": true
                      },
                      "variant_labels_in_stock": {
                        "nullable": true
                      },
                      "currentStock": {
                        "type": "integer"
                      },
                      "naRua": {
                        "type": "integer"
                      },
                      "abaixoDoMinimo": {
                        "type": "boolean"
                      },
                      "variantCount": {
                        "type": "integer"
                      },
                      "variantLabels": {
                        "nullable": true
                      },
                      "variantLabelsInStock": {
                        "nullable": true
                      },
                      "category": {
                        "nullable": true
                      },
                      "patrimonio": {
                        "type": "integer"
                      },
                      "promotionActive": {
                        "type": "boolean"
                      }
                    }
                  }
                },
                "example": [
                  {
                    "id": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                    "name": "Camiseta básica",
                    "type": "PRODUCT",
                    "sku": "CAM-001",
                    "brand": "Nivro",
                    "price": "64.9",
                    "promotionalPrice": null,
                    "promotionPercent": null,
                    "promotionStartsAt": null,
                    "promotionEndsAt": null,
                    "cost": "24",
                    "avgCost": "24",
                    "ncm": null,
                    "cest": null,
                    "cfopDefault": null,
                    "origem": null,
                    "unit": "un",
                    "categoryId": null,
                    "photoUrl": null,
                    "photoKey": null,
                    "photoThumbUrl": null,
                    "photoThumbKey": null,
                    "minStock": 0,
                    "maxStock": null,
                    "reorderPoint": null,
                    "allowsFractionalQty": null,
                    "hiddenFromSales": false,
                    "trackingMode": "NONE",
                    "rentable": false,
                    "rentPrice": null,
                    "rentUnit": null,
                    "rentMinPeriods": 1,
                    "replacementPrice": null,
                    "createdAt": "2026-11-12T14:30:00.000Z",
                    "stock_quantity": "40",
                    "na_rua": 0,
                    "abaixo_do_minimo": false,
                    "category_name": null,
                    "category_slug": null,
                    "category_hidden_from_sales": null,
                    "variant_count": 0,
                    "variant_labels": null,
                    "variant_labels_in_stock": null,
                    "currentStock": 40,
                    "naRua": 0,
                    "abaixoDoMinimo": false,
                    "variantCount": 0,
                    "variantLabels": null,
                    "variantLabelsInStock": null,
                    "category": null,
                    "patrimonio": 40,
                    "promotionActive": false
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Produtos"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Lista produtos. Use type=PRODUCT ou type=SERVICE para filtrar apenas um dos dois. O catálogo do Nivro trata serviços como um tipo de produto sem estoque.\n\n**Papel mínimo do token:** Visualizador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl \"https://api.nivro.app/api/v1/products?type=SERVICE&take=20\" \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Visualizador",
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/products/{id}": {
      "put": {
        "operationId": "ProductsPublicController_update",
        "summary": "Atualiza um produto ou serviço",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProductDto"
              },
              "example": {
                "price": "9.90",
                "minStock": 10
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "sku": {
                      "type": "string"
                    },
                    "brand": {
                      "type": "string"
                    },
                    "price": {
                      "type": "string"
                    },
                    "promotionalPrice": {
                      "nullable": true
                    },
                    "promotionPercent": {
                      "nullable": true
                    },
                    "promotionStartsAt": {
                      "nullable": true
                    },
                    "promotionEndsAt": {
                      "nullable": true
                    },
                    "cost": {
                      "type": "string"
                    },
                    "avgCost": {
                      "type": "string"
                    },
                    "ncm": {
                      "nullable": true
                    },
                    "cest": {
                      "nullable": true
                    },
                    "cfopDefault": {
                      "nullable": true
                    },
                    "origem": {
                      "nullable": true
                    },
                    "unit": {
                      "type": "string"
                    },
                    "categoryId": {
                      "nullable": true
                    },
                    "photoUrl": {
                      "nullable": true
                    },
                    "photoKey": {
                      "nullable": true
                    },
                    "photoThumbUrl": {
                      "nullable": true
                    },
                    "photoThumbKey": {
                      "nullable": true
                    },
                    "minStock": {
                      "type": "integer"
                    },
                    "maxStock": {
                      "nullable": true
                    },
                    "reorderPoint": {
                      "nullable": true
                    },
                    "commissionPercentage": {
                      "nullable": true
                    },
                    "allowsFractionalQty": {
                      "nullable": true
                    },
                    "tracksExpiry": {
                      "nullable": true
                    },
                    "hiddenFromSales": {
                      "type": "boolean"
                    },
                    "trackingMode": {
                      "type": "string"
                    },
                    "rentable": {
                      "type": "boolean"
                    },
                    "rentPrice": {
                      "nullable": true
                    },
                    "rentUnit": {
                      "nullable": true
                    },
                    "rentMinPeriods": {
                      "type": "integer"
                    },
                    "replacementPrice": {
                      "nullable": true
                    },
                    "icmsCst": {
                      "nullable": true
                    },
                    "icmsAliquota": {
                      "nullable": true
                    },
                    "cfopSufixoVenda": {
                      "nullable": true
                    },
                    "pisCst": {
                      "nullable": true
                    },
                    "pisAliquota": {
                      "nullable": true
                    },
                    "cofinsCst": {
                      "nullable": true
                    },
                    "cofinsAliquota": {
                      "nullable": true
                    },
                    "cBenef": {
                      "nullable": true
                    },
                    "ibsCbsCst": {
                      "nullable": true
                    },
                    "ibsCbsClassTrib": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "currentStock": {
                      "type": "integer"
                    },
                    "naRua": {
                      "type": "integer"
                    },
                    "patrimonio": {
                      "type": "integer"
                    },
                    "abaixoDoMinimo": {
                      "type": "boolean"
                    },
                    "expiryTracking": {
                      "type": "object",
                      "properties": {
                        "rastreia": {
                          "type": "boolean"
                        },
                        "origem": {
                          "type": "string"
                        },
                        "categoriaNome": {
                          "nullable": true
                        }
                      }
                    },
                    "variantCount": {
                      "type": "integer"
                    },
                    "promotionActive": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "id": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                  "name": "Camiseta básica",
                  "type": "PRODUCT",
                  "sku": "CAM-001",
                  "brand": "Nivro",
                  "price": "64.9",
                  "promotionalPrice": null,
                  "promotionPercent": null,
                  "promotionStartsAt": null,
                  "promotionEndsAt": null,
                  "cost": "24",
                  "avgCost": "24",
                  "ncm": null,
                  "cest": null,
                  "cfopDefault": null,
                  "origem": null,
                  "unit": "un",
                  "categoryId": null,
                  "photoUrl": null,
                  "photoKey": null,
                  "photoThumbUrl": null,
                  "photoThumbKey": null,
                  "minStock": 0,
                  "maxStock": null,
                  "reorderPoint": null,
                  "commissionPercentage": null,
                  "allowsFractionalQty": null,
                  "tracksExpiry": null,
                  "hiddenFromSales": false,
                  "trackingMode": "NONE",
                  "rentable": false,
                  "rentPrice": null,
                  "rentUnit": null,
                  "rentMinPeriods": 1,
                  "replacementPrice": null,
                  "icmsCst": null,
                  "icmsAliquota": null,
                  "cfopSufixoVenda": null,
                  "pisCst": null,
                  "pisAliquota": null,
                  "cofinsCst": null,
                  "cofinsAliquota": null,
                  "cBenef": null,
                  "ibsCbsCst": null,
                  "ibsCbsClassTrib": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "currentStock": 40,
                  "naRua": 0,
                  "patrimonio": 40,
                  "abaixoDoMinimo": false,
                  "expiryTracking": {
                    "rastreia": false,
                    "origem": "padrao",
                    "categoriaNome": null
                  },
                  "variantCount": 0,
                  "promotionActive": false
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Produtos"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Atualiza um produto ou serviço. Todos os campos são opcionais: envie apenas o que deseja alterar.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X PUT https://api.nivro.app/api/v1/products/PRODUCT_ID \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"price\": \"9.90\", \"minStock\": 10}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      },
      "get": {
        "operationId": "ProductsPublicController_findOne",
        "summary": "Busca um produto por id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "sku": {
                      "type": "string"
                    },
                    "brand": {
                      "type": "string"
                    },
                    "price": {
                      "type": "string"
                    },
                    "promotionalPrice": {
                      "nullable": true
                    },
                    "promotionPercent": {
                      "nullable": true
                    },
                    "promotionStartsAt": {
                      "nullable": true
                    },
                    "promotionEndsAt": {
                      "nullable": true
                    },
                    "cost": {
                      "type": "string"
                    },
                    "avgCost": {
                      "type": "string"
                    },
                    "ncm": {
                      "nullable": true
                    },
                    "cest": {
                      "nullable": true
                    },
                    "cfopDefault": {
                      "nullable": true
                    },
                    "origem": {
                      "nullable": true
                    },
                    "unit": {
                      "type": "string"
                    },
                    "categoryId": {
                      "nullable": true
                    },
                    "photoUrl": {
                      "nullable": true
                    },
                    "photoKey": {
                      "nullable": true
                    },
                    "photoThumbUrl": {
                      "nullable": true
                    },
                    "photoThumbKey": {
                      "nullable": true
                    },
                    "minStock": {
                      "type": "integer"
                    },
                    "maxStock": {
                      "nullable": true
                    },
                    "reorderPoint": {
                      "nullable": true
                    },
                    "commissionPercentage": {
                      "nullable": true
                    },
                    "allowsFractionalQty": {
                      "nullable": true
                    },
                    "tracksExpiry": {
                      "nullable": true
                    },
                    "hiddenFromSales": {
                      "type": "boolean"
                    },
                    "trackingMode": {
                      "type": "string"
                    },
                    "rentable": {
                      "type": "boolean"
                    },
                    "rentPrice": {
                      "nullable": true
                    },
                    "rentUnit": {
                      "nullable": true
                    },
                    "rentMinPeriods": {
                      "type": "integer"
                    },
                    "replacementPrice": {
                      "nullable": true
                    },
                    "icmsCst": {
                      "nullable": true
                    },
                    "icmsAliquota": {
                      "nullable": true
                    },
                    "cfopSufixoVenda": {
                      "nullable": true
                    },
                    "pisCst": {
                      "nullable": true
                    },
                    "pisAliquota": {
                      "nullable": true
                    },
                    "cofinsCst": {
                      "nullable": true
                    },
                    "cofinsAliquota": {
                      "nullable": true
                    },
                    "cBenef": {
                      "nullable": true
                    },
                    "ibsCbsCst": {
                      "nullable": true
                    },
                    "ibsCbsClassTrib": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "currentStock": {
                      "type": "integer"
                    },
                    "naRua": {
                      "type": "integer"
                    },
                    "patrimonio": {
                      "type": "integer"
                    },
                    "abaixoDoMinimo": {
                      "type": "boolean"
                    },
                    "expiryTracking": {
                      "type": "object",
                      "properties": {
                        "rastreia": {
                          "type": "boolean"
                        },
                        "origem": {
                          "type": "string"
                        },
                        "categoriaNome": {
                          "nullable": true
                        }
                      }
                    },
                    "variantCount": {
                      "type": "integer"
                    },
                    "promotionActive": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "id": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                  "name": "Camiseta básica",
                  "type": "PRODUCT",
                  "sku": "CAM-001",
                  "brand": "Nivro",
                  "price": "64.9",
                  "promotionalPrice": null,
                  "promotionPercent": null,
                  "promotionStartsAt": null,
                  "promotionEndsAt": null,
                  "cost": "24",
                  "avgCost": "24",
                  "ncm": null,
                  "cest": null,
                  "cfopDefault": null,
                  "origem": null,
                  "unit": "un",
                  "categoryId": null,
                  "photoUrl": null,
                  "photoKey": null,
                  "photoThumbUrl": null,
                  "photoThumbKey": null,
                  "minStock": 0,
                  "maxStock": null,
                  "reorderPoint": null,
                  "commissionPercentage": null,
                  "allowsFractionalQty": null,
                  "tracksExpiry": null,
                  "hiddenFromSales": false,
                  "trackingMode": "NONE",
                  "rentable": false,
                  "rentPrice": null,
                  "rentUnit": null,
                  "rentMinPeriods": 1,
                  "replacementPrice": null,
                  "icmsCst": null,
                  "icmsAliquota": null,
                  "cfopSufixoVenda": null,
                  "pisCst": null,
                  "pisAliquota": null,
                  "cofinsCst": null,
                  "cofinsAliquota": null,
                  "cBenef": null,
                  "ibsCbsCst": null,
                  "ibsCbsClassTrib": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "currentStock": 40,
                  "naRua": 0,
                  "patrimonio": 40,
                  "abaixoDoMinimo": false,
                  "expiryTracking": {
                    "rastreia": false,
                    "origem": "padrao",
                    "categoriaNome": null
                  },
                  "variantCount": 0,
                  "promotionActive": false
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Produtos"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Visualizador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl https://api.nivro.app/api/v1/products/PRODUCT_ID \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Visualizador",
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/products/{id}/variants": {
      "get": {
        "operationId": "ProductsPublicController_variantsOf",
        "summary": "Variações do produto (grade: tamanho e cor), com o saldo de cada uma",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          },
          {
            "name": "includeInactive",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Use `true` para incluir também as variações inativas."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "sku": {
                        "type": "string"
                      },
                      "name": {
                        "nullable": true
                      },
                      "attributes": {
                        "nullable": true
                      },
                      "price": {
                        "nullable": true
                      },
                      "minStock": {
                        "nullable": true
                      },
                      "reorderPoint": {
                        "nullable": true
                      },
                      "isDefault": {
                        "type": "boolean"
                      },
                      "active": {
                        "type": "boolean"
                      },
                      "quantity": {
                        "type": "integer"
                      },
                      "naRua": {
                        "type": "integer"
                      },
                      "code": {
                        "type": "string"
                      }
                    }
                  }
                },
                "example": [
                  {
                    "id": "bf22bdb9-161b-49c9-8030-3e3ccbb63001",
                    "sku": "CAM-001",
                    "name": null,
                    "attributes": null,
                    "price": null,
                    "minStock": null,
                    "reorderPoint": null,
                    "isDefault": true,
                    "active": true,
                    "quantity": 40,
                    "naRua": 0,
                    "code": "CAM-001"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Produtos"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Variações do produto (grade de tamanho e cor), com o saldo de cada uma. Use o `id` da variação como `variantId` ao vender ou criar pedido.\n\n**Papel mínimo do token:** Visualizador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl https://api.nivro.app/api/v1/products/PRODUCT_ID/variants \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Visualizador",
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/orders": {
      "post": {
        "operationId": "OrdersPublicController_create",
        "summary": "Cria um pedido",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderDto"
              },
              "example": {
                "customerId": "CUSTOMER_ID",
                "items": [
                  {
                    "productId": "PRODUCT_ID",
                    "qty": 2,
                    "unitPrice": "49.90",
                    "costAtTime": "20.00"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "tenantId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "sellerId": {
                      "nullable": true
                    },
                    "status": {
                      "type": "string"
                    },
                    "subtotal": {
                      "type": "string"
                    },
                    "discountTotal": {
                      "type": "string"
                    },
                    "taxTotal": {
                      "type": "string"
                    },
                    "total": {
                      "type": "string"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "deliveryAt": {
                      "nullable": true
                    },
                    "saleId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "convertedAt": {
                      "nullable": true
                    },
                    "cancelledAt": {
                      "nullable": true
                    },
                    "cancelledByUserId": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "customerResponse": {
                      "type": "string"
                    },
                    "customerRespondedAt": {
                      "nullable": true
                    },
                    "validUntil": {
                      "nullable": true
                    },
                    "quoteExpiredNotifiedAt": {
                      "nullable": true
                    },
                    "cobranca": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "deliveryFeeTotal": {
                      "type": "string"
                    },
                    "pedeAprovacao": {
                      "type": "boolean"
                    },
                    "number": {
                      "type": "integer"
                    },
                    "codigo": {
                      "type": "string"
                    },
                    "precoOcultoAoCliente": {
                      "type": "boolean"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerNameOfficial": {
                      "nullable": true
                    },
                    "customerNameDisplay": {
                      "nullable": true
                    },
                    "customerDoc": {
                      "nullable": true
                    },
                    "customerType": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "customerStreet": {
                      "nullable": true
                    },
                    "customerNumber": {
                      "nullable": true
                    },
                    "customerComplement": {
                      "nullable": true
                    },
                    "customerDistrict": {
                      "nullable": true
                    },
                    "customerCity": {
                      "type": "string"
                    },
                    "customerState": {
                      "type": "string"
                    },
                    "customerPostalCode": {
                      "nullable": true
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "qty": {
                            "type": "integer"
                          },
                          "total": {
                            "type": "number"
                          },
                          "discount": {
                            "type": "integer"
                          },
                          "pickedAt": {
                            "nullable": true
                          },
                          "pickedQty": {
                            "nullable": true
                          },
                          "productId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "unitPrice": {
                            "type": "number"
                          },
                          "variantId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "costAtTime": {
                            "type": "integer"
                          },
                          "unitSerial": {
                            "nullable": true
                          },
                          "productName": {
                            "type": "string"
                          },
                          "productType": {
                            "type": "string"
                          },
                          "variantName": {
                            "nullable": true
                          },
                          "photoThumbUrl": {
                            "nullable": true
                          }
                        }
                      }
                    },
                    "history": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "toStatus": {
                            "type": "string"
                          },
                          "changedBy": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "fromStatus": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "schedule": {
                      "nullable": true
                    },
                    "delivery": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "id": "207f0a24-06fc-4659-8e72-4c4b3046356a",
                  "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "sellerId": null,
                  "status": "CONFIRMED",
                  "subtotal": "194.7",
                  "discountTotal": "0",
                  "taxTotal": "0",
                  "total": "194.7",
                  "notes": null,
                  "deliveryAt": null,
                  "saleId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "convertedAt": null,
                  "cancelledAt": null,
                  "cancelledByUserId": null,
                  "cancelReason": null,
                  "customerResponse": "PENDING",
                  "customerRespondedAt": null,
                  "validUntil": null,
                  "quoteExpiredNotifiedAt": null,
                  "cobranca": "ANTECIPADA",
                  "source": "INTERNO",
                  "deliveryFeeTotal": "0",
                  "pedeAprovacao": true,
                  "number": 1,
                  "codigo": "00001",
                  "precoOcultoAoCliente": false,
                  "customerName": "Maria Souza",
                  "customerNameOfficial": null,
                  "customerNameDisplay": null,
                  "customerDoc": null,
                  "customerType": "PF",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "customerStreet": null,
                  "customerNumber": null,
                  "customerComplement": null,
                  "customerDistrict": null,
                  "customerCity": "Itaí",
                  "customerState": "SP",
                  "customerPostalCode": null,
                  "items": [
                    {
                      "id": "0b49140a-3678-4587-8616-424069287325",
                      "qty": 3,
                      "total": 194.7,
                      "discount": 0,
                      "pickedAt": null,
                      "pickedQty": null,
                      "productId": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                      "unitPrice": 64.9,
                      "variantId": "bf22bdb9-161b-49c9-8030-3e3ccbb63001",
                      "costAtTime": 24,
                      "unitSerial": null,
                      "productName": "Camiseta básica",
                      "productType": "PRODUCT",
                      "variantName": null,
                      "photoThumbUrl": null
                    }
                  ],
                  "history": [
                    {
                      "toStatus": "CONFIRMED",
                      "changedBy": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z",
                      "fromStatus": "DRAFT"
                    }
                  ],
                  "schedule": null,
                  "delivery": null
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Pedidos"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Operador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/orders \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"customerId\": \"CUSTOMER_ID\",\n    \"items\": [{ \"productId\": \"PRODUCT_ID\", \"qty\": 2, \"unitPrice\": \"49.90\", \"costAtTime\": \"20.00\" }]\n  }'"
          }
        ],
        "x-papeis": [
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      },
      "get": {
        "operationId": "OrdersPublicController_findAll",
        "summary": "Lista pedidos",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Situação a filtrar."
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Página, a partir de 1."
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Padrão 50, máximo 200",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "startDate",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data inicial, AAAA-MM-DD."
          },
          {
            "name": "endDate",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data final, AAAA-MM-DD. O período vai até 366 dias."
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Código, número do pedido ou nome do cliente",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customerId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Id do cliente."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "tenantId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "customerId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "sellerId": {
                            "nullable": true
                          },
                          "status": {
                            "type": "string"
                          },
                          "subtotal": {
                            "type": "string"
                          },
                          "discountTotal": {
                            "type": "string"
                          },
                          "taxTotal": {
                            "type": "string"
                          },
                          "total": {
                            "type": "string"
                          },
                          "notes": {
                            "nullable": true
                          },
                          "deliveryAt": {
                            "nullable": true
                          },
                          "saleId": {
                            "nullable": true
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "convertedAt": {
                            "nullable": true
                          },
                          "cancelledAt": {
                            "nullable": true
                          },
                          "cancelledByUserId": {
                            "nullable": true
                          },
                          "cancelReason": {
                            "nullable": true
                          },
                          "customerResponse": {
                            "type": "string"
                          },
                          "customerRespondedAt": {
                            "nullable": true
                          },
                          "validUntil": {
                            "nullable": true
                          },
                          "quoteExpiredNotifiedAt": {
                            "nullable": true
                          },
                          "cobranca": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string"
                          },
                          "deliveryFeeTotal": {
                            "type": "string"
                          },
                          "pedeAprovacao": {
                            "type": "boolean"
                          },
                          "number": {
                            "type": "integer"
                          },
                          "codigo": {
                            "type": "string"
                          },
                          "precoOcultoAoCliente": {
                            "type": "boolean"
                          },
                          "customerName": {
                            "type": "string"
                          },
                          "itemCount": {
                            "type": "integer"
                          },
                          "items": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "productId": {
                                  "type": "string",
                                  "format": "uuid"
                                },
                                "variantId": {
                                  "type": "string",
                                  "format": "uuid"
                                },
                                "variantName": {
                                  "nullable": true
                                },
                                "qty": {
                                  "type": "integer"
                                },
                                "unitPrice": {
                                  "type": "number"
                                }
                              }
                            }
                          },
                          "schedule": {
                            "nullable": true
                          },
                          "advanceHeldCents": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer"
                        },
                        "page": {
                          "type": "integer"
                        },
                        "limit": {
                          "type": "integer"
                        },
                        "totalPages": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "207f0a24-06fc-4659-8e72-4c4b3046356a",
                      "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                      "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                      "sellerId": null,
                      "status": "CONFIRMED",
                      "subtotal": "194.7",
                      "discountTotal": "0",
                      "taxTotal": "0",
                      "total": "194.7",
                      "notes": null,
                      "deliveryAt": null,
                      "saleId": null,
                      "createdAt": "2026-11-12T14:30:00.000Z",
                      "updatedAt": "2026-11-12T14:30:00.000Z",
                      "convertedAt": null,
                      "cancelledAt": null,
                      "cancelledByUserId": null,
                      "cancelReason": null,
                      "customerResponse": "PENDING",
                      "customerRespondedAt": null,
                      "validUntil": null,
                      "quoteExpiredNotifiedAt": null,
                      "cobranca": "ANTECIPADA",
                      "source": "INTERNO",
                      "deliveryFeeTotal": "0",
                      "pedeAprovacao": true,
                      "number": 1,
                      "codigo": "00001",
                      "precoOcultoAoCliente": false,
                      "customerName": "Maria Souza",
                      "itemCount": 1,
                      "items": [
                        {
                          "productId": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                          "variantId": "bf22bdb9-161b-49c9-8030-3e3ccbb63001",
                          "variantName": null,
                          "qty": 3,
                          "unitPrice": 64.9
                        }
                      ],
                      "schedule": null,
                      "advanceHeldCents": 0
                    }
                  ],
                  "meta": {
                    "total": 1,
                    "page": 1,
                    "limit": 20,
                    "totalPages": 1
                  }
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Pedidos"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Visualizador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl \"https://api.nivro.app/api/v1/orders?status=CONFIRMED,SEPARATED&limit=20\" \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Visualizador",
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/orders/{id}": {
      "get": {
        "operationId": "OrdersPublicController_findOne",
        "summary": "Busca um pedido por id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "tenantId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "sellerId": {
                      "nullable": true
                    },
                    "status": {
                      "type": "string"
                    },
                    "subtotal": {
                      "type": "string"
                    },
                    "discountTotal": {
                      "type": "string"
                    },
                    "taxTotal": {
                      "type": "string"
                    },
                    "total": {
                      "type": "string"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "deliveryAt": {
                      "nullable": true
                    },
                    "saleId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "convertedAt": {
                      "nullable": true
                    },
                    "cancelledAt": {
                      "nullable": true
                    },
                    "cancelledByUserId": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "customerResponse": {
                      "type": "string"
                    },
                    "customerRespondedAt": {
                      "nullable": true
                    },
                    "validUntil": {
                      "nullable": true
                    },
                    "quoteExpiredNotifiedAt": {
                      "nullable": true
                    },
                    "cobranca": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "deliveryFeeTotal": {
                      "type": "string"
                    },
                    "pedeAprovacao": {
                      "type": "boolean"
                    },
                    "number": {
                      "type": "integer"
                    },
                    "codigo": {
                      "type": "string"
                    },
                    "precoOcultoAoCliente": {
                      "type": "boolean"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerNameOfficial": {
                      "nullable": true
                    },
                    "customerNameDisplay": {
                      "nullable": true
                    },
                    "customerDoc": {
                      "nullable": true
                    },
                    "customerType": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "customerStreet": {
                      "nullable": true
                    },
                    "customerNumber": {
                      "nullable": true
                    },
                    "customerComplement": {
                      "nullable": true
                    },
                    "customerDistrict": {
                      "nullable": true
                    },
                    "customerCity": {
                      "type": "string"
                    },
                    "customerState": {
                      "type": "string"
                    },
                    "customerPostalCode": {
                      "nullable": true
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "qty": {
                            "type": "integer"
                          },
                          "total": {
                            "type": "number"
                          },
                          "discount": {
                            "type": "integer"
                          },
                          "pickedAt": {
                            "nullable": true
                          },
                          "pickedQty": {
                            "nullable": true
                          },
                          "productId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "unitPrice": {
                            "type": "number"
                          },
                          "variantId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "costAtTime": {
                            "type": "integer"
                          },
                          "unitSerial": {
                            "nullable": true
                          },
                          "productName": {
                            "type": "string"
                          },
                          "productType": {
                            "type": "string"
                          },
                          "variantName": {
                            "nullable": true
                          },
                          "photoThumbUrl": {
                            "nullable": true
                          }
                        }
                      }
                    },
                    "history": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "toStatus": {
                            "type": "string"
                          },
                          "changedBy": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "fromStatus": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "schedule": {
                      "nullable": true
                    },
                    "delivery": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "id": "207f0a24-06fc-4659-8e72-4c4b3046356a",
                  "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "sellerId": null,
                  "status": "CONFIRMED",
                  "subtotal": "194.7",
                  "discountTotal": "0",
                  "taxTotal": "0",
                  "total": "194.7",
                  "notes": null,
                  "deliveryAt": null,
                  "saleId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "convertedAt": null,
                  "cancelledAt": null,
                  "cancelledByUserId": null,
                  "cancelReason": null,
                  "customerResponse": "PENDING",
                  "customerRespondedAt": null,
                  "validUntil": null,
                  "quoteExpiredNotifiedAt": null,
                  "cobranca": "ANTECIPADA",
                  "source": "INTERNO",
                  "deliveryFeeTotal": "0",
                  "pedeAprovacao": true,
                  "number": 1,
                  "codigo": "00001",
                  "precoOcultoAoCliente": false,
                  "customerName": "Maria Souza",
                  "customerNameOfficial": null,
                  "customerNameDisplay": null,
                  "customerDoc": null,
                  "customerType": "PF",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "customerStreet": null,
                  "customerNumber": null,
                  "customerComplement": null,
                  "customerDistrict": null,
                  "customerCity": "Itaí",
                  "customerState": "SP",
                  "customerPostalCode": null,
                  "items": [
                    {
                      "id": "0b49140a-3678-4587-8616-424069287325",
                      "qty": 3,
                      "total": 194.7,
                      "discount": 0,
                      "pickedAt": null,
                      "pickedQty": null,
                      "productId": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                      "unitPrice": 64.9,
                      "variantId": "bf22bdb9-161b-49c9-8030-3e3ccbb63001",
                      "costAtTime": 24,
                      "unitSerial": null,
                      "productName": "Camiseta básica",
                      "productType": "PRODUCT",
                      "variantName": null,
                      "photoThumbUrl": null
                    }
                  ],
                  "history": [
                    {
                      "toStatus": "CONFIRMED",
                      "changedBy": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z",
                      "fromStatus": "DRAFT"
                    }
                  ],
                  "schedule": null,
                  "delivery": null
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Pedidos"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Visualizador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl https://api.nivro.app/api/v1/orders/ORDER_ID \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Visualizador",
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/orders/{id}/status": {
      "patch": {
        "operationId": "OrdersPublicController_updateStatus",
        "summary": "Anda o pedido pelo funil de entrega (CONFIRMED, SEPARATED, DISPATCHED, DELIVERED). Nunca aceita CONVERTED nem CANCELLED: esses têm rota própria.",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrderStatusDto"
              },
              "example": {
                "status": "DISPATCHED"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "tenantId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "sellerId": {
                      "nullable": true
                    },
                    "status": {
                      "type": "string"
                    },
                    "subtotal": {
                      "type": "string"
                    },
                    "discountTotal": {
                      "type": "string"
                    },
                    "taxTotal": {
                      "type": "string"
                    },
                    "total": {
                      "type": "string"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "deliveryAt": {
                      "nullable": true
                    },
                    "saleId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "convertedAt": {
                      "nullable": true
                    },
                    "cancelledAt": {
                      "nullable": true
                    },
                    "cancelledByUserId": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "customerResponse": {
                      "type": "string"
                    },
                    "customerRespondedAt": {
                      "nullable": true
                    },
                    "validUntil": {
                      "nullable": true
                    },
                    "quoteExpiredNotifiedAt": {
                      "nullable": true
                    },
                    "cobranca": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "deliveryFeeTotal": {
                      "type": "string"
                    },
                    "pedeAprovacao": {
                      "type": "boolean"
                    },
                    "number": {
                      "type": "integer"
                    },
                    "codigo": {
                      "type": "string"
                    },
                    "precoOcultoAoCliente": {
                      "type": "boolean"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerNameOfficial": {
                      "nullable": true
                    },
                    "customerNameDisplay": {
                      "nullable": true
                    },
                    "customerDoc": {
                      "nullable": true
                    },
                    "customerType": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "customerStreet": {
                      "nullable": true
                    },
                    "customerNumber": {
                      "nullable": true
                    },
                    "customerComplement": {
                      "nullable": true
                    },
                    "customerDistrict": {
                      "nullable": true
                    },
                    "customerCity": {
                      "type": "string"
                    },
                    "customerState": {
                      "type": "string"
                    },
                    "customerPostalCode": {
                      "nullable": true
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "qty": {
                            "type": "integer"
                          },
                          "total": {
                            "type": "number"
                          },
                          "discount": {
                            "type": "integer"
                          },
                          "pickedAt": {
                            "nullable": true
                          },
                          "pickedQty": {
                            "nullable": true
                          },
                          "productId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "unitPrice": {
                            "type": "number"
                          },
                          "variantId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "costAtTime": {
                            "type": "integer"
                          },
                          "unitSerial": {
                            "nullable": true
                          },
                          "productName": {
                            "type": "string"
                          },
                          "productType": {
                            "type": "string"
                          },
                          "variantName": {
                            "nullable": true
                          },
                          "photoThumbUrl": {
                            "nullable": true
                          }
                        }
                      }
                    },
                    "history": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "toStatus": {
                            "type": "string"
                          },
                          "changedBy": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "fromStatus": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "schedule": {
                      "nullable": true
                    },
                    "delivery": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "id": "207f0a24-06fc-4659-8e72-4c4b3046356a",
                  "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "sellerId": null,
                  "status": "SEPARATED",
                  "subtotal": "194.7",
                  "discountTotal": "0",
                  "taxTotal": "0",
                  "total": "194.7",
                  "notes": null,
                  "deliveryAt": null,
                  "saleId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "convertedAt": null,
                  "cancelledAt": null,
                  "cancelledByUserId": null,
                  "cancelReason": null,
                  "customerResponse": "PENDING",
                  "customerRespondedAt": null,
                  "validUntil": null,
                  "quoteExpiredNotifiedAt": null,
                  "cobranca": "ANTECIPADA",
                  "source": "INTERNO",
                  "deliveryFeeTotal": "0",
                  "pedeAprovacao": true,
                  "number": 1,
                  "codigo": "00001",
                  "precoOcultoAoCliente": false,
                  "customerName": "Maria Souza",
                  "customerNameOfficial": null,
                  "customerNameDisplay": null,
                  "customerDoc": null,
                  "customerType": "PF",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "customerStreet": null,
                  "customerNumber": null,
                  "customerComplement": null,
                  "customerDistrict": null,
                  "customerCity": "Itaí",
                  "customerState": "SP",
                  "customerPostalCode": null,
                  "items": [
                    {
                      "id": "0b49140a-3678-4587-8616-424069287325",
                      "qty": 3,
                      "total": 194.7,
                      "discount": 0,
                      "pickedAt": null,
                      "pickedQty": null,
                      "productId": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                      "unitPrice": 64.9,
                      "variantId": "bf22bdb9-161b-49c9-8030-3e3ccbb63001",
                      "costAtTime": 24,
                      "unitSerial": null,
                      "productName": "Camiseta básica",
                      "productType": "PRODUCT",
                      "variantName": null,
                      "photoThumbUrl": null
                    }
                  ],
                  "history": [
                    {
                      "toStatus": "CONFIRMED",
                      "changedBy": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z",
                      "fromStatus": "DRAFT"
                    },
                    {
                      "toStatus": "SEPARATED",
                      "changedBy": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z",
                      "fromStatus": "CONFIRMED"
                    }
                  ],
                  "schedule": null,
                  "delivery": null
                }
              }
            }
          },
          "400": {
            "description": "Transição de status inválida",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Pedidos"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Anda o pedido pelo funil de entrega. Aceita `CONFIRMED`, `SEPARATED`, `DISPATCHED` e `DELIVERED`, na ordem permitida. Nunca aceita `CONVERTED` nem `CANCELLED`: esses têm rota própria.\n\n**Papel mínimo do token:** Operador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X PATCH https://api.nivro.app/api/v1/orders/ORDER_ID/status \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"status\": \"DISPATCHED\"}'"
          }
        ],
        "x-papeis": [
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/orders/{id}/picking": {
      "post": {
        "operationId": "OrdersPublicController_recordPicking",
        "summary": "Registra a conferência de separação por item. pickedQty null desfaz a conferência; 0 significa \"conferi e não achei nada\".",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordPickingDto"
              },
              "example": {
                "items": [
                  {
                    "itemId": "ORDER_ITEM_ID",
                    "pickedQty": 20
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "picking": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "productId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "qty": {
                                "type": "integer"
                              },
                              "pickedQty": {
                                "type": "integer"
                              },
                              "status": {
                                "type": "string"
                              },
                              "shortfall": {
                                "type": "integer"
                              }
                            }
                          }
                        },
                        "notStarted": {
                          "type": "boolean"
                        },
                        "allChecked": {
                          "type": "boolean"
                        },
                        "complete": {
                          "type": "boolean"
                        },
                        "pendingCount": {
                          "type": "integer"
                        },
                        "shortCount": {
                          "type": "integer"
                        },
                        "totalShortfall": {
                          "type": "integer"
                        },
                        "canMarkSeparated": {
                          "type": "boolean"
                        }
                      }
                    },
                    "status": {
                      "type": "string"
                    },
                    "statusChanged": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "picking": {
                    "items": [
                      {
                        "id": "0b49140a-3678-4587-8616-424069287325",
                        "productId": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                        "qty": 3,
                        "pickedQty": 3,
                        "status": "complete",
                        "shortfall": 0
                      }
                    ],
                    "notStarted": false,
                    "allChecked": true,
                    "complete": true,
                    "pendingCount": 0,
                    "shortCount": 0,
                    "totalShortfall": 0,
                    "canMarkSeparated": true
                  },
                  "status": "SEPARATED",
                  "statusChanged": false
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Pedidos"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Registra a conferência da separação por item. `pickedQty: null` desfaz a conferência do item; `0` quer dizer \"conferi e não achei\".\n\n**Papel mínimo do token:** Operador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/orders/ORDER_ID/picking \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"items\": [{ \"itemId\": \"ORDER_ITEM_ID\", \"pickedQty\": 20 }]}'"
          }
        ],
        "x-papeis": [
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/orders/{id}/cancel": {
      "post": {
        "operationId": "OrdersPublicController_cancel",
        "summary": "Cancela o pedido. Com adiantamento em aberto, exige advanceResolution (REFUND ou CREDIT) no corpo; sem ele responde 409 ADVANCE_PENDING_RESOLUTION.",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelOrderDto"
              },
              "example": {
                "reason": "Cliente desistiu"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "tenantId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "sellerId": {
                      "nullable": true
                    },
                    "status": {
                      "type": "string"
                    },
                    "subtotal": {
                      "type": "string"
                    },
                    "discountTotal": {
                      "type": "string"
                    },
                    "taxTotal": {
                      "type": "string"
                    },
                    "total": {
                      "type": "string"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "deliveryAt": {
                      "nullable": true
                    },
                    "saleId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "convertedAt": {
                      "nullable": true
                    },
                    "cancelledAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "cancelledByUserId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "cancelReason": {
                      "type": "string"
                    },
                    "customerResponse": {
                      "type": "string"
                    },
                    "customerRespondedAt": {
                      "nullable": true
                    },
                    "validUntil": {
                      "nullable": true
                    },
                    "quoteExpiredNotifiedAt": {
                      "nullable": true
                    },
                    "cobranca": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "deliveryFeeTotal": {
                      "type": "string"
                    },
                    "pedeAprovacao": {
                      "type": "boolean"
                    },
                    "number": {
                      "type": "integer"
                    },
                    "codigo": {
                      "type": "string"
                    },
                    "precoOcultoAoCliente": {
                      "type": "boolean"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerNameOfficial": {
                      "nullable": true
                    },
                    "customerNameDisplay": {
                      "nullable": true
                    },
                    "customerDoc": {
                      "nullable": true
                    },
                    "customerType": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "customerStreet": {
                      "nullable": true
                    },
                    "customerNumber": {
                      "nullable": true
                    },
                    "customerComplement": {
                      "nullable": true
                    },
                    "customerDistrict": {
                      "nullable": true
                    },
                    "customerCity": {
                      "type": "string"
                    },
                    "customerState": {
                      "type": "string"
                    },
                    "customerPostalCode": {
                      "nullable": true
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "qty": {
                            "type": "integer"
                          },
                          "total": {
                            "type": "number"
                          },
                          "discount": {
                            "type": "integer"
                          },
                          "pickedAt": {
                            "nullable": true
                          },
                          "pickedQty": {
                            "nullable": true
                          },
                          "productId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "unitPrice": {
                            "type": "number"
                          },
                          "variantId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "costAtTime": {
                            "type": "integer"
                          },
                          "unitSerial": {
                            "nullable": true
                          },
                          "productName": {
                            "type": "string"
                          },
                          "productType": {
                            "type": "string"
                          },
                          "variantName": {
                            "nullable": true
                          },
                          "photoThumbUrl": {
                            "nullable": true
                          }
                        }
                      }
                    },
                    "history": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "toStatus": {
                            "type": "string"
                          },
                          "changedBy": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "fromStatus": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "schedule": {
                      "nullable": true
                    },
                    "delivery": {
                      "nullable": true
                    }
                  }
                },
                "example": {
                  "id": "12b5da83-5b81-4873-820d-d9fb134df184",
                  "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "sellerId": null,
                  "status": "CANCELLED",
                  "subtotal": "194.7",
                  "discountTotal": "0",
                  "taxTotal": "0",
                  "total": "194.7",
                  "notes": null,
                  "deliveryAt": null,
                  "saleId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "convertedAt": null,
                  "cancelledAt": "2026-11-12T14:30:00.000Z",
                  "cancelledByUserId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                  "cancelReason": "Cliente desistiu",
                  "customerResponse": "PENDING",
                  "customerRespondedAt": null,
                  "validUntil": null,
                  "quoteExpiredNotifiedAt": null,
                  "cobranca": "ANTECIPADA",
                  "source": "INTERNO",
                  "deliveryFeeTotal": "0",
                  "pedeAprovacao": true,
                  "number": 2,
                  "codigo": "00002",
                  "precoOcultoAoCliente": false,
                  "customerName": "Maria Souza",
                  "customerNameOfficial": null,
                  "customerNameDisplay": null,
                  "customerDoc": null,
                  "customerType": "PF",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "customerStreet": null,
                  "customerNumber": null,
                  "customerComplement": null,
                  "customerDistrict": null,
                  "customerCity": "Itaí",
                  "customerState": "SP",
                  "customerPostalCode": null,
                  "items": [
                    {
                      "id": "adddad9f-e026-4f08-8e84-2ccc7a2c7ce9",
                      "qty": 3,
                      "total": 194.7,
                      "discount": 0,
                      "pickedAt": null,
                      "pickedQty": null,
                      "productId": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                      "unitPrice": 64.9,
                      "variantId": "bf22bdb9-161b-49c9-8030-3e3ccbb63001",
                      "costAtTime": 24,
                      "unitSerial": null,
                      "productName": "Camiseta básica",
                      "productType": "PRODUCT",
                      "variantName": null,
                      "photoThumbUrl": null
                    }
                  ],
                  "history": [
                    {
                      "toStatus": "CANCELLED",
                      "changedBy": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z",
                      "fromStatus": "CONFIRMED"
                    },
                    {
                      "toStatus": "CONFIRMED",
                      "changedBy": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z",
                      "fromStatus": "DRAFT"
                    }
                  ],
                  "schedule": null,
                  "delivery": null
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "409": {
            "description": "ADVANCE_PENDING_RESOLUTION: o pedido tem adiantamento sem destino"
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Pedidos"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Cancela o pedido. Se houver adiantamento em aberto, mande `advanceResolution` (devolver ou virar crédito); sem ele a resposta é `409` com `ADVANCE_PENDING_RESOLUTION`.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/orders/ORDER_ID/cancel \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"reason\": \"Cliente desistiu\"}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/orders/{id}/invoice-preview": {
      "get": {
        "operationId": "OrdersPublicController_invoicePreview",
        "summary": "Prévia do faturamento: o que a venda vai ter (quantidades separadas), a falta em relação ao pedido e o efeito do adiantamento. Não grava nada.",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "status": {
                      "type": "string"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "quoteExpired": {
                      "type": "boolean"
                    },
                    "itens": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "itemId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "productId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "variantId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "qty": {
                            "type": "integer"
                          },
                          "pickedQty": {
                            "type": "integer"
                          },
                          "vaiNaVenda": {
                            "type": "integer"
                          },
                          "saiDaVenda": {
                            "type": "boolean"
                          },
                          "faltou": {
                            "type": "integer"
                          },
                          "unitPriceCents": {
                            "type": "integer"
                          },
                          "totalOriginalCents": {
                            "type": "integer"
                          },
                          "totalNaVendaCents": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "subtotalOriginalCents": {
                      "type": "integer"
                    },
                    "subtotalFaturadoCents": {
                      "type": "integer"
                    },
                    "descontoOriginalCents": {
                      "type": "integer"
                    },
                    "descontoFaturadoCents": {
                      "type": "integer"
                    },
                    "taxaEntregaCents": {
                      "type": "integer"
                    },
                    "totalOriginalCents": {
                      "type": "integer"
                    },
                    "totalFaturadoCents": {
                      "type": "integer"
                    },
                    "diferencaCents": {
                      "type": "integer"
                    },
                    "adiantamentoCents": {
                      "type": "integer"
                    },
                    "adiantamentoAbateCents": {
                      "type": "integer"
                    },
                    "adiantamentoSobraCents": {
                      "type": "integer"
                    },
                    "restanteAReceberCents": {
                      "type": "integer"
                    },
                    "adiantamentos": {
                      "type": "array",
                      "items": {}
                    },
                    "faltas": {
                      "type": "array",
                      "items": {}
                    },
                    "temFalta": {
                      "type": "boolean"
                    },
                    "nenhumSeparado": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "orderId": "207f0a24-06fc-4659-8e72-4c4b3046356a",
                  "status": "SEPARATED",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "quoteExpired": false,
                  "itens": [
                    {
                      "itemId": "0b49140a-3678-4587-8616-424069287325",
                      "productId": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                      "variantId": "bf22bdb9-161b-49c9-8030-3e3ccbb63001",
                      "name": "Camiseta básica",
                      "qty": 3,
                      "pickedQty": 3,
                      "vaiNaVenda": 3,
                      "saiDaVenda": false,
                      "faltou": 0,
                      "unitPriceCents": 6490,
                      "totalOriginalCents": 19470,
                      "totalNaVendaCents": 19470
                    }
                  ],
                  "subtotalOriginalCents": 19470,
                  "subtotalFaturadoCents": 19470,
                  "descontoOriginalCents": 0,
                  "descontoFaturadoCents": 0,
                  "taxaEntregaCents": 0,
                  "totalOriginalCents": 19470,
                  "totalFaturadoCents": 19470,
                  "diferencaCents": 0,
                  "adiantamentoCents": 0,
                  "adiantamentoAbateCents": 0,
                  "adiantamentoSobraCents": 0,
                  "restanteAReceberCents": 19470,
                  "adiantamentos": [],
                  "faltas": [],
                  "temFalta": false,
                  "nenhumSeparado": false
                }
              }
            }
          },
          "400": {
            "description": "Pedido já faturado ou cancelado",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Pedidos"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl https://api.nivro.app/api/v1/orders/ORDER_ID/invoice-preview \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/orders/{id}/convert": {
      "post": {
        "operationId": "OrdersPublicController_convert",
        "summary": "Fatura o pedido: cria a venda e marca o pedido como CONVERTED, numa chamada só. Cobra só o que foi separado. Em empresa com NF-e automática, a nota entra na fila.",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertOrderDto"
              },
              "example": {
                "paymentType": "CASH",
                "payments": [
                  {
                    "method": "PIX",
                    "amount": 40
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "order": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "tenantId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "customerId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "sellerId": {
                          "nullable": true
                        },
                        "status": {
                          "type": "string"
                        },
                        "subtotal": {
                          "type": "string"
                        },
                        "discountTotal": {
                          "type": "string"
                        },
                        "taxTotal": {
                          "type": "string"
                        },
                        "total": {
                          "type": "string"
                        },
                        "notes": {
                          "nullable": true
                        },
                        "deliveryAt": {
                          "nullable": true
                        },
                        "saleId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "convertedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "cancelledAt": {
                          "nullable": true
                        },
                        "cancelledByUserId": {
                          "nullable": true
                        },
                        "cancelReason": {
                          "nullable": true
                        },
                        "customerResponse": {
                          "type": "string"
                        },
                        "customerRespondedAt": {
                          "nullable": true
                        },
                        "validUntil": {
                          "nullable": true
                        },
                        "quoteExpiredNotifiedAt": {
                          "nullable": true
                        },
                        "cobranca": {
                          "type": "string"
                        },
                        "source": {
                          "type": "string"
                        },
                        "deliveryFeeTotal": {
                          "type": "string"
                        },
                        "pedeAprovacao": {
                          "type": "boolean"
                        },
                        "number": {
                          "type": "integer"
                        },
                        "codigo": {
                          "type": "string"
                        },
                        "precoOcultoAoCliente": {
                          "type": "boolean"
                        },
                        "customerName": {
                          "type": "string"
                        },
                        "customerNameOfficial": {
                          "nullable": true
                        },
                        "customerNameDisplay": {
                          "nullable": true
                        },
                        "customerDoc": {
                          "nullable": true
                        },
                        "customerType": {
                          "type": "string"
                        },
                        "customerEmail": {
                          "type": "string"
                        },
                        "customerPhone": {
                          "type": "string"
                        },
                        "customerStreet": {
                          "nullable": true
                        },
                        "customerNumber": {
                          "nullable": true
                        },
                        "customerComplement": {
                          "nullable": true
                        },
                        "customerDistrict": {
                          "nullable": true
                        },
                        "customerCity": {
                          "type": "string"
                        },
                        "customerState": {
                          "type": "string"
                        },
                        "customerPostalCode": {
                          "nullable": true
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "qty": {
                                "type": "integer"
                              },
                              "total": {
                                "type": "number"
                              },
                              "discount": {
                                "type": "integer"
                              },
                              "pickedAt": {
                                "type": "string"
                              },
                              "pickedQty": {
                                "type": "integer"
                              },
                              "productId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "unitPrice": {
                                "type": "number"
                              },
                              "variantId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "costAtTime": {
                                "type": "integer"
                              },
                              "unitSerial": {
                                "nullable": true
                              },
                              "productName": {
                                "type": "string"
                              },
                              "productType": {
                                "type": "string"
                              },
                              "variantName": {
                                "nullable": true
                              },
                              "photoThumbUrl": {
                                "nullable": true
                              }
                            }
                          }
                        },
                        "history": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "toStatus": {
                                "type": "string"
                              },
                              "changedBy": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "fromStatus": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "schedule": {
                          "nullable": true
                        },
                        "delivery": {
                          "nullable": true
                        }
                      }
                    },
                    "sale": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "tenantId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "number": {
                          "type": "integer"
                        },
                        "sellerId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "customerId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "orderId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "subtotal": {
                          "type": "string"
                        },
                        "discount": {
                          "type": "string"
                        },
                        "total": {
                          "type": "string"
                        },
                        "channel": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "isImported": {
                          "type": "boolean"
                        },
                        "finalizedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "canceledAt": {
                          "nullable": true
                        },
                        "canceledByUserId": {
                          "nullable": true
                        },
                        "cancelReason": {
                          "nullable": true
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedByUserId": {
                          "nullable": true
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "commissionSellerId": {
                          "nullable": true
                        },
                        "commissionPercentageOverride": {
                          "nullable": true
                        },
                        "commissionExcluded": {
                          "type": "boolean"
                        },
                        "deliveryFee": {
                          "nullable": true
                        },
                        "fiscalModeloEscolhido": {
                          "nullable": true
                        },
                        "fiscalEmailCupom": {
                          "nullable": true
                        },
                        "serviceOrderId": {
                          "nullable": true
                        },
                        "occurredAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "occurredAtSource": {
                          "type": "string"
                        },
                        "codigo": {
                          "type": "string"
                        },
                        "membershipChargeId": {
                          "nullable": true
                        },
                        "cashbackCents": {
                          "type": "integer"
                        }
                      }
                    },
                    "faltas": {
                      "type": "array",
                      "items": {}
                    },
                    "totalOriginalCents": {
                      "type": "integer"
                    },
                    "totalFaturadoCents": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "order": {
                    "id": "207f0a24-06fc-4659-8e72-4c4b3046356a",
                    "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                    "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                    "sellerId": null,
                    "status": "CONVERTED",
                    "subtotal": "194.7",
                    "discountTotal": "0",
                    "taxTotal": "0",
                    "total": "194.7",
                    "notes": null,
                    "deliveryAt": null,
                    "saleId": "135d1d98-07af-40e7-8b61-04d3d211b2b0",
                    "createdAt": "2026-11-12T14:30:00.000Z",
                    "updatedAt": "2026-11-12T14:30:00.000Z",
                    "convertedAt": "2026-11-12T14:30:00.000Z",
                    "cancelledAt": null,
                    "cancelledByUserId": null,
                    "cancelReason": null,
                    "customerResponse": "PENDING",
                    "customerRespondedAt": null,
                    "validUntil": null,
                    "quoteExpiredNotifiedAt": null,
                    "cobranca": "ANTECIPADA",
                    "source": "INTERNO",
                    "deliveryFeeTotal": "0",
                    "pedeAprovacao": true,
                    "number": 1,
                    "codigo": "00001",
                    "precoOcultoAoCliente": false,
                    "customerName": "Maria Souza",
                    "customerNameOfficial": null,
                    "customerNameDisplay": null,
                    "customerDoc": null,
                    "customerType": "PF",
                    "customerEmail": "maria.souza@exemplo.com.br",
                    "customerPhone": "11987654321",
                    "customerStreet": null,
                    "customerNumber": null,
                    "customerComplement": null,
                    "customerDistrict": null,
                    "customerCity": "Itaí",
                    "customerState": "SP",
                    "customerPostalCode": null,
                    "items": [
                      {
                        "id": "0b49140a-3678-4587-8616-424069287325",
                        "qty": 3,
                        "total": 194.7,
                        "discount": 0,
                        "pickedAt": "2026-11-12T14:30:00.000",
                        "pickedQty": 3,
                        "productId": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                        "unitPrice": 64.9,
                        "variantId": "bf22bdb9-161b-49c9-8030-3e3ccbb63001",
                        "costAtTime": 24,
                        "unitSerial": null,
                        "productName": "Camiseta básica",
                        "productType": "PRODUCT",
                        "variantName": null,
                        "photoThumbUrl": null
                      }
                    ],
                    "history": [
                      {
                        "toStatus": "CONFIRMED",
                        "changedBy": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                        "createdAt": "2026-11-12T14:30:00.000Z",
                        "fromStatus": "DRAFT"
                      },
                      {
                        "toStatus": "CONVERTED",
                        "changedBy": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                        "createdAt": "2026-11-12T14:30:00.000Z",
                        "fromStatus": "SEPARATED"
                      }
                    ],
                    "schedule": null,
                    "delivery": null
                  },
                  "sale": {
                    "id": "135d1d98-07af-40e7-8b61-04d3d211b2b0",
                    "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                    "number": 1,
                    "sellerId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                    "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                    "orderId": "207f0a24-06fc-4659-8e72-4c4b3046356a",
                    "subtotal": "194.7",
                    "discount": "0",
                    "total": "194.7",
                    "channel": "OTHER",
                    "status": "ACTIVE",
                    "isImported": false,
                    "finalizedAt": "2026-11-12T14:30:00.000Z",
                    "canceledAt": null,
                    "canceledByUserId": null,
                    "cancelReason": null,
                    "updatedAt": "2026-11-12T14:30:00.000Z",
                    "updatedByUserId": null,
                    "createdAt": "2026-11-12T14:30:00.000Z",
                    "commissionSellerId": null,
                    "commissionPercentageOverride": null,
                    "commissionExcluded": false,
                    "deliveryFee": null,
                    "fiscalModeloEscolhido": null,
                    "fiscalEmailCupom": null,
                    "serviceOrderId": null,
                    "occurredAt": "2026-11-12T14:30:00.000Z",
                    "occurredAtSource": "SERVER",
                    "codigo": "1",
                    "membershipChargeId": null,
                    "cashbackCents": 0
                  },
                  "faltas": [],
                  "totalOriginalCents": 19470,
                  "totalFaturadoCents": 19470
                }
              }
            }
          },
          "400": {
            "description": "Pedido já faturado ou cancelado, ou orçamento vencido (código quote_expired)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "409": {
            "description": "nothing_to_invoice (todos os itens separados como 0) ou ADVANCE_EXCEEDS_SALE_TOTAL"
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Pedidos"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Fatura o pedido: cria a venda e marca o pedido como `CONVERTED`, numa chamada só. `paymentType` é `CASH` ou `INSTALLMENTS`; para o dinheiro que já entrou, mande `payments` e a venda nasce quitada. Responde `400` se o pedido já foi faturado ou cancelado, ou se o orçamento venceu (`quote_expired`), e `409` com `nothing_to_invoice` quando nenhum item foi separado.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/orders/ORDER_ID/convert \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"paymentType\": \"CASH\", \"payments\": [{ \"method\": \"PIX\", \"amount\": 40 }]}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/sales": {
      "post": {
        "operationId": "SalesPublicController_create",
        "summary": "Cria uma venda",
        "description": "**Papel mínimo do token:** Operador.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Chave gerada pelo cliente. Repetir a requisição com a mesma chave devolve a venda já criada em vez de duplicá-la.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSaleDto"
              },
              "example": {
                "channel": "ONLINE",
                "customerId": "CUSTOMER_ID",
                "items": [
                  {
                    "productId": "PRODUCT_ID",
                    "qty": 1,
                    "unitPrice": "49.90"
                  }
                ],
                "payments": [
                  {
                    "method": "PIX",
                    "amount": 49.9
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "tenantId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "number": {
                      "type": "integer"
                    },
                    "sellerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "orderId": {
                      "nullable": true
                    },
                    "subtotal": {
                      "type": "string"
                    },
                    "discount": {
                      "type": "string"
                    },
                    "total": {
                      "type": "string"
                    },
                    "channel": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "isImported": {
                      "type": "boolean"
                    },
                    "finalizedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "canceledByUserId": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedByUserId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "commissionSellerId": {
                      "nullable": true
                    },
                    "commissionPercentageOverride": {
                      "nullable": true
                    },
                    "commissionExcluded": {
                      "type": "boolean"
                    },
                    "deliveryFee": {
                      "nullable": true
                    },
                    "fiscalModeloEscolhido": {
                      "nullable": true
                    },
                    "fiscalEmailCupom": {
                      "nullable": true
                    },
                    "serviceOrderId": {
                      "nullable": true
                    },
                    "occurredAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "occurredAtSource": {
                      "type": "string"
                    },
                    "codigo": {
                      "type": "string"
                    },
                    "membershipChargeId": {
                      "nullable": true
                    },
                    "cashbackCents": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "id": "a6b660db-7dc4-4289-8d71-887657b78050",
                  "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                  "number": 2,
                  "sellerId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "orderId": null,
                  "subtotal": "129.8",
                  "discount": "0",
                  "total": "129.8",
                  "channel": "OTHER",
                  "status": "ACTIVE",
                  "isImported": false,
                  "finalizedAt": "2026-11-12T14:30:00.000Z",
                  "canceledAt": null,
                  "canceledByUserId": null,
                  "cancelReason": null,
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "updatedByUserId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "commissionSellerId": null,
                  "commissionPercentageOverride": null,
                  "commissionExcluded": false,
                  "deliveryFee": null,
                  "fiscalModeloEscolhido": null,
                  "fiscalEmailCupom": null,
                  "serviceOrderId": null,
                  "occurredAt": "2026-11-12T14:30:00.000Z",
                  "occurredAtSource": "SERVER",
                  "codigo": "2",
                  "membershipChargeId": null,
                  "cashbackCents": 0
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Vendas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/sales \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"channel\": \"ONLINE\",\n    \"customerId\": \"CUSTOMER_ID\",\n    \"items\": [{ \"productId\": \"PRODUCT_ID\", \"qty\": 1, \"unitPrice\": \"49.90\" }],\n    \"payments\": [{ \"method\": \"PIX\", \"amount\": 49.90 }]\n  }'"
          }
        ],
        "x-papeis": [
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      },
      "get": {
        "operationId": "SalesPublicController_findAll",
        "summary": "Lista vendas",
        "parameters": [
          {
            "name": "take",
            "required": false,
            "in": "query",
            "description": "Padrão 50, máximo 200",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Quantos itens pular, para paginar com `take`."
          },
          {
            "name": "customerId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Id do cliente."
          },
          {
            "name": "startDate",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data inicial, AAAA-MM-DD."
          },
          {
            "name": "endDate",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data final, AAAA-MM-DD. O período vai até 366 dias."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "number": {
                        "type": "integer"
                      },
                      "codigo": {
                        "type": "string"
                      },
                      "sellerId": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "customerId": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "customerName": {
                        "type": "string"
                      },
                      "subtotal": {
                        "type": "string"
                      },
                      "discount": {
                        "type": "string"
                      },
                      "total": {
                        "type": "string"
                      },
                      "channel": {
                        "type": "string"
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "occurredAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "status": {
                        "type": "string"
                      },
                      "tenantId": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "canceledAt": {
                        "nullable": true
                      },
                      "canceledByUserId": {
                        "nullable": true
                      },
                      "cancelReason": {
                        "nullable": true
                      },
                      "orderId": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "serviceOrderId": {
                        "nullable": true
                      },
                      "orderCodigo": {
                        "type": "string"
                      },
                      "orderNumber": {
                        "type": "integer"
                      },
                      "serviceOrderNumber": {
                        "nullable": true
                      },
                      "paymentMethods": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "devolucao": {
                        "nullable": true
                      },
                      "membership": {
                        "nullable": true
                      },
                      "rental": {
                        "nullable": true
                      },
                      "paidTotal": {
                        "type": "string"
                      },
                      "situation": {
                        "type": "string"
                      }
                    }
                  }
                },
                "example": [
                  {
                    "id": "135d1d98-07af-40e7-8b61-04d3d211b2b0",
                    "number": 1,
                    "codigo": "1",
                    "sellerId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                    "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                    "customerName": "Maria Souza",
                    "subtotal": "194.7",
                    "discount": "0",
                    "total": "194.7",
                    "channel": "OTHER",
                    "createdAt": "2026-11-12T14:30:00.000Z",
                    "occurredAt": "2026-11-12T14:30:00.000Z",
                    "status": "ACTIVE",
                    "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                    "canceledAt": null,
                    "canceledByUserId": null,
                    "cancelReason": null,
                    "orderId": "207f0a24-06fc-4659-8e72-4c4b3046356a",
                    "serviceOrderId": null,
                    "orderCodigo": "00001",
                    "orderNumber": 1,
                    "serviceOrderNumber": null,
                    "paymentMethods": [
                      "PIX"
                    ],
                    "devolucao": null,
                    "membership": null,
                    "rental": null,
                    "paidTotal": "194.7",
                    "situation": "Pago"
                  },
                  {
                    "id": "a6b660db-7dc4-4289-8d71-887657b78050",
                    "number": 2,
                    "codigo": "2",
                    "sellerId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                    "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                    "customerName": "Maria Souza",
                    "subtotal": "129.8",
                    "discount": "0",
                    "total": "129.8",
                    "channel": "OTHER",
                    "createdAt": "2026-11-12T14:30:00.000Z",
                    "occurredAt": "2026-11-12T14:30:00.000Z",
                    "status": "ACTIVE",
                    "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                    "canceledAt": null,
                    "canceledByUserId": null,
                    "cancelReason": null,
                    "orderId": null,
                    "serviceOrderId": null,
                    "orderCodigo": null,
                    "orderNumber": null,
                    "serviceOrderNumber": null,
                    "paymentMethods": null,
                    "devolucao": null,
                    "membership": null,
                    "rental": null,
                    "paidTotal": "0",
                    "situation": "Pendente"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Vendas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Visualizador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl \"https://api.nivro.app/api/v1/sales?take=20\" \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Visualizador",
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/sales/{id}": {
      "get": {
        "operationId": "SalesPublicController_findOne",
        "summary": "Busca uma venda por id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "tenantId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "number": {
                      "type": "integer"
                    },
                    "sellerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "orderId": {
                      "nullable": true
                    },
                    "subtotal": {
                      "type": "string"
                    },
                    "discount": {
                      "type": "string"
                    },
                    "total": {
                      "type": "string"
                    },
                    "channel": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "isImported": {
                      "type": "boolean"
                    },
                    "finalizedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "canceledByUserId": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedByUserId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "commissionSellerId": {
                      "nullable": true
                    },
                    "commissionPercentageOverride": {
                      "nullable": true
                    },
                    "commissionExcluded": {
                      "type": "boolean"
                    },
                    "deliveryFee": {
                      "nullable": true
                    },
                    "fiscalModeloEscolhido": {
                      "nullable": true
                    },
                    "fiscalEmailCupom": {
                      "nullable": true
                    },
                    "serviceOrderId": {
                      "nullable": true
                    },
                    "occurredAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "occurredAtSource": {
                      "type": "string"
                    },
                    "codigo": {
                      "type": "string"
                    },
                    "membershipChargeId": {
                      "nullable": true
                    },
                    "storeCreditByOrigin": {
                      "nullable": true
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerStreet": {
                      "nullable": true
                    },
                    "customerNumber": {
                      "nullable": true
                    },
                    "customerComplement": {
                      "nullable": true
                    },
                    "customerDistrict": {
                      "nullable": true
                    },
                    "customerCity": {
                      "type": "string"
                    },
                    "customerState": {
                      "type": "string"
                    },
                    "customerPostalCode": {
                      "nullable": true
                    },
                    "delivery": {
                      "nullable": true
                    },
                    "cobranca": {
                      "nullable": true
                    },
                    "orderCodigo": {
                      "nullable": true
                    },
                    "membership": {
                      "nullable": true
                    },
                    "rental": {
                      "nullable": true
                    },
                    "commission": {
                      "type": "object",
                      "properties": {
                        "sellerId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "sellerName": {
                          "type": "string"
                        },
                        "commissionSellerId": {
                          "nullable": true
                        },
                        "commissionSellerName": {
                          "nullable": true
                        },
                        "commissionPercentageOverride": {
                          "nullable": true
                        },
                        "commissionExcluded": {
                          "type": "boolean"
                        },
                        "effectiveSellerId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "effectiveSellerName": {
                          "type": "string"
                        },
                        "effectivePercentage": {
                          "nullable": true
                        },
                        "effectiveAmount": {
                          "type": "integer"
                        },
                        "commissionableBase": {
                          "type": "number"
                        },
                        "usedItemRates": {
                          "type": "boolean"
                        },
                        "returnedFraction": {
                          "type": "integer"
                        },
                        "cancelled": {
                          "type": "boolean"
                        },
                        "originalAmount": {
                          "nullable": true
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "saleId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "productId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "variantId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "qty": {
                            "type": "integer"
                          },
                          "unitPrice": {
                            "type": "string"
                          },
                          "costAtTime": {
                            "type": "string"
                          },
                          "listPrice": {
                            "nullable": true
                          },
                          "confirmedExpired": {
                            "type": "boolean"
                          },
                          "unitId": {
                            "nullable": true
                          },
                          "productName": {
                            "type": "string"
                          },
                          "productUnit": {
                            "type": "string"
                          },
                          "productSku": {
                            "type": "string"
                          },
                          "productType": {
                            "type": "string"
                          },
                          "productPhotoUrl": {
                            "nullable": true
                          },
                          "productPercentage": {
                            "nullable": true
                          },
                          "productCategoryId": {
                            "nullable": true
                          },
                          "variantName": {
                            "nullable": true
                          },
                          "variantSku": {
                            "type": "string"
                          },
                          "unitSerial": {
                            "nullable": true
                          },
                          "netLineTotal": {
                            "type": "number"
                          },
                          "product": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "sku": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "photoUrl": {
                                "nullable": true
                              }
                            }
                          }
                        }
                      }
                    },
                    "payments": {
                      "type": "array",
                      "items": {}
                    },
                    "paidTotal": {
                      "type": "integer"
                    },
                    "situation": {
                      "type": "string"
                    },
                    "receivables": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "tenantId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "saleId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "installmentNo": {
                            "type": "integer"
                          },
                          "dueDate": {
                            "type": "string",
                            "format": "date"
                          },
                          "amount": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "notifiedAt": {
                            "nullable": true
                          },
                          "paidAmount": {
                            "type": "integer"
                          },
                          "payments": {
                            "type": "array",
                            "items": {}
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "id": "a6b660db-7dc4-4289-8d71-887657b78050",
                  "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                  "number": 2,
                  "sellerId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "orderId": null,
                  "subtotal": "129.8",
                  "discount": "0",
                  "total": "129.8",
                  "channel": "OTHER",
                  "status": "ACTIVE",
                  "isImported": false,
                  "finalizedAt": "2026-11-12T14:30:00.000Z",
                  "canceledAt": null,
                  "canceledByUserId": null,
                  "cancelReason": null,
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "updatedByUserId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "commissionSellerId": null,
                  "commissionPercentageOverride": null,
                  "commissionExcluded": false,
                  "deliveryFee": null,
                  "fiscalModeloEscolhido": null,
                  "fiscalEmailCupom": null,
                  "serviceOrderId": null,
                  "occurredAt": "2026-11-12T14:30:00.000Z",
                  "occurredAtSource": "SERVER",
                  "codigo": "2",
                  "membershipChargeId": null,
                  "storeCreditByOrigin": null,
                  "customerName": "Maria Souza",
                  "customerStreet": null,
                  "customerNumber": null,
                  "customerComplement": null,
                  "customerDistrict": null,
                  "customerCity": "Itaí",
                  "customerState": "SP",
                  "customerPostalCode": null,
                  "delivery": null,
                  "cobranca": null,
                  "orderCodigo": null,
                  "membership": null,
                  "rental": null,
                  "commission": {
                    "sellerId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                    "sellerName": "Test User",
                    "commissionSellerId": null,
                    "commissionSellerName": null,
                    "commissionPercentageOverride": null,
                    "commissionExcluded": false,
                    "effectiveSellerId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                    "effectiveSellerName": "Test User",
                    "effectivePercentage": null,
                    "effectiveAmount": 0,
                    "commissionableBase": 129.8,
                    "usedItemRates": false,
                    "returnedFraction": 0,
                    "cancelled": false,
                    "originalAmount": null
                  },
                  "items": [
                    {
                      "id": "eaa98b7b-6277-4c16-8fd3-d581608dade2",
                      "saleId": "a6b660db-7dc4-4289-8d71-887657b78050",
                      "productId": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                      "variantId": "bf22bdb9-161b-49c9-8030-3e3ccbb63001",
                      "qty": 2,
                      "unitPrice": "64.9",
                      "costAtTime": "24",
                      "listPrice": null,
                      "confirmedExpired": false,
                      "unitId": null,
                      "productName": "Camiseta básica",
                      "productUnit": "un",
                      "productSku": "CAM-001",
                      "productType": "PRODUCT",
                      "productPhotoUrl": null,
                      "productPercentage": null,
                      "productCategoryId": null,
                      "variantName": null,
                      "variantSku": "CAM-001",
                      "unitSerial": null,
                      "netLineTotal": 129.8,
                      "product": {
                        "name": "Camiseta básica",
                        "sku": "CAM-001",
                        "type": "PRODUCT",
                        "photoUrl": null
                      }
                    }
                  ],
                  "payments": [],
                  "paidTotal": 0,
                  "situation": "Pendente",
                  "receivables": [
                    {
                      "id": "44fe0016-834e-46c9-8448-da93c569b8c4",
                      "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                      "saleId": "a6b660db-7dc4-4289-8d71-887657b78050",
                      "installmentNo": 1,
                      "dueDate": "2026-11-12",
                      "amount": "64.9",
                      "status": "PENDING",
                      "createdAt": "2026-11-12T14:30:00.000Z",
                      "notifiedAt": null,
                      "paidAmount": 0,
                      "payments": []
                    },
                    {
                      "id": "bd2082b4-6c1d-4615-8834-8b11e1c0182d",
                      "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                      "saleId": "a6b660db-7dc4-4289-8d71-887657b78050",
                      "installmentNo": 2,
                      "dueDate": "2026-11-28",
                      "amount": "64.9",
                      "status": "PENDING",
                      "createdAt": "2026-11-12T14:30:00.000Z",
                      "notifiedAt": null,
                      "paidAmount": 0,
                      "payments": []
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Vendas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Visualizador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl https://api.nivro.app/api/v1/sales/SALE_ID \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Visualizador",
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/sales/{id}/cancel": {
      "post": {
        "operationId": "SalesPublicController_cancel",
        "summary": "Cancela uma venda: estorna pagamentos e recebíveis e repõe o estoque dos itens",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelSaleDto"
              },
              "example": {
                "reason": "Estorno solicitado pelo cliente"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "tenantId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "number": {
                      "type": "integer"
                    },
                    "sellerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "nullable": true
                    },
                    "orderId": {
                      "nullable": true
                    },
                    "subtotal": {
                      "type": "string"
                    },
                    "discount": {
                      "type": "string"
                    },
                    "total": {
                      "type": "string"
                    },
                    "channel": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "isImported": {
                      "type": "boolean"
                    },
                    "finalizedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "canceledAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "canceledByUserId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "cancelReason": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedByUserId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "commissionSellerId": {
                      "nullable": true
                    },
                    "commissionPercentageOverride": {
                      "nullable": true
                    },
                    "commissionExcluded": {
                      "type": "boolean"
                    },
                    "deliveryFee": {
                      "nullable": true
                    },
                    "fiscalModeloEscolhido": {
                      "nullable": true
                    },
                    "fiscalEmailCupom": {
                      "nullable": true
                    },
                    "serviceOrderId": {
                      "nullable": true
                    },
                    "occurredAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "occurredAtSource": {
                      "type": "string"
                    },
                    "codigo": {
                      "type": "string"
                    },
                    "membershipChargeId": {
                      "nullable": true
                    },
                    "storeCreditByOrigin": {
                      "nullable": true
                    },
                    "customerName": {
                      "nullable": true
                    },
                    "customerStreet": {
                      "nullable": true
                    },
                    "customerNumber": {
                      "nullable": true
                    },
                    "customerComplement": {
                      "nullable": true
                    },
                    "customerDistrict": {
                      "nullable": true
                    },
                    "customerCity": {
                      "nullable": true
                    },
                    "customerState": {
                      "nullable": true
                    },
                    "customerPostalCode": {
                      "nullable": true
                    },
                    "delivery": {
                      "nullable": true
                    },
                    "cobranca": {
                      "nullable": true
                    },
                    "orderCodigo": {
                      "nullable": true
                    },
                    "membership": {
                      "nullable": true
                    },
                    "rental": {
                      "nullable": true
                    },
                    "commission": {
                      "type": "object",
                      "properties": {
                        "sellerId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "sellerName": {
                          "type": "string"
                        },
                        "commissionSellerId": {
                          "nullable": true
                        },
                        "commissionSellerName": {
                          "nullable": true
                        },
                        "commissionPercentageOverride": {
                          "nullable": true
                        },
                        "commissionExcluded": {
                          "type": "boolean"
                        },
                        "effectiveSellerId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "effectiveSellerName": {
                          "type": "string"
                        },
                        "effectivePercentage": {
                          "nullable": true
                        },
                        "effectiveAmount": {
                          "type": "integer"
                        },
                        "commissionableBase": {
                          "type": "integer"
                        },
                        "usedItemRates": {
                          "type": "boolean"
                        },
                        "returnedFraction": {
                          "type": "integer"
                        },
                        "cancelled": {
                          "type": "boolean"
                        },
                        "originalAmount": {
                          "nullable": true
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "saleId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "productId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "variantId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "qty": {
                            "type": "integer"
                          },
                          "unitPrice": {
                            "type": "string"
                          },
                          "costAtTime": {
                            "type": "string"
                          },
                          "listPrice": {
                            "nullable": true
                          },
                          "confirmedExpired": {
                            "type": "boolean"
                          },
                          "unitId": {
                            "nullable": true
                          },
                          "productName": {
                            "type": "string"
                          },
                          "productUnit": {
                            "type": "string"
                          },
                          "productSku": {
                            "type": "string"
                          },
                          "productType": {
                            "type": "string"
                          },
                          "productPhotoUrl": {
                            "nullable": true
                          },
                          "productPercentage": {
                            "nullable": true
                          },
                          "productCategoryId": {
                            "nullable": true
                          },
                          "variantName": {
                            "nullable": true
                          },
                          "variantSku": {
                            "type": "string"
                          },
                          "unitSerial": {
                            "nullable": true
                          },
                          "netLineTotal": {
                            "type": "number"
                          },
                          "product": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "sku": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "photoUrl": {
                                "nullable": true
                              }
                            }
                          }
                        }
                      }
                    },
                    "payments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "saleId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "method": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "string"
                          },
                          "reversalOfPaymentId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "cashAccountId": {
                            "nullable": true
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "receivedByUserId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "feePercent": {
                            "nullable": true
                          },
                          "feeAmount": {
                            "nullable": true
                          },
                          "netAmount": {
                            "nullable": true
                          },
                          "advanceId": {
                            "nullable": true
                          }
                        }
                      }
                    },
                    "paidTotal": {
                      "type": "integer"
                    },
                    "situation": {
                      "type": "string"
                    },
                    "receivables": {
                      "type": "array",
                      "items": {}
                    }
                  }
                },
                "example": {
                  "id": "fc4cea36-d5ad-4bed-8211-df00b3772d04",
                  "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                  "number": 3,
                  "sellerId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                  "customerId": null,
                  "orderId": null,
                  "subtotal": "64.9",
                  "discount": "0",
                  "total": "64.9",
                  "channel": "OTHER",
                  "status": "CANCELLED",
                  "isImported": false,
                  "finalizedAt": "2026-11-12T14:30:00.000Z",
                  "canceledAt": "2026-11-12T14:30:00.000Z",
                  "canceledByUserId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                  "cancelReason": "Estorno solicitado pelo cliente",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "updatedByUserId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "commissionSellerId": null,
                  "commissionPercentageOverride": null,
                  "commissionExcluded": false,
                  "deliveryFee": null,
                  "fiscalModeloEscolhido": null,
                  "fiscalEmailCupom": null,
                  "serviceOrderId": null,
                  "occurredAt": "2026-11-12T14:30:00.000Z",
                  "occurredAtSource": "SERVER",
                  "codigo": "3",
                  "membershipChargeId": null,
                  "storeCreditByOrigin": null,
                  "customerName": null,
                  "customerStreet": null,
                  "customerNumber": null,
                  "customerComplement": null,
                  "customerDistrict": null,
                  "customerCity": null,
                  "customerState": null,
                  "customerPostalCode": null,
                  "delivery": null,
                  "cobranca": null,
                  "orderCodigo": null,
                  "membership": null,
                  "rental": null,
                  "commission": {
                    "sellerId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                    "sellerName": "Test User",
                    "commissionSellerId": null,
                    "commissionSellerName": null,
                    "commissionPercentageOverride": null,
                    "commissionExcluded": false,
                    "effectiveSellerId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                    "effectiveSellerName": "Test User",
                    "effectivePercentage": null,
                    "effectiveAmount": 0,
                    "commissionableBase": 0,
                    "usedItemRates": false,
                    "returnedFraction": 1,
                    "cancelled": true,
                    "originalAmount": null
                  },
                  "items": [
                    {
                      "id": "427d108d-dff5-423c-8c29-bf505382425a",
                      "saleId": "fc4cea36-d5ad-4bed-8211-df00b3772d04",
                      "productId": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                      "variantId": "bf22bdb9-161b-49c9-8030-3e3ccbb63001",
                      "qty": 1,
                      "unitPrice": "64.9",
                      "costAtTime": "24",
                      "listPrice": null,
                      "confirmedExpired": false,
                      "unitId": null,
                      "productName": "Camiseta básica",
                      "productUnit": "un",
                      "productSku": "CAM-001",
                      "productType": "PRODUCT",
                      "productPhotoUrl": null,
                      "productPercentage": null,
                      "productCategoryId": null,
                      "variantName": null,
                      "variantSku": "CAM-001",
                      "unitSerial": null,
                      "netLineTotal": 64.9,
                      "product": {
                        "name": "Camiseta básica",
                        "sku": "CAM-001",
                        "type": "PRODUCT",
                        "photoUrl": null
                      }
                    }
                  ],
                  "payments": [
                    {
                      "id": "b0860697-493d-40c0-8b97-ee2a0fd70871",
                      "saleId": "fc4cea36-d5ad-4bed-8211-df00b3772d04",
                      "method": "CASH",
                      "amount": "-64.9",
                      "reversalOfPaymentId": "af8491a1-908a-4a34-8b7c-b42df44a3b75",
                      "cashAccountId": null,
                      "createdAt": "2026-11-12T14:30:00.000Z",
                      "receivedByUserId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "feePercent": null,
                      "feeAmount": null,
                      "netAmount": null,
                      "advanceId": null
                    },
                    {
                      "id": "af8491a1-908a-4a34-8b7c-b42df44a3b75",
                      "saleId": "fc4cea36-d5ad-4bed-8211-df00b3772d04",
                      "method": "CASH",
                      "amount": "64.9",
                      "reversalOfPaymentId": null,
                      "cashAccountId": null,
                      "createdAt": "2026-11-12T14:30:00.000Z",
                      "receivedByUserId": null,
                      "feePercent": null,
                      "feeAmount": null,
                      "netAmount": null,
                      "advanceId": null
                    }
                  ],
                  "paidTotal": 0,
                  "situation": "Cancelada",
                  "receivables": []
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Vendas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Cancela uma venda: estorna pagamentos e recebíveis (valor negativo referenciando o original), repõe estoque dos itens e marca a venda como CANCELLED. Requer token com role Gerente.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/sales/SALE_ID/cancel \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"reason\": \"Estorno solicitado pelo cliente\"}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/cashflow/transactions": {
      "get": {
        "operationId": "CashflowPublicController_findAll",
        "summary": "Lista lançamentos do fluxo de caixa (despesas)",
        "parameters": [
          {
            "name": "startDate",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data inicial, AAAA-MM-DD."
          },
          {
            "name": "endDate",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data final, AAAA-MM-DD. O período vai até 366 dias."
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Situação a filtrar."
          },
          {
            "name": "category",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Categoria do lançamento."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "tenantId": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "amount": {
                        "type": "string"
                      },
                      "paidAmount": {
                        "nullable": true
                      },
                      "description": {
                        "type": "string"
                      },
                      "category": {
                        "type": "string"
                      },
                      "date": {
                        "type": "string",
                        "format": "date"
                      },
                      "status": {
                        "type": "string"
                      },
                      "paidAt": {
                        "nullable": true
                      },
                      "paymentMethod": {
                        "nullable": true
                      },
                      "createdBy": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "notes": {
                        "nullable": true
                      },
                      "supplierId": {
                        "nullable": true
                      },
                      "employeeId": {
                        "nullable": true
                      },
                      "isRecurring": {
                        "type": "boolean"
                      },
                      "rrule": {
                        "nullable": true
                      },
                      "recurringEndDate": {
                        "nullable": true
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "deletedAt": {
                        "nullable": true
                      }
                    }
                  }
                },
                "example": [
                  {
                    "id": "d2d11cbe-707d-4ac6-8f27-f82d761a8d41",
                    "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                    "amount": "350",
                    "paidAmount": null,
                    "description": "Aluguel da loja",
                    "category": "RENT",
                    "date": "2026-11-12",
                    "status": "PENDING",
                    "paidAt": null,
                    "paymentMethod": null,
                    "createdBy": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                    "notes": null,
                    "supplierId": null,
                    "employeeId": null,
                    "isRecurring": false,
                    "rrule": null,
                    "recurringEndDate": null,
                    "createdAt": "2026-11-12T14:30:00.000Z",
                    "updatedAt": "2026-11-12T14:30:00.000Z",
                    "deletedAt": null
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Financeiro"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Lista lançamentos de fluxo de caixa (despesas). Token de Operador não lê despesas, como na tela. A folha de pagamento sai somada, nunca itemizada.\n\n**Papéis que podem chamar:** Proprietário, Gerente, Visualizador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl \"https://api.nivro.app/api/v1/cashflow/transactions?startDate=2026-01-01&endDate=2026-01-31\" \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Visualizador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/cashflow/summary": {
      "get": {
        "operationId": "CashflowPublicController_summary",
        "summary": "Resumo de entradas e saídas confirmadas no período",
        "parameters": [
          {
            "name": "startDate",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data inicial, AAAA-MM-DD."
          },
          {
            "name": "endDate",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data final, AAAA-MM-DD. O período vai até 366 dias."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "generatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "startDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "endDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "configuredInitialBalance": {
                          "type": "integer"
                        },
                        "initialBalance": {
                          "type": "integer"
                        },
                        "initialBalanceDate": {
                          "nullable": true
                        },
                        "timezone": {
                          "type": "string"
                        }
                      }
                    },
                    "summary": {
                      "type": "object",
                      "properties": {
                        "totalInflow": {
                          "type": "number"
                        },
                        "totalOutflow": {
                          "type": "integer"
                        },
                        "netBalance": {
                          "type": "number"
                        },
                        "currentBalance": {
                          "type": "number"
                        }
                      }
                    },
                    "daily": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string",
                            "format": "date"
                          },
                          "inflow": {
                            "type": "integer"
                          },
                          "outflow": {
                            "type": "integer"
                          },
                          "balance": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "metadata": {
                    "generatedAt": "2026-11-12T14:30:00.000Z",
                    "startDate": "2026-11-01",
                    "endDate": "2026-11-12",
                    "configuredInitialBalance": 0,
                    "initialBalance": 0,
                    "initialBalanceDate": null,
                    "timezone": "America/Sao_Paulo"
                  },
                  "summary": {
                    "totalInflow": 194.7,
                    "totalOutflow": 0,
                    "netBalance": 194.7,
                    "currentBalance": 194.7
                  },
                  "daily": [
                    {
                      "date": "2026-11-01",
                      "inflow": 0,
                      "outflow": 0,
                      "balance": 0
                    },
                    {
                      "date": "2026-11-02",
                      "inflow": 0,
                      "outflow": 0,
                      "balance": 0
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Financeiro"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl \"https://api.nivro.app/api/v1/cashflow/summary?startDate=2026-01-01&endDate=2026-01-31\" \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/reports/daily-summary": {
      "get": {
        "operationId": "ReportsPublicController_dailySummary",
        "summary": "Resumo de vendas e caixa de um dia ou de um período",
        "parameters": [
          {
            "name": "date",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Dia do resumo, AAAA-MM-DD. Padrão: hoje."
          },
          {
            "name": "startDate",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data inicial, AAAA-MM-DD."
          },
          {
            "name": "endDate",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data final, AAAA-MM-DD. O período vai até 366 dias."
          },
          {
            "name": "periodPreset",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Período pronto: `today`, `this-week`, `this-month`, `last-30-days` ou `custom` (com `startDate` e `endDate`)."
          },
          {
            "name": "sellerId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Id do vendedor."
          },
          {
            "name": "channel",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Canal da venda (o mesmo da tela)."
          },
          {
            "name": "receivableStatus",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Situação das parcelas a considerar no resumo."
          },
          {
            "name": "categoryId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Id da categoria."
          },
          {
            "name": "includeSales",
            "required": false,
            "in": "query",
            "description": "Use false para omitir a lista de vendas (`sales`): num mês ela passa de 200 KB e os KPIs já vêm prontos.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "generatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "filtersApplied": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date"
                            },
                            "periodPreset": {
                              "type": "string"
                            },
                            "startDate": {
                              "type": "string",
                              "format": "date"
                            },
                            "endDate": {
                              "type": "string",
                              "format": "date"
                            }
                          }
                        }
                      }
                    },
                    "kpis": {
                      "type": "object",
                      "properties": {
                        "revenue": {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "number"
                            },
                            "vsYesterday": {
                              "type": "integer"
                            },
                            "vsLastWeek": {
                              "type": "integer"
                            },
                            "vs7DayAvg": {
                              "type": "integer"
                            }
                          }
                        },
                        "salesCount": {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "integer"
                            },
                            "vsYesterday": {
                              "type": "integer"
                            },
                            "vsLastWeek": {
                              "type": "integer"
                            },
                            "vs7DayAvg": {
                              "type": "integer"
                            }
                          }
                        },
                        "averageTicket": {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "number"
                            },
                            "vsYesterday": {
                              "type": "integer"
                            },
                            "vsLastWeek": {
                              "type": "integer"
                            },
                            "vs7DayAvg": {
                              "type": "integer"
                            }
                          }
                        },
                        "receivablesCreated": {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "number"
                            }
                          }
                        },
                        "receivablesReceived": {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "integer"
                            }
                          }
                        },
                        "lowStock": {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    },
                    "insights": {
                      "type": "array",
                      "items": {}
                    },
                    "salesByHour": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "hour": {
                            "type": "integer"
                          },
                          "count": {
                            "type": "integer"
                          },
                          "revenue": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "paymentMethods": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "method": {
                            "type": "string"
                          },
                          "count": {
                            "type": "integer"
                          },
                          "amount": {
                            "type": "number"
                          },
                          "amountAtSale": {
                            "type": "number"
                          },
                          "amountFromInstallments": {
                            "type": "integer"
                          },
                          "countAtSale": {
                            "type": "integer"
                          },
                          "countFromInstallments": {
                            "type": "integer"
                          },
                          "percentage": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "receivables": {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "number"
                        },
                        "received": {
                          "type": "integer"
                        },
                        "byStatus": {
                          "type": "object",
                          "properties": {
                            "pending": {
                              "type": "number"
                            },
                            "late": {
                              "type": "integer"
                            },
                            "paid": {
                              "type": "integer"
                            },
                            "partiallyPaid": {
                              "type": "integer"
                            }
                          }
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "saleId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "installmentNo": {
                                "type": "integer"
                              },
                              "dueDate": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "amount": {
                                "type": "number"
                              },
                              "status": {
                                "type": "string"
                              },
                              "paidAmount": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    },
                    "inventory": {
                      "type": "object",
                      "properties": {
                        "lowStock": {
                          "type": "array",
                          "items": {}
                        },
                        "topProducts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "name": {
                                "type": "string"
                              },
                              "sku": {
                                "type": "string"
                              },
                              "unitsSold": {
                                "type": "integer"
                              },
                              "revenue": {
                                "type": "number"
                              },
                              "margin": {
                                "type": "number"
                              }
                            }
                          }
                        },
                        "movements": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "productId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "productName": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "quantity": {
                                "type": "integer"
                              },
                              "reason": {
                                "type": "string"
                              },
                              "reasonCode": {
                                "type": "string"
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          }
                        }
                      }
                    },
                    "sellers": {
                      "type": "object",
                      "properties": {
                        "overview": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "sellerId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "sellerName": {
                                "type": "string"
                              },
                              "sales": {
                                "type": "integer"
                              },
                              "salesCount": {
                                "type": "integer"
                              },
                              "revenue": {
                                "type": "number"
                              },
                              "averageTicket": {
                                "type": "number"
                              },
                              "pendingReceivables": {
                                "type": "number"
                              },
                              "commissionPercentage": {
                                "nullable": true
                              },
                              "commissionAmount": {
                                "type": "integer"
                              },
                              "commissionUsesItemRates": {
                                "type": "boolean"
                              }
                            }
                          }
                        },
                        "comparison": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "sellerId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "sellerName": {
                                "type": "string"
                              },
                              "revenue": {
                                "type": "number"
                              },
                              "pendingReceivables": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    },
                    "customers": {
                      "type": "object",
                      "properties": {
                        "topCustomers": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "customerId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "customerName": {
                                "type": "string"
                              },
                              "revenue": {
                                "type": "number"
                              },
                              "orders": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    },
                    "profitability": {
                      "type": "object",
                      "properties": {
                        "totals": {
                          "type": "object",
                          "properties": {
                            "revenue": {
                              "type": "number"
                            },
                            "cost": {
                              "type": "integer"
                            },
                            "grossProfit": {
                              "type": "number"
                            },
                            "grossMargin": {
                              "type": "number"
                            }
                          }
                        },
                        "history": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "period": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "revenue": {
                                "type": "number"
                              },
                              "cost": {
                                "type": "integer"
                              },
                              "profit": {
                                "type": "number"
                              }
                            }
                          }
                        },
                        "coverage": {
                          "type": "object",
                          "properties": {
                            "itemsTotal": {
                              "type": "integer"
                            },
                            "itemsWithCost": {
                              "type": "integer"
                            },
                            "revenueWithCost": {
                              "type": "number"
                            },
                            "revenueWithoutCost": {
                              "type": "integer"
                            },
                            "ratio": {
                              "type": "integer"
                            },
                            "grossMarginOnCovered": {
                              "type": "number"
                            },
                            "productsMissingCost": {
                              "type": "array",
                              "items": {}
                            },
                            "revenueServiceUnmodeled": {
                              "type": "integer"
                            },
                            "itemsServiceUnmodeled": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    },
                    "losses": {
                      "type": "object",
                      "properties": {
                        "totalQuantity": {
                          "type": "integer"
                        },
                        "totalValue": {
                          "type": "integer"
                        },
                        "itemsWithoutCost": {
                          "type": "integer"
                        },
                        "byReason": {
                          "type": "array",
                          "items": {}
                        },
                        "topProducts": {
                          "type": "array",
                          "items": {}
                        }
                      }
                    }
                  }
                },
                "example": {
                  "metadata": {
                    "generatedAt": "2026-11-12T14:30:00.000Z",
                    "filtersApplied": {
                      "date": "2026-11-12",
                      "periodPreset": "today",
                      "startDate": "2026-11-12",
                      "endDate": "2026-11-12"
                    }
                  },
                  "kpis": {
                    "revenue": {
                      "value": 324.5,
                      "vsYesterday": 0,
                      "vsLastWeek": 0,
                      "vs7DayAvg": 0
                    },
                    "salesCount": {
                      "value": 2,
                      "vsYesterday": 0,
                      "vsLastWeek": 0,
                      "vs7DayAvg": 0
                    },
                    "averageTicket": {
                      "value": 162.25,
                      "vsYesterday": 0,
                      "vsLastWeek": 0,
                      "vs7DayAvg": 0
                    },
                    "receivablesCreated": {
                      "value": 129.8
                    },
                    "receivablesReceived": {
                      "value": 0
                    },
                    "lowStock": {
                      "value": 0
                    }
                  },
                  "insights": [],
                  "salesByHour": [
                    {
                      "hour": 0,
                      "count": 0,
                      "revenue": 0
                    },
                    {
                      "hour": 1,
                      "count": 0,
                      "revenue": 0
                    }
                  ],
                  "paymentMethods": [
                    {
                      "method": "PIX",
                      "count": 1,
                      "amount": 194.7,
                      "amountAtSale": 194.7,
                      "amountFromInstallments": 0,
                      "countAtSale": 1,
                      "countFromInstallments": 0,
                      "percentage": 60
                    }
                  ],
                  "receivables": {
                    "created": 129.8,
                    "received": 0,
                    "byStatus": {
                      "pending": 129.8,
                      "late": 0,
                      "paid": 0,
                      "partiallyPaid": 0
                    },
                    "items": [
                      {
                        "id": "44fe0016-834e-46c9-8448-da93c569b8c4",
                        "saleId": "a6b660db-7dc4-4289-8d71-887657b78050",
                        "installmentNo": 1,
                        "dueDate": "2026-11-12T14:30:00.000Z",
                        "amount": 64.9,
                        "status": "PENDING",
                        "paidAmount": 0
                      },
                      {
                        "id": "bd2082b4-6c1d-4615-8834-8b11e1c0182d",
                        "saleId": "a6b660db-7dc4-4289-8d71-887657b78050",
                        "installmentNo": 2,
                        "dueDate": "2026-11-28T14:30:00.000Z",
                        "amount": 64.9,
                        "status": "PENDING",
                        "paidAmount": 0
                      }
                    ]
                  },
                  "inventory": {
                    "lowStock": [],
                    "topProducts": [
                      {
                        "id": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                        "name": "Camiseta básica",
                        "sku": "CAM-001",
                        "unitsSold": 5,
                        "revenue": 324.5,
                        "margin": 63.02003081664098
                      }
                    ],
                    "movements": [
                      {
                        "id": "dc1fbec0-df8e-4d3e-8fd5-e77e13961731",
                        "productId": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                        "productName": "Camiseta básica",
                        "type": "IN",
                        "quantity": 1,
                        "reason": "sale_cancelled",
                        "reasonCode": "SALE_RETURN",
                        "createdAt": "2026-11-12T14:30:00.000Z"
                      },
                      {
                        "id": "bc0ad769-f2f3-4e82-88ec-cf0c77fea609",
                        "productId": "de61c106-f7b0-4fed-8623-7c4e114ac6a5",
                        "productName": "Camiseta básica",
                        "type": "IN",
                        "quantity": 40,
                        "reason": null,
                        "reasonCode": "PURCHASE",
                        "createdAt": "2026-11-12T14:30:00.000Z"
                      }
                    ]
                  },
                  "sellers": {
                    "overview": [
                      {
                        "sellerId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                        "sellerName": "Test User",
                        "sales": 2,
                        "salesCount": 2,
                        "revenue": 324.5,
                        "averageTicket": 162.25,
                        "pendingReceivables": 129.8,
                        "commissionPercentage": null,
                        "commissionAmount": 0,
                        "commissionUsesItemRates": false
                      }
                    ],
                    "comparison": [
                      {
                        "sellerId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                        "sellerName": "Test User",
                        "revenue": 324.5,
                        "pendingReceivables": 129.8
                      }
                    ]
                  },
                  "customers": {
                    "topCustomers": [
                      {
                        "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                        "customerName": "Maria Souza",
                        "revenue": 324.5,
                        "orders": 2
                      }
                    ]
                  },
                  "profitability": {
                    "totals": {
                      "revenue": 324.5,
                      "cost": 120,
                      "grossProfit": 204.5,
                      "grossMargin": 63.02
                    },
                    "history": [
                      {
                        "period": "unknown",
                        "label": "Sem data",
                        "revenue": 324.5,
                        "cost": 120,
                        "profit": 204.5
                      }
                    ],
                    "coverage": {
                      "itemsTotal": 2,
                      "itemsWithCost": 2,
                      "revenueWithCost": 324.5,
                      "revenueWithoutCost": 0,
                      "ratio": 1,
                      "grossMarginOnCovered": 63.02,
                      "productsMissingCost": [],
                      "revenueServiceUnmodeled": 0,
                      "itemsServiceUnmodeled": 0
                    }
                  },
                  "losses": {
                    "totalQuantity": 0,
                    "totalValue": 0,
                    "itemsWithoutCost": 0,
                    "byReason": [],
                    "topProducts": []
                  }
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Relatórios"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Resumo de vendas e caixa de um dia ou de um período. Relatórios são de Gerente em diante.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl \"https://api.nivro.app/api/v1/reports/daily-summary?date=2026-01-15\" \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/reports/sales-comparison": {
      "get": {
        "operationId": "ReportsPublicController_salesComparison",
        "summary": "Compara dois períodos de venda: receita, número de vendas e ticket médio",
        "parameters": [
          {
            "name": "startDate",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data inicial, AAAA-MM-DD."
          },
          {
            "name": "endDate",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data final, AAAA-MM-DD. O período vai até 366 dias."
          },
          {
            "name": "previousStartDate",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Início do período de comparação, AAAA-MM-DD. Sem ele (e sem `previousEndDate`), compara com o intervalo imediatamente anterior."
          },
          {
            "name": "previousEndDate",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Fim do período de comparação, AAAA-MM-DD."
          },
          {
            "name": "sellerId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Id do vendedor."
          },
          {
            "name": "channel",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Canal da venda (o mesmo da tela)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "current": {
                      "type": "object",
                      "properties": {
                        "startDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "endDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "revenue": {
                          "type": "number"
                        },
                        "salesCount": {
                          "type": "integer"
                        },
                        "avgTicket": {
                          "type": "number"
                        }
                      }
                    },
                    "previous": {
                      "type": "object",
                      "properties": {
                        "startDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "endDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "revenue": {
                          "type": "integer"
                        },
                        "salesCount": {
                          "type": "integer"
                        },
                        "avgTicket": {
                          "type": "integer"
                        }
                      }
                    },
                    "comparison": {
                      "type": "object",
                      "properties": {
                        "revenue": {
                          "type": "object",
                          "properties": {
                            "current": {
                              "type": "number"
                            },
                            "previous": {
                              "type": "integer"
                            },
                            "delta": {
                              "type": "number"
                            },
                            "percent": {
                              "nullable": true
                            }
                          }
                        },
                        "salesCount": {
                          "type": "object",
                          "properties": {
                            "current": {
                              "type": "integer"
                            },
                            "previous": {
                              "type": "integer"
                            },
                            "delta": {
                              "type": "integer"
                            },
                            "percent": {
                              "nullable": true
                            }
                          }
                        },
                        "avgTicket": {
                          "type": "object",
                          "properties": {
                            "current": {
                              "type": "number"
                            },
                            "previous": {
                              "type": "integer"
                            },
                            "delta": {
                              "type": "number"
                            },
                            "percent": {
                              "nullable": true
                            }
                          }
                        }
                      }
                    },
                    "dailyCurrent": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string",
                            "format": "date"
                          },
                          "revenue": {
                            "type": "number"
                          },
                          "salesCount": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "dailyPrevious": {
                      "type": "array",
                      "items": {}
                    }
                  }
                },
                "example": {
                  "current": {
                    "startDate": "2026-11-01",
                    "endDate": "2026-11-12",
                    "revenue": 324.5,
                    "salesCount": 2,
                    "avgTicket": 162.25
                  },
                  "previous": {
                    "startDate": "2026-10-19",
                    "endDate": "2026-10-31",
                    "revenue": 0,
                    "salesCount": 0,
                    "avgTicket": 0
                  },
                  "comparison": {
                    "revenue": {
                      "current": 324.5,
                      "previous": 0,
                      "delta": 324.5,
                      "percent": null
                    },
                    "salesCount": {
                      "current": 2,
                      "previous": 0,
                      "delta": 2,
                      "percent": null
                    },
                    "avgTicket": {
                      "current": 162.25,
                      "previous": 0,
                      "delta": 162.25,
                      "percent": null
                    }
                  },
                  "dailyCurrent": [
                    {
                      "date": "2026-11-12",
                      "revenue": 324.5,
                      "salesCount": 2
                    }
                  ],
                  "dailyPrevious": []
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Relatórios"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Compara dois períodos de venda: receita, número de vendas e ticket médio. Sem o período anterior, compara com o intervalo imediatamente anterior ao informado.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl \"https://api.nivro.app/api/v1/reports/sales-comparison?startDate=2026-10-01&endDate=2026-10-31\" \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/receivables": {
      "get": {
        "operationId": "ReceivablesPublicController_findAll",
        "summary": "Lista contas a receber (parcelas a prazo), com o cliente e o vencimento",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Texto a buscar."
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "PENDING | PARTIALLY_PAID | PAID | CANCELLED",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "take",
            "required": false,
            "in": "query",
            "description": "Padrão 50, máximo 200",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Quantos itens pular, para paginar com `take`."
          },
          {
            "name": "startDate",
            "required": false,
            "in": "query",
            "description": "AAAA-MM-DD, data de vencimento",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "required": false,
            "in": "query",
            "description": "AAAA-MM-DD, data de vencimento",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "tenantId": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "saleId": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "installmentNo": {
                        "type": "integer"
                      },
                      "dueDate": {
                        "type": "string",
                        "format": "date"
                      },
                      "amount": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string"
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "customerId": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "saleNumber": {
                        "type": "integer"
                      },
                      "saleCodigo": {
                        "type": "string"
                      },
                      "customerName": {
                        "type": "string"
                      },
                      "paidAmount": {
                        "type": "integer"
                      },
                      "payments": {
                        "type": "array",
                        "items": {}
                      },
                      "charges": {
                        "type": "object",
                        "properties": {
                          "principal": {
                            "type": "number"
                          },
                          "daysOverdue": {
                            "type": "integer"
                          },
                          "lateFeeAmount": {
                            "type": "integer"
                          },
                          "interestAmount": {
                            "type": "integer"
                          },
                          "totalDue": {
                            "type": "number"
                          },
                          "lateFeePercent": {
                            "type": "integer"
                          },
                          "monthlyInterestPercent": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                },
                "example": [
                  {
                    "id": "44fe0016-834e-46c9-8448-da93c569b8c4",
                    "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                    "saleId": "a6b660db-7dc4-4289-8d71-887657b78050",
                    "installmentNo": 1,
                    "dueDate": "2026-11-12",
                    "amount": "64.9",
                    "status": "PENDING",
                    "createdAt": "2026-11-12T14:30:00.000Z",
                    "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                    "saleNumber": 2,
                    "saleCodigo": "2",
                    "customerName": "Maria Souza",
                    "paidAmount": 0,
                    "payments": [],
                    "charges": {
                      "principal": 64.9,
                      "daysOverdue": 0,
                      "lateFeeAmount": 0,
                      "interestAmount": 0,
                      "totalDue": 64.9,
                      "lateFeePercent": 2,
                      "monthlyInterestPercent": 1
                    }
                  },
                  {
                    "id": "bd2082b4-6c1d-4615-8834-8b11e1c0182d",
                    "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                    "saleId": "a6b660db-7dc4-4289-8d71-887657b78050",
                    "installmentNo": 2,
                    "dueDate": "2026-11-28",
                    "amount": "64.9",
                    "status": "PENDING",
                    "createdAt": "2026-11-12T14:30:00.000Z",
                    "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                    "saleNumber": 2,
                    "saleCodigo": "2",
                    "customerName": "Maria Souza",
                    "paidAmount": 0,
                    "payments": [],
                    "charges": {
                      "principal": 64.9,
                      "daysOverdue": 0,
                      "lateFeeAmount": 0,
                      "interestAmount": 0,
                      "totalDue": 64.9,
                      "lateFeePercent": 2,
                      "monthlyInterestPercent": 1
                    }
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Contas a receber"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Visualizador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl \"https://api.nivro.app/api/v1/receivables?status=PENDING&endDate=2026-10-31\" \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Visualizador",
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/receivables/summary": {
      "get": {
        "operationId": "ReceivablesPublicController_summary",
        "summary": "Totais sobre os mesmos filtros da lista: em aberto, recebido, quantidade em atraso e próximo vencimento",
        "parameters": [
          {
            "name": "search",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Texto a buscar."
          },
          {
            "name": "startDate",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data inicial, AAAA-MM-DD."
          },
          {
            "name": "endDate",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Data final, AAAA-MM-DD. O período vai até 366 dias."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer"
                    },
                    "openTotal": {
                      "type": "number"
                    },
                    "paidTotal": {
                      "type": "integer"
                    },
                    "overdueCount": {
                      "type": "integer"
                    },
                    "nextDue": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "lateFeeTotal": {
                      "type": "integer"
                    },
                    "interestTotal": {
                      "type": "integer"
                    },
                    "openTotalWithCharges": {
                      "type": "number"
                    }
                  }
                },
                "example": {
                  "total": 2,
                  "openTotal": 129.8,
                  "paidTotal": 0,
                  "overdueCount": 0,
                  "nextDue": "2026-11-12T14:30:00.000Z",
                  "lateFeeTotal": 0,
                  "interestTotal": 0,
                  "openTotalWithCharges": 129.8
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Contas a receber"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Totais sobre os mesmos filtros da lista, sem teto de linhas: em aberto, recebido, quantidade em atraso e próximo vencimento.\n\n**Papel mínimo do token:** Visualizador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl https://api.nivro.app/api/v1/receivables/summary \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Visualizador",
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/receivables/{id}": {
      "get": {
        "operationId": "ReceivablesPublicController_findOne",
        "summary": "Busca uma conta a receber por id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "tenantId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "saleId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "installmentNo": {
                      "type": "integer"
                    },
                    "dueDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "amount": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "notifiedAt": {
                      "nullable": true
                    },
                    "paidAmount": {
                      "type": "integer"
                    },
                    "payments": {
                      "type": "array",
                      "items": {}
                    },
                    "charges": {
                      "type": "object",
                      "properties": {
                        "principal": {
                          "type": "number"
                        },
                        "daysOverdue": {
                          "type": "integer"
                        },
                        "lateFeeAmount": {
                          "type": "integer"
                        },
                        "interestAmount": {
                          "type": "integer"
                        },
                        "totalDue": {
                          "type": "number"
                        },
                        "lateFeePercent": {
                          "type": "integer"
                        },
                        "monthlyInterestPercent": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "id": "44fe0016-834e-46c9-8448-da93c569b8c4",
                  "tenantId": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                  "saleId": "a6b660db-7dc4-4289-8d71-887657b78050",
                  "installmentNo": 1,
                  "dueDate": "2026-11-12",
                  "amount": "64.9",
                  "status": "PENDING",
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "notifiedAt": null,
                  "paidAmount": 0,
                  "payments": [],
                  "charges": {
                    "principal": 64.9,
                    "daysOverdue": 0,
                    "lateFeeAmount": 0,
                    "interestAmount": 0,
                    "totalDue": 64.9,
                    "lateFeePercent": 2,
                    "monthlyInterestPercent": 1
                  }
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Contas a receber"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Visualizador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl https://api.nivro.app/api/v1/receivables/RECEIVABLE_ID \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Visualizador",
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/plans": {
      "get": {
        "operationId": "MembershipsPublicController_plans",
        "summary": "Lista os planos de assinatura",
        "parameters": [
          {
            "name": "active",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            },
            "description": "`true` só os planos ativos; `false` só os inativos. Sem o filtro, todos."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "name": {
                        "type": "string"
                      },
                      "description": {
                        "nullable": true
                      },
                      "productId": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "productName": {
                        "type": "string"
                      },
                      "productType": {
                        "type": "string"
                      },
                      "enrollmentProductId": {
                        "nullable": true
                      },
                      "enrollmentProductName": {
                        "nullable": true
                      },
                      "price": {
                        "type": "integer"
                      },
                      "billingInterval": {
                        "type": "string"
                      },
                      "enrollmentFee": {
                        "nullable": true
                      },
                      "graceDays": {
                        "type": "integer"
                      },
                      "minTermMonths": {
                        "nullable": true
                      },
                      "trialDays": {
                        "type": "integer"
                      },
                      "active": {
                        "type": "boolean"
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "liveMemberships": {
                        "type": "integer"
                      }
                    }
                  }
                },
                "example": [
                  {
                    "id": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                    "name": "Plano mensal",
                    "description": null,
                    "productId": "cbe52dc0-9555-4f78-85e8-f28e9a19efc3",
                    "productName": "Mensalidade",
                    "productType": "SERVICE",
                    "enrollmentProductId": null,
                    "enrollmentProductName": null,
                    "price": 100,
                    "billingInterval": "MONTHLY",
                    "enrollmentFee": null,
                    "graceDays": 0,
                    "minTermMonths": null,
                    "trialDays": 0,
                    "active": true,
                    "createdAt": "2026-11-12T14:30:00.000Z",
                    "updatedAt": "2026-11-12T14:30:00.000Z",
                    "liveMemberships": 1
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Operador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl \"https://api.nivro.app/api/v1/memberships/plans?active=true\" \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/plans/{id}": {
      "get": {
        "operationId": "MembershipsPublicController_plan",
        "summary": "Busca um plano de assinatura por id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "nullable": true
                    },
                    "productId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "productName": {
                      "type": "string"
                    },
                    "productType": {
                      "type": "string"
                    },
                    "enrollmentProductId": {
                      "nullable": true
                    },
                    "enrollmentProductName": {
                      "nullable": true
                    },
                    "price": {
                      "type": "integer"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "enrollmentFee": {
                      "nullable": true
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "minTermMonths": {
                      "nullable": true
                    },
                    "trialDays": {
                      "type": "integer"
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "liveMemberships": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "id": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "name": "Plano mensal",
                  "description": null,
                  "productId": "cbe52dc0-9555-4f78-85e8-f28e9a19efc3",
                  "productName": "Mensalidade",
                  "productType": "SERVICE",
                  "enrollmentProductId": null,
                  "enrollmentProductName": null,
                  "price": 100,
                  "billingInterval": "MONTHLY",
                  "enrollmentFee": null,
                  "graceDays": 0,
                  "minTermMonths": null,
                  "trialDays": 0,
                  "active": true,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "liveMemberships": 1
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Busca um plano por id\n\n**Papel mínimo do token:** Operador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl https://api.nivro.app/api/v1/memberships/plans/PLAN_ID \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/charges": {
      "get": {
        "operationId": "MembershipsPublicController_charges",
        "summary": "Cobranças de todas as assinaturas: a vencer, vencidas ou pagas",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "`upcoming` (a vencer, inclui os próximos ciclos ainda não gerados), `overdue` (vencidas) ou `paid` (pagas).",
            "schema": {
              "enum": [
                "upcoming",
                "overdue",
                "paid"
              ],
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Vencimento a partir de (AAAA-MM-DD).",
            "schema": {
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "Vencimento até (AAAA-MM-DD).",
            "schema": {
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
              "type": "string"
            }
          },
          {
            "name": "planId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Id do plano."
          },
          {
            "name": "membershipId",
            "required": false,
            "in": "query",
            "description": "Só as cobranças de uma assinatura (a ação \"cobrar por WhatsApp\" na lista e na ficha).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "required": false,
            "in": "query",
            "description": "Busca pelo nome, e-mail ou telefone do cliente.",
            "schema": {
              "maxLength": 100,
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "type": "number"
            },
            "description": "Página, a partir de 1."
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "type": "number"
            },
            "description": "Itens por página (padrão 50, máximo 200)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "nullable": true
                          },
                          "membershipId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "customerId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "customerName": {
                            "type": "string"
                          },
                          "customerPhone": {
                            "type": "string"
                          },
                          "planId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "planName": {
                            "type": "string"
                          },
                          "billingInterval": {
                            "type": "string"
                          },
                          "enrollmentFee": {
                            "type": "integer"
                          },
                          "cycleNo": {
                            "type": "integer"
                          },
                          "periodStart": {
                            "type": "string",
                            "format": "date"
                          },
                          "dueDate": {
                            "type": "string",
                            "format": "date"
                          },
                          "amount": {
                            "type": "integer"
                          },
                          "amountPaid": {
                            "type": "integer"
                          },
                          "balance": {
                            "type": "integer"
                          },
                          "receivableId": {
                            "nullable": true
                          },
                          "receivableStatus": {
                            "nullable": true
                          },
                          "saleId": {
                            "nullable": true
                          },
                          "saleNumber": {
                            "nullable": true
                          },
                          "membershipStatus": {
                            "type": "string"
                          },
                          "graceDays": {
                            "type": "integer"
                          },
                          "scheduled": {
                            "type": "boolean"
                          },
                          "daysOverdue": {
                            "type": "integer"
                          },
                          "situation": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "page": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "asOf": {
                      "type": "string",
                      "format": "date"
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "amount": {
                          "type": "integer"
                        },
                        "balance": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "items": [
                    {
                      "id": null,
                      "membershipId": "9274d49b-8446-42db-8483-2dd931826e5a",
                      "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                      "customerName": "Maria Souza",
                      "customerPhone": "11987654321",
                      "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                      "planName": "Plano mensal",
                      "billingInterval": "MONTHLY",
                      "enrollmentFee": 0,
                      "cycleNo": 1,
                      "periodStart": "2026-12-10",
                      "dueDate": "2026-12-10",
                      "amount": 100,
                      "amountPaid": 0,
                      "balance": 0,
                      "receivableId": null,
                      "receivableStatus": null,
                      "saleId": null,
                      "saleNumber": null,
                      "membershipStatus": "ACTIVE",
                      "graceDays": 0,
                      "scheduled": true,
                      "daysOverdue": 0,
                      "situation": "upcoming"
                    }
                  ],
                  "total": 1,
                  "page": 1,
                  "limit": 50,
                  "asOf": "2026-11-12",
                  "totals": {
                    "amount": 100,
                    "balance": 0
                  }
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Cobranças de todas as assinaturas: a vencer, vencidas ou pagas. Para Operador, o valor de um ciclo que ainda não virou venda vem `null`.\n\n**Papel mínimo do token:** Operador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl \"https://api.nivro.app/api/v1/memberships/charges?status=overdue\" \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships": {
      "get": {
        "operationId": "MembershipsPublicController_findAll",
        "summary": "Lista assinaturas, com o cliente, o plano, a situação e o próximo vencimento",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "TRIALING",
                "ACTIVE",
                "PAUSED",
                "PAST_DUE",
                "SUSPENDED",
                "CANCELED",
                "ENDED"
              ],
              "type": "string"
            },
            "description": "Situação a filtrar."
          },
          {
            "name": "customerId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Id do cliente."
          },
          {
            "name": "planId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Id do plano."
          },
          {
            "name": "q",
            "required": false,
            "in": "query",
            "description": "Busca pelo nome, e-mail ou telefone do cliente.",
            "schema": {
              "maxLength": 100,
              "type": "string"
            }
          },
          {
            "name": "delinquent",
            "required": false,
            "in": "query",
            "description": "`true`: só as que têm parcela vencida além da carência (inadimplentes).",
            "schema": {
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          },
          {
            "name": "dueFrom",
            "required": false,
            "in": "query",
            "description": "Próximo vencimento a partir de (AAAA-MM-DD).",
            "schema": {
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
              "type": "string"
            }
          },
          {
            "name": "dueTo",
            "required": false,
            "in": "query",
            "description": "Próximo vencimento até (AAAA-MM-DD).",
            "schema": {
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "type": "number"
            },
            "description": "Página, a partir de 1."
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 200,
              "type": "number"
            },
            "description": "Itens por página (padrão 50, máximo 200)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "customerId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "customerName": {
                            "type": "string"
                          },
                          "customerEmail": {
                            "type": "string"
                          },
                          "customerPhone": {
                            "type": "string"
                          },
                          "planId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "planName": {
                            "type": "string"
                          },
                          "billingInterval": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "startDate": {
                            "type": "string",
                            "format": "date"
                          },
                          "nextRunAt": {
                            "type": "string",
                            "format": "date"
                          },
                          "billingDay": {
                            "type": "integer"
                          },
                          "price": {
                            "type": "integer"
                          },
                          "trialEndsAt": {
                            "nullable": true
                          },
                          "pausedUntil": {
                            "nullable": true
                          },
                          "endDate": {
                            "nullable": true
                          },
                          "cancelAtPeriodEnd": {
                            "type": "boolean"
                          },
                          "canceledAt": {
                            "nullable": true
                          },
                          "cancelReason": {
                            "nullable": true
                          },
                          "pendingPlanId": {
                            "nullable": true
                          },
                          "pendingPrice": {
                            "nullable": true
                          },
                          "discountType": {
                            "nullable": true
                          },
                          "discountValue": {
                            "nullable": true
                          },
                          "discountCycles": {
                            "nullable": true
                          },
                          "discountCyclesUsed": {
                            "type": "integer"
                          },
                          "suspendedAt": {
                            "nullable": true
                          },
                          "suspendedManually": {
                            "type": "boolean"
                          },
                          "notes": {
                            "nullable": true
                          },
                          "paymentProvider": {
                            "nullable": true
                          },
                          "externalId": {
                            "nullable": true
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "graceDays": {
                            "type": "integer"
                          },
                          "pendingPlanName": {
                            "nullable": true
                          },
                          "pendingBillingInterval": {
                            "nullable": true
                          },
                          "overdue": {
                            "type": "boolean"
                          },
                          "nextSkipped": {
                            "type": "boolean"
                          },
                          "mrr": {
                            "type": "integer"
                          },
                          "netPrice": {
                            "type": "integer"
                          },
                          "discountActive": {
                            "type": "boolean"
                          },
                          "discountCyclesLeft": {
                            "nullable": true
                          },
                          "nextBilledAt": {
                            "type": "string",
                            "format": "date"
                          }
                        }
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "page": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "items": [
                    {
                      "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                      "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                      "customerName": "Maria Souza",
                      "customerEmail": "maria.souza@exemplo.com.br",
                      "customerPhone": "11987654321",
                      "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                      "planName": "Plano mensal",
                      "billingInterval": "MONTHLY",
                      "status": "ACTIVE",
                      "startDate": "2026-11-12",
                      "nextRunAt": "2026-12-10",
                      "billingDay": 10,
                      "price": 100,
                      "trialEndsAt": null,
                      "pausedUntil": null,
                      "endDate": null,
                      "cancelAtPeriodEnd": false,
                      "canceledAt": null,
                      "cancelReason": null,
                      "pendingPlanId": null,
                      "pendingPrice": null,
                      "discountType": null,
                      "discountValue": null,
                      "discountCycles": null,
                      "discountCyclesUsed": 0,
                      "suspendedAt": null,
                      "suspendedManually": false,
                      "notes": null,
                      "paymentProvider": null,
                      "externalId": null,
                      "createdAt": "2026-11-12T14:30:00.000Z",
                      "updatedAt": "2026-11-12T14:30:00.000Z",
                      "graceDays": 0,
                      "pendingPlanName": null,
                      "pendingBillingInterval": null,
                      "overdue": false,
                      "nextSkipped": false,
                      "mrr": 100,
                      "netPrice": 100,
                      "discountActive": false,
                      "discountCyclesLeft": null,
                      "nextBilledAt": "2026-12-10"
                    }
                  ],
                  "total": 1,
                  "page": 1,
                  "limit": 50
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Operador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl \"https://api.nivro.app/api/v1/memberships?status=ACTIVE&delinquent=true\" \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      },
      "post": {
        "operationId": "MembershipsPublicController_create",
        "summary": "Assina um cliente a um plano",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Chave gerada pelo cliente. Repetir a requisição com a mesma chave devolve a assinatura já criada em vez de criar outra.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMembershipDto"
              },
              "example": {
                "customerId": "CUSTOMER_ID",
                "planId": "PLAN_ID",
                "billingDay": 10
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "nullable": true
                    },
                    "pendingPrice": {
                      "nullable": true
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "nullable": true
                    },
                    "pendingBillingInterval": {
                      "nullable": true
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "type": "integer"
                          },
                          "reason": {
                            "nullable": true
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string"
                              },
                              "trialDays": {
                                "type": "integer"
                              },
                              "firstDueDate": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "customerName": "Maria Souza",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "ACTIVE",
                  "startDate": "2026-11-12",
                  "nextRunAt": "2026-12-10",
                  "billingDay": 10,
                  "price": 100,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": null,
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": null,
                  "pendingPrice": null,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": null,
                  "pendingBillingInterval": null,
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 100,
                  "netPrice": 100,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-12-10",
                  "charges": [],
                  "events": [
                    {
                      "id": "e7767b04-2d01-4a13-867a-93b0f94b2a54",
                      "type": "CREATED",
                      "mrrDelta": 100,
                      "fromPlanId": null,
                      "toPlanId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                      "fromPrice": null,
                      "toPrice": 100,
                      "reason": null,
                      "detail": {
                        "status": "ACTIVE",
                        "trialDays": 0,
                        "firstDueDate": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-12-10",
                    "skipped": false,
                    "bruto": 100,
                    "desconto": 0,
                    "liquido": 100,
                    "adesao": 0,
                    "total": 100,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-12-10",
                    "2027-01-10"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Assina um cliente a um plano. Aceita `Idempotency-Key`. `startDate` padrão é hoje; `price` negocia um valor diferente do plano; `trialDays`, `endDate` e o desconto (`discountType`, `discountValue`, `discountCycles`) são opcionais.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/memberships \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"customerId\": \"CUSTOMER_ID\", \"planId\": \"PLAN_ID\", \"billingDay\": 10}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/{id}": {
      "get": {
        "operationId": "MembershipsPublicController_findOne",
        "summary": "Ficha da assinatura: a cobrança de cada ciclo, o histórico e as exceções",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "nullable": true
                    },
                    "pendingPrice": {
                      "nullable": true
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "nullable": true
                    },
                    "pendingBillingInterval": {
                      "nullable": true
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "type": "integer"
                          },
                          "reason": {
                            "nullable": true
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string"
                              },
                              "trialDays": {
                                "type": "integer"
                              },
                              "firstDueDate": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "customerName": "Maria Souza",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "ACTIVE",
                  "startDate": "2026-11-12",
                  "nextRunAt": "2026-12-10",
                  "billingDay": 10,
                  "price": 100,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": null,
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": null,
                  "pendingPrice": null,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": null,
                  "pendingBillingInterval": null,
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 100,
                  "netPrice": 100,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-12-10",
                  "charges": [],
                  "events": [
                    {
                      "id": "e7767b04-2d01-4a13-867a-93b0f94b2a54",
                      "type": "CREATED",
                      "mrrDelta": 100,
                      "fromPlanId": null,
                      "toPlanId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                      "fromPrice": null,
                      "toPrice": 100,
                      "reason": null,
                      "detail": {
                        "status": "ACTIVE",
                        "trialDays": 0,
                        "firstDueDate": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-12-10",
                    "skipped": false,
                    "bruto": 100,
                    "desconto": 0,
                    "liquido": 100,
                    "adesao": 0,
                    "total": 100,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-12-10",
                    "2027-01-10"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Ficha da assinatura: a cobrança de cada ciclo, o histórico e as exceções. Operador não recebe preço, desconto, histórico nem exceções.\n\n**Papel mínimo do token:** Operador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      },
      "patch": {
        "operationId": "MembershipsPublicController_update",
        "summary": "Altera a data de término e as observações da assinatura",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMembershipDto"
              },
              "example": {
                "endDate": "2027-12-31",
                "notes": "Contrato anual"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "pendingPrice": {
                      "type": "integer"
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "type": "string"
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "type": "string"
                    },
                    "pendingBillingInterval": {
                      "type": "string"
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "nullable": true
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "nullable": true
                          },
                          "reason": {
                            "type": "string"
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "cancelsAt": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "customerName": "Maria Souza",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "ACTIVE",
                  "startDate": "2026-11-12",
                  "nextRunAt": "2026-12-10",
                  "billingDay": 10,
                  "price": 110,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": "2027-12-31",
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": "249edb87-2ff6-42f5-81a6-a253bb5820b9",
                  "pendingPrice": 90,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": "Contrato anual",
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": "Plano anual",
                  "pendingBillingInterval": "MONTHLY",
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 110,
                  "netPrice": 110,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-12-10",
                  "charges": [],
                  "events": [
                    {
                      "id": "e222f9d2-9eeb-48cc-8600-b43b89807ba0",
                      "type": "CANCEL_SCHEDULED",
                      "mrrDelta": 0,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": "Mudou de cidade",
                      "detail": {
                        "cancelsAt": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    },
                    {
                      "id": "e5522d10-0a52-461d-8560-cf23dffc72c9",
                      "type": "CANCEL_SCHEDULED",
                      "mrrDelta": 0,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": null,
                      "detail": {
                        "undone": true
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-12-10",
                    "skipped": false,
                    "bruto": 90,
                    "desconto": 0,
                    "liquido": 90,
                    "adesao": 0,
                    "total": 90,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-12-10",
                    "2027-01-10"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Altera o término (`endDate`, AAAA-MM-DD, `null` tira o término) e as observações (`notes`). Só o que for enviado muda.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X PATCH https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"endDate\": \"2027-12-31\", \"notes\": \"Contrato anual\"}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/{id}/receive": {
      "post": {
        "operationId": "MembershipsPublicController_receive",
        "summary": "Dá baixa, pelo valor integral, nas mensalidades em aberto da assinatura e devolve o que entrou e o que não",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Chave gerada pelo cliente. Repetir a requisição com a mesma chave devolve o mesmo resultado, sem dar baixa de novo.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReceiveMembershipDto"
              },
              "example": {
                "receivableIds": [
                  "RECEIVABLE_ID"
                ],
                "method": "PIX",
                "paidAt": "2026-11-12"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "paid": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "receivableId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "paymentId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "amount": {
                            "type": "integer"
                          },
                          "cycleNo": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "failed": {
                      "type": "array",
                      "items": {}
                    },
                    "totalPaid": {
                      "type": "integer"
                    },
                    "membershipStatus": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "paid": [
                    {
                      "receivableId": "9f34ab21-3432-4c4c-8b3a-701da5fc1dd7",
                      "paymentId": "0cba8a92-1cb3-4f1f-88b2-30d21a6378f2",
                      "amount": 100,
                      "cycleNo": 1
                    }
                  ],
                  "failed": [],
                  "totalPaid": 100,
                  "membershipStatus": "ACTIVE"
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Dá baixa, pelo valor integral, nas mensalidades em aberto da assinatura (`receivableIds`, de 1 a 60) e devolve o que entrou (`paid`), o que não (`failed`), o total e a situação da assinatura. Aceita `Idempotency-Key`. Parcela de outra assinatura é `400`; parcela já paga ou cancelada é `409`.\n\n**Papel mínimo do token:** Operador.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID/receive \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Idempotency-Key: baixa-2026-11-ciclo-1\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"receivableIds\": [\"RECEIVABLE_ID\"], \"method\": \"PIX\", \"paidAt\": \"2026-11-12\"}'"
          }
        ],
        "x-papeis": [
          "Operador",
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/{id}/pause": {
      "post": {
        "operationId": "MembershipsPublicController_pause",
        "summary": "Pausa a assinatura, sem cobrar, até uma data ou até retomar",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PauseMembershipDto"
              },
              "example": {
                "until": "2026-12-15",
                "reason": "Viagem"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "type": "string",
                      "format": "date"
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "pendingPrice": {
                      "type": "integer"
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "type": "string"
                    },
                    "pendingBillingInterval": {
                      "type": "string"
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "type": "integer"
                          },
                          "reason": {
                            "nullable": true
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string"
                              },
                              "trialDays": {
                                "type": "integer"
                              },
                              "firstDueDate": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "customerName": "Maria Souza",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "PAUSED",
                  "startDate": "2026-11-12",
                  "nextRunAt": "2026-12-10",
                  "billingDay": 10,
                  "price": 100,
                  "trialEndsAt": null,
                  "pausedUntil": "2026-12-15",
                  "endDate": null,
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": "249edb87-2ff6-42f5-81a6-a253bb5820b9",
                  "pendingPrice": 90,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": "Plano anual",
                  "pendingBillingInterval": "MONTHLY",
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 0,
                  "netPrice": 100,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-12-10",
                  "charges": [],
                  "events": [
                    {
                      "id": "e7767b04-2d01-4a13-867a-93b0f94b2a54",
                      "type": "CREATED",
                      "mrrDelta": 100,
                      "fromPlanId": null,
                      "toPlanId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                      "fromPrice": null,
                      "toPrice": 100,
                      "reason": null,
                      "detail": {
                        "status": "ACTIVE",
                        "trialDays": 0,
                        "firstDueDate": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    },
                    {
                      "id": "1ea206e2-0ed0-42b7-8298-96a851f381e5",
                      "type": "PAUSED",
                      "mrrDelta": -100,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": "Viagem",
                      "detail": {
                        "from": "ACTIVE",
                        "until": "2026-12-15"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-12-10",
                    "skipped": false,
                    "bruto": 90,
                    "desconto": 0,
                    "liquido": 90,
                    "adesao": 0,
                    "total": 90,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-12-10",
                    "2027-01-10"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Pausa a assinatura, sem cobrar, até `until` (AAAA-MM-DD) ou até alguém retomar.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID/pause \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"until\": \"2026-12-15\", \"reason\": \"Viagem\"}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/{id}/resume": {
      "post": {
        "operationId": "MembershipsPublicController_resume",
        "summary": "Retoma uma assinatura pausada",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "pendingPrice": {
                      "type": "integer"
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "type": "string"
                    },
                    "pendingBillingInterval": {
                      "type": "string"
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "type": "integer"
                          },
                          "reason": {
                            "nullable": true
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string"
                              },
                              "trialDays": {
                                "type": "integer"
                              },
                              "firstDueDate": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "customerName": "Maria Souza",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "ACTIVE",
                  "startDate": "2026-11-12",
                  "nextRunAt": "2026-12-10",
                  "billingDay": 10,
                  "price": 100,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": null,
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": "249edb87-2ff6-42f5-81a6-a253bb5820b9",
                  "pendingPrice": 90,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": "Plano anual",
                  "pendingBillingInterval": "MONTHLY",
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 100,
                  "netPrice": 100,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-12-10",
                  "charges": [],
                  "events": [
                    {
                      "id": "e7767b04-2d01-4a13-867a-93b0f94b2a54",
                      "type": "CREATED",
                      "mrrDelta": 100,
                      "fromPlanId": null,
                      "toPlanId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                      "fromPrice": null,
                      "toPrice": 100,
                      "reason": null,
                      "detail": {
                        "status": "ACTIVE",
                        "trialDays": 0,
                        "firstDueDate": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    },
                    {
                      "id": "1ea206e2-0ed0-42b7-8298-96a851f381e5",
                      "type": "PAUSED",
                      "mrrDelta": -100,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": "Viagem",
                      "detail": {
                        "from": "ACTIVE",
                        "until": "2026-12-15"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-12-10",
                    "skipped": false,
                    "bruto": 90,
                    "desconto": 0,
                    "liquido": 90,
                    "adesao": 0,
                    "total": 90,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-12-10",
                    "2027-01-10"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID/resume \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/{id}/cancel": {
      "post": {
        "operationId": "MembershipsPublicController_cancel",
        "summary": "Cancela agora ou no fim do período já cobrado; opcionalmente cancela as parcelas em aberto",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelMembershipDto"
              },
              "example": {
                "atPeriodEnd": true,
                "reason": "Mudou de cidade"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "type": "string"
                    },
                    "pendingPlanId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "pendingPrice": {
                      "type": "integer"
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "type": "string"
                    },
                    "pendingBillingInterval": {
                      "type": "string"
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "nullable": true
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "nullable": true
                          },
                          "reason": {
                            "type": "string"
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "cancelsAt": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    },
                    "canceledSales": {
                      "type": "array",
                      "items": {}
                    },
                    "failedSales": {
                      "type": "array",
                      "items": {}
                    }
                  }
                },
                "example": {
                  "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "customerName": "Maria Souza",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "ACTIVE",
                  "startDate": "2026-11-12",
                  "nextRunAt": "2026-12-10",
                  "billingDay": 10,
                  "price": 100,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": null,
                  "cancelAtPeriodEnd": true,
                  "canceledAt": null,
                  "cancelReason": "Mudou de cidade",
                  "pendingPlanId": "249edb87-2ff6-42f5-81a6-a253bb5820b9",
                  "pendingPrice": 90,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": "Plano anual",
                  "pendingBillingInterval": "MONTHLY",
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 100,
                  "netPrice": 100,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-12-10",
                  "charges": [],
                  "events": [
                    {
                      "id": "e222f9d2-9eeb-48cc-8600-b43b89807ba0",
                      "type": "CANCEL_SCHEDULED",
                      "mrrDelta": 0,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": "Mudou de cidade",
                      "detail": {
                        "cancelsAt": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    },
                    {
                      "id": "e7767b04-2d01-4a13-867a-93b0f94b2a54",
                      "type": "CREATED",
                      "mrrDelta": 100,
                      "fromPlanId": null,
                      "toPlanId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                      "fromPrice": null,
                      "toPrice": 100,
                      "reason": null,
                      "detail": {
                        "status": "ACTIVE",
                        "trialDays": 0,
                        "firstDueDate": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-12-10",
                    "skipped": false,
                    "bruto": 90,
                    "desconto": 0,
                    "liquido": 90,
                    "adesao": 0,
                    "total": 90,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-12-10",
                    "2027-01-10"
                  ],
                  "canceledSales": [],
                  "failedSales": []
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Cancela agora ou, com `atPeriodEnd: true`, no fim do período já cobrado. `cancelOpenCharges: true` cancela também as parcelas em aberto, sem nenhum pagamento.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID/cancel \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"atPeriodEnd\": true, \"reason\": \"Mudou de cidade\"}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/{id}/suspend": {
      "post": {
        "operationId": "MembershipsPublicController_suspend",
        "summary": "Suspende a assinatura: sai do MRR e não gera mensalidade até alguém reativar",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SuspendMembershipDto"
              },
              "example": {
                "reason": "Mensalidade em atraso"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "nullable": true
                    },
                    "pendingPrice": {
                      "nullable": true
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "nullable": true
                    },
                    "pendingBillingInterval": {
                      "nullable": true
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "type": "integer"
                          },
                          "reason": {
                            "nullable": true
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string"
                              },
                              "trialDays": {
                                "type": "integer"
                              },
                              "firstDueDate": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "customerName": "Maria Souza",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "SUSPENDED",
                  "startDate": "2026-11-12",
                  "nextRunAt": "2026-12-10",
                  "billingDay": 10,
                  "price": 100,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": null,
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": null,
                  "pendingPrice": null,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": "2026-11-12T14:30:00.000Z",
                  "suspendedManually": true,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": null,
                  "pendingBillingInterval": null,
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 0,
                  "netPrice": 100,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-12-10",
                  "charges": [],
                  "events": [
                    {
                      "id": "e7767b04-2d01-4a13-867a-93b0f94b2a54",
                      "type": "CREATED",
                      "mrrDelta": 100,
                      "fromPlanId": null,
                      "toPlanId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                      "fromPrice": null,
                      "toPrice": 100,
                      "reason": null,
                      "detail": {
                        "status": "ACTIVE",
                        "trialDays": 0,
                        "firstDueDate": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    },
                    {
                      "id": "357b1df3-921e-4ba6-8756-0cdc2ea05be3",
                      "type": "SUSPENDED",
                      "mrrDelta": -100,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": "Mensalidade em atraso",
                      "detail": {
                        "from": "ACTIVE",
                        "manual": true
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-12-10",
                    "skipped": false,
                    "bruto": 100,
                    "desconto": 0,
                    "liquido": 100,
                    "adesao": 0,
                    "total": 100,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-12-10",
                    "2027-01-10"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Suspende a assinatura: sai do MRR e não gera mensalidade até alguém reativar. `reason` fica no histórico.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID/suspend \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"reason\": \"Mensalidade em atraso\"}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/{id}/reactivate": {
      "post": {
        "operationId": "MembershipsPublicController_reactivate",
        "summary": "Reativa uma assinatura suspensa, sem cobrar os vencimentos que passaram",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SuspendMembershipDto"
              },
              "example": {
                "reason": "Regularizou o pagamento"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "nullable": true
                    },
                    "pendingPrice": {
                      "nullable": true
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "nullable": true
                    },
                    "pendingBillingInterval": {
                      "nullable": true
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "type": "integer"
                          },
                          "reason": {
                            "nullable": true
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string"
                              },
                              "trialDays": {
                                "type": "integer"
                              },
                              "firstDueDate": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "customerName": "Maria Souza",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "ACTIVE",
                  "startDate": "2026-11-12",
                  "nextRunAt": "2026-12-10",
                  "billingDay": 10,
                  "price": 100,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": null,
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": null,
                  "pendingPrice": null,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": null,
                  "pendingBillingInterval": null,
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 100,
                  "netPrice": 100,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-12-10",
                  "charges": [],
                  "events": [
                    {
                      "id": "e7767b04-2d01-4a13-867a-93b0f94b2a54",
                      "type": "CREATED",
                      "mrrDelta": 100,
                      "fromPlanId": null,
                      "toPlanId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                      "fromPrice": null,
                      "toPrice": 100,
                      "reason": null,
                      "detail": {
                        "status": "ACTIVE",
                        "trialDays": 0,
                        "firstDueDate": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    },
                    {
                      "id": "868a42f7-ff1f-4011-806a-eb79402f44e2",
                      "type": "REACTIVATED",
                      "mrrDelta": 100,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": "Regularizou o pagamento",
                      "detail": {
                        "from": "SUSPENDED",
                        "nextRunAt": "2026-12-10",
                        "skippedCount": 0,
                        "skippedCycles": []
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-12-10",
                    "skipped": false,
                    "bruto": 100,
                    "desconto": 0,
                    "liquido": 100,
                    "adesao": 0,
                    "total": 100,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-12-10",
                    "2027-01-10"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID/reactivate \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"reason\": \"Regularizou o pagamento\"}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/{id}/change-plan": {
      "post": {
        "operationId": "MembershipsPublicController_changePlan",
        "summary": "Agenda a troca de plano para o próximo ciclo",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePlanDto"
              },
              "example": {
                "planId": "PLAN_ID",
                "price": 90
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "pendingPrice": {
                      "type": "integer"
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "type": "string"
                    },
                    "pendingBillingInterval": {
                      "type": "string"
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "type": "integer"
                          },
                          "reason": {
                            "nullable": true
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string"
                              },
                              "trialDays": {
                                "type": "integer"
                              },
                              "firstDueDate": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "customerName": "Maria Souza",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "ACTIVE",
                  "startDate": "2026-11-12",
                  "nextRunAt": "2026-12-10",
                  "billingDay": 10,
                  "price": 100,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": null,
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": "249edb87-2ff6-42f5-81a6-a253bb5820b9",
                  "pendingPrice": 90,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": "Plano anual",
                  "pendingBillingInterval": "MONTHLY",
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 100,
                  "netPrice": 100,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-12-10",
                  "charges": [],
                  "events": [
                    {
                      "id": "e7767b04-2d01-4a13-867a-93b0f94b2a54",
                      "type": "CREATED",
                      "mrrDelta": 100,
                      "fromPlanId": null,
                      "toPlanId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                      "fromPrice": null,
                      "toPrice": 100,
                      "reason": null,
                      "detail": {
                        "status": "ACTIVE",
                        "trialDays": 0,
                        "firstDueDate": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    },
                    {
                      "id": "3c803e62-0917-415b-85e7-b57eb8af5489",
                      "type": "PLAN_CHANGE_SCHEDULED",
                      "mrrDelta": 0,
                      "fromPlanId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                      "toPlanId": "249edb87-2ff6-42f5-81a6-a253bb5820b9",
                      "fromPrice": 100,
                      "toPrice": 90,
                      "reason": "Pediu o plano mais barato",
                      "detail": {
                        "appliesAt": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-12-10",
                    "skipped": false,
                    "bruto": 90,
                    "desconto": 0,
                    "liquido": 90,
                    "adesao": 0,
                    "total": 90,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-12-10",
                    "2027-01-10"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Agenda a troca para outro plano a partir do próximo ciclo. Mandar o plano atual desfaz a troca agendada. Plano inexistente ou desativado é `400`.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID/change-plan \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"planId\": \"PLAN_ID\", \"price\": 90}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/{id}/keep": {
      "post": {
        "operationId": "MembershipsPublicController_keep",
        "summary": "Desfaz o cancelamento agendado para o fim do período",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "pendingPrice": {
                      "type": "integer"
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "type": "string"
                    },
                    "pendingBillingInterval": {
                      "type": "string"
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "nullable": true
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "nullable": true
                          },
                          "reason": {
                            "type": "string"
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "cancelsAt": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "customerName": "Maria Souza",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "ACTIVE",
                  "startDate": "2026-11-12",
                  "nextRunAt": "2026-12-10",
                  "billingDay": 10,
                  "price": 100,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": null,
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": "249edb87-2ff6-42f5-81a6-a253bb5820b9",
                  "pendingPrice": 90,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": "Plano anual",
                  "pendingBillingInterval": "MONTHLY",
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 100,
                  "netPrice": 100,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-12-10",
                  "charges": [],
                  "events": [
                    {
                      "id": "e222f9d2-9eeb-48cc-8600-b43b89807ba0",
                      "type": "CANCEL_SCHEDULED",
                      "mrrDelta": 0,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": "Mudou de cidade",
                      "detail": {
                        "cancelsAt": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    },
                    {
                      "id": "e5522d10-0a52-461d-8560-cf23dffc72c9",
                      "type": "CANCEL_SCHEDULED",
                      "mrrDelta": 0,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": null,
                      "detail": {
                        "undone": true
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-12-10",
                    "skipped": false,
                    "bruto": 90,
                    "desconto": 0,
                    "liquido": 90,
                    "adesao": 0,
                    "total": 90,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-12-10",
                    "2027-01-10"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Desfaz o cancelamento agendado para o fim do período. Sem cancelamento agendado é `409`.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID/keep \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/{id}/discount": {
      "post": {
        "operationId": "MembershipsPublicController_setDiscount",
        "summary": "Aplica desconto na assinatura (percentual ou valor, por N ciclos ou para sempre); substitui o anterior",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetDiscountDto"
              },
              "example": {
                "type": "PERCENT",
                "value": 100,
                "cycles": 3,
                "reason": "Cortesia de boas-vindas"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "pendingPrice": {
                      "type": "integer"
                    },
                    "discountType": {
                      "type": "string"
                    },
                    "discountValue": {
                      "type": "integer"
                    },
                    "discountCycles": {
                      "type": "integer"
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "type": "string"
                    },
                    "pendingBillingInterval": {
                      "type": "string"
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "type": "integer"
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "nullable": true
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "nullable": true
                          },
                          "reason": {
                            "type": "string"
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "cancelsAt": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "customerName": "Maria Souza",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "ACTIVE",
                  "startDate": "2026-11-12",
                  "nextRunAt": "2026-12-10",
                  "billingDay": 10,
                  "price": 100,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": null,
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": "249edb87-2ff6-42f5-81a6-a253bb5820b9",
                  "pendingPrice": 90,
                  "discountType": "PERCENT",
                  "discountValue": 100,
                  "discountCycles": 3,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": "Plano anual",
                  "pendingBillingInterval": "MONTHLY",
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 0,
                  "netPrice": 0,
                  "discountActive": true,
                  "discountCyclesLeft": 3,
                  "nextBilledAt": "2026-12-10",
                  "charges": [],
                  "events": [
                    {
                      "id": "e222f9d2-9eeb-48cc-8600-b43b89807ba0",
                      "type": "CANCEL_SCHEDULED",
                      "mrrDelta": 0,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": "Mudou de cidade",
                      "detail": {
                        "cancelsAt": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    },
                    {
                      "id": "e5522d10-0a52-461d-8560-cf23dffc72c9",
                      "type": "CANCEL_SCHEDULED",
                      "mrrDelta": 0,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": null,
                      "detail": {
                        "undone": true
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-12-10",
                    "skipped": false,
                    "bruto": 90,
                    "desconto": 90,
                    "liquido": 0,
                    "adesao": 0,
                    "total": 0,
                    "descontoConsumido": true
                  },
                  "upcomingDueDates": [
                    "2026-12-10",
                    "2027-01-10"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Aplica desconto na assinatura, no estilo cupom: `PERCENT` (até 100) ou `AMOUNT`. `cycles` limita a quantos ciclos vale; sem ele vale para sempre. Substitui o desconto atual.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID/discount \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"type\": \"PERCENT\", \"value\": 100, \"cycles\": 3, \"reason\": \"Cortesia de boas-vindas\"}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      },
      "delete": {
        "operationId": "MembershipsPublicController_removeDiscount",
        "summary": "Remove o desconto da assinatura",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "pendingPrice": {
                      "type": "integer"
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "type": "string"
                    },
                    "pendingBillingInterval": {
                      "type": "string"
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "nullable": true
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "nullable": true
                          },
                          "reason": {
                            "type": "string"
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "cancelsAt": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "customerName": "Maria Souza",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "ACTIVE",
                  "startDate": "2026-11-12",
                  "nextRunAt": "2026-12-10",
                  "billingDay": 10,
                  "price": 100,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": null,
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": "249edb87-2ff6-42f5-81a6-a253bb5820b9",
                  "pendingPrice": 90,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": "Plano anual",
                  "pendingBillingInterval": "MONTHLY",
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 100,
                  "netPrice": 100,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-12-10",
                  "charges": [],
                  "events": [
                    {
                      "id": "e222f9d2-9eeb-48cc-8600-b43b89807ba0",
                      "type": "CANCEL_SCHEDULED",
                      "mrrDelta": 0,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": "Mudou de cidade",
                      "detail": {
                        "cancelsAt": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    },
                    {
                      "id": "e5522d10-0a52-461d-8560-cf23dffc72c9",
                      "type": "CANCEL_SCHEDULED",
                      "mrrDelta": 0,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": null,
                      "detail": {
                        "undone": true
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-12-10",
                    "skipped": false,
                    "bruto": 90,
                    "desconto": 0,
                    "liquido": 90,
                    "adesao": 0,
                    "total": 90,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-12-10",
                    "2027-01-10"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Remove o desconto da assinatura. Sem desconto aplicado é `409` (`no_discount`).\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X DELETE https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID/discount \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/{id}/reprice": {
      "post": {
        "operationId": "MembershipsPublicController_reprice",
        "summary": "Reajusta o preço negociado da assinatura, a partir do próximo ciclo a gerar",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RepriceMembershipDto"
              },
              "example": {
                "price": 110,
                "reason": "Reajuste anual"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "type": "string"
                    },
                    "customerPhone": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "pendingPrice": {
                      "type": "integer"
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "type": "string"
                    },
                    "pendingBillingInterval": {
                      "type": "string"
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "nullable": true
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "nullable": true
                          },
                          "reason": {
                            "type": "string"
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "cancelsAt": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "9274d49b-8446-42db-8483-2dd931826e5a",
                  "customerId": "09923d7f-b1e5-4efe-8d32-376a9016c4ab",
                  "customerName": "Maria Souza",
                  "customerEmail": "maria.souza@exemplo.com.br",
                  "customerPhone": "11987654321",
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "ACTIVE",
                  "startDate": "2026-11-12",
                  "nextRunAt": "2026-12-10",
                  "billingDay": 10,
                  "price": 110,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": null,
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": "249edb87-2ff6-42f5-81a6-a253bb5820b9",
                  "pendingPrice": 90,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": "Plano anual",
                  "pendingBillingInterval": "MONTHLY",
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 110,
                  "netPrice": 110,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-12-10",
                  "charges": [],
                  "events": [
                    {
                      "id": "e222f9d2-9eeb-48cc-8600-b43b89807ba0",
                      "type": "CANCEL_SCHEDULED",
                      "mrrDelta": 0,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": "Mudou de cidade",
                      "detail": {
                        "cancelsAt": "2026-12-10"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    },
                    {
                      "id": "e5522d10-0a52-461d-8560-cf23dffc72c9",
                      "type": "CANCEL_SCHEDULED",
                      "mrrDelta": 0,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": null,
                      "detail": {
                        "undone": true
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-12-10",
                    "skipped": false,
                    "bruto": 90,
                    "desconto": 0,
                    "liquido": 90,
                    "adesao": 0,
                    "total": 90,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-12-10",
                    "2027-01-10"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Reajusta o preço negociado da assinatura a partir do próximo ciclo a gerar. O preço igual ao atual é `400`. `reason` fica no histórico.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID/reprice \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"price\": 110, \"reason\": \"Reajuste anual\"}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/{id}/exceptions": {
      "post": {
        "operationId": "MembershipsPublicController_setException",
        "summary": "Isenta um ciclo futuro (SKIP) ou troca o valor dele (OVERRIDE)",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetChargeExceptionDto"
              },
              "example": {
                "periodStart": "2026-12-10",
                "type": "OVERRIDE",
                "amountOverride": 80,
                "reason": "Mês promocional"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "nullable": true
                    },
                    "customerPhone": {
                      "nullable": true
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "nullable": true
                    },
                    "pendingPrice": {
                      "nullable": true
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "nullable": true
                    },
                    "pendingBillingInterval": {
                      "nullable": true
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "type": "integer"
                          },
                          "reason": {
                            "nullable": true
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string"
                              },
                              "trialDays": {
                                "type": "integer"
                              },
                              "firstDueDate": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "periodStart": {
                            "type": "string",
                            "format": "date"
                          },
                          "type": {
                            "type": "string"
                          },
                          "amountOverride": {
                            "type": "integer"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "e7ba820d-5cec-4d94-8c90-c05a6f919258",
                  "customerId": "ed1d5590-290d-4dee-8ec8-ab471b0b16f6",
                  "customerName": "Marcos Teixeira",
                  "customerEmail": null,
                  "customerPhone": null,
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "ACTIVE",
                  "startDate": "2026-11-23",
                  "nextRunAt": "2026-11-23",
                  "billingDay": 23,
                  "price": 100,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": null,
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": null,
                  "pendingPrice": null,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": null,
                  "pendingBillingInterval": null,
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 100,
                  "netPrice": 100,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-11-23",
                  "charges": [],
                  "events": [
                    {
                      "id": "4874abaa-13e5-4443-8634-322212cda8a2",
                      "type": "CREATED",
                      "mrrDelta": 100,
                      "fromPlanId": null,
                      "toPlanId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                      "fromPrice": null,
                      "toPrice": 100,
                      "reason": null,
                      "detail": {
                        "status": "ACTIVE",
                        "trialDays": 0,
                        "firstDueDate": "2026-11-23"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    },
                    {
                      "id": "bac3cc32-9877-4b16-84a7-3602b904cc37",
                      "type": "CYCLE_OVERRIDDEN",
                      "mrrDelta": 0,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": 100,
                      "toPrice": 80,
                      "reason": "Mês promocional",
                      "detail": {
                        "periodStart": "2026-11-23"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [
                    {
                      "id": "ccde1c7f-e784-4614-8852-ed0cb646af13",
                      "periodStart": "2026-11-23",
                      "type": "OVERRIDE",
                      "amountOverride": 80,
                      "reason": "Mês promocional",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "nextCharge": {
                    "dueDate": "2026-11-23",
                    "skipped": false,
                    "bruto": 80,
                    "desconto": 0,
                    "liquido": 80,
                    "adesao": 0,
                    "total": 80,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-11-23",
                    "2026-12-23"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Isenta um ciclo futuro (`SKIP`) ou troca o valor dele (`OVERRIDE`, com `amountOverride`). `periodStart` precisa ser um vencimento futuro da assinatura.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID/exceptions \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"periodStart\": \"2026-12-10\", \"type\": \"OVERRIDE\", \"amountOverride\": 80, \"reason\": \"Mês promocional\"}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/memberships/{id}/exceptions/{periodStart}": {
      "delete": {
        "operationId": "MembershipsPublicController_removeException",
        "summary": "Remove a exceção de um ciclo",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          },
          {
            "name": "periodStart",
            "required": true,
            "in": "path",
            "description": "Vencimento do ciclo, AAAA-MM-DD.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerName": {
                      "type": "string"
                    },
                    "customerEmail": {
                      "nullable": true
                    },
                    "customerPhone": {
                      "nullable": true
                    },
                    "planId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "planName": {
                      "type": "string"
                    },
                    "billingInterval": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "startDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "billingDay": {
                      "type": "integer"
                    },
                    "price": {
                      "type": "integer"
                    },
                    "trialEndsAt": {
                      "nullable": true
                    },
                    "pausedUntil": {
                      "nullable": true
                    },
                    "endDate": {
                      "nullable": true
                    },
                    "cancelAtPeriodEnd": {
                      "type": "boolean"
                    },
                    "canceledAt": {
                      "nullable": true
                    },
                    "cancelReason": {
                      "nullable": true
                    },
                    "pendingPlanId": {
                      "nullable": true
                    },
                    "pendingPrice": {
                      "nullable": true
                    },
                    "discountType": {
                      "nullable": true
                    },
                    "discountValue": {
                      "nullable": true
                    },
                    "discountCycles": {
                      "nullable": true
                    },
                    "discountCyclesUsed": {
                      "type": "integer"
                    },
                    "suspendedAt": {
                      "nullable": true
                    },
                    "suspendedManually": {
                      "type": "boolean"
                    },
                    "notes": {
                      "nullable": true
                    },
                    "paymentProvider": {
                      "nullable": true
                    },
                    "externalId": {
                      "nullable": true
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "graceDays": {
                      "type": "integer"
                    },
                    "pendingPlanName": {
                      "nullable": true
                    },
                    "pendingBillingInterval": {
                      "nullable": true
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "nextSkipped": {
                      "type": "boolean"
                    },
                    "mrr": {
                      "type": "integer"
                    },
                    "netPrice": {
                      "type": "integer"
                    },
                    "discountActive": {
                      "type": "boolean"
                    },
                    "discountCyclesLeft": {
                      "nullable": true
                    },
                    "nextBilledAt": {
                      "type": "string",
                      "format": "date"
                    },
                    "charges": {
                      "type": "array",
                      "items": {}
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "type": {
                            "type": "string"
                          },
                          "mrrDelta": {
                            "type": "integer"
                          },
                          "fromPlanId": {
                            "nullable": true
                          },
                          "toPlanId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "fromPrice": {
                            "nullable": true
                          },
                          "toPrice": {
                            "type": "integer"
                          },
                          "reason": {
                            "nullable": true
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string"
                              },
                              "trialDays": {
                                "type": "integer"
                              },
                              "firstDueDate": {
                                "type": "string",
                                "format": "date"
                              }
                            }
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "exceptions": {
                      "type": "array",
                      "items": {}
                    },
                    "nextCharge": {
                      "type": "object",
                      "properties": {
                        "dueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "skipped": {
                          "type": "boolean"
                        },
                        "bruto": {
                          "type": "integer"
                        },
                        "desconto": {
                          "type": "integer"
                        },
                        "liquido": {
                          "type": "integer"
                        },
                        "adesao": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "descontoConsumido": {
                          "type": "boolean"
                        }
                      }
                    },
                    "upcomingDueDates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    }
                  }
                },
                "example": {
                  "id": "e7ba820d-5cec-4d94-8c90-c05a6f919258",
                  "customerId": "ed1d5590-290d-4dee-8ec8-ab471b0b16f6",
                  "customerName": "Marcos Teixeira",
                  "customerEmail": null,
                  "customerPhone": null,
                  "planId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                  "planName": "Plano mensal",
                  "billingInterval": "MONTHLY",
                  "status": "ACTIVE",
                  "startDate": "2026-11-23",
                  "nextRunAt": "2026-11-23",
                  "billingDay": 23,
                  "price": 100,
                  "trialEndsAt": null,
                  "pausedUntil": null,
                  "endDate": null,
                  "cancelAtPeriodEnd": false,
                  "canceledAt": null,
                  "cancelReason": null,
                  "pendingPlanId": null,
                  "pendingPrice": null,
                  "discountType": null,
                  "discountValue": null,
                  "discountCycles": null,
                  "discountCyclesUsed": 0,
                  "suspendedAt": null,
                  "suspendedManually": false,
                  "notes": null,
                  "paymentProvider": null,
                  "externalId": null,
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "graceDays": 0,
                  "pendingPlanName": null,
                  "pendingBillingInterval": null,
                  "overdue": false,
                  "nextSkipped": false,
                  "mrr": 100,
                  "netPrice": 100,
                  "discountActive": false,
                  "discountCyclesLeft": null,
                  "nextBilledAt": "2026-11-23",
                  "charges": [],
                  "events": [
                    {
                      "id": "4874abaa-13e5-4443-8634-322212cda8a2",
                      "type": "CREATED",
                      "mrrDelta": 100,
                      "fromPlanId": null,
                      "toPlanId": "b0ae4792-9cd9-4e61-8f8f-20e45a68a597",
                      "fromPrice": null,
                      "toPrice": 100,
                      "reason": null,
                      "detail": {
                        "status": "ACTIVE",
                        "trialDays": 0,
                        "firstDueDate": "2026-11-23"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    },
                    {
                      "id": "bc2eb093-b140-4a8a-86a4-aa43e3352097",
                      "type": "CYCLE_EXCEPTION_REMOVED",
                      "mrrDelta": 0,
                      "fromPlanId": null,
                      "toPlanId": null,
                      "fromPrice": null,
                      "toPrice": null,
                      "reason": null,
                      "detail": {
                        "periodStart": "2026-11-23"
                      },
                      "userId": "5284f4d8-db6e-4f91-8112-5456652a8e83",
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ],
                  "exceptions": [],
                  "nextCharge": {
                    "dueDate": "2026-11-23",
                    "skipped": false,
                    "bruto": 100,
                    "desconto": 0,
                    "liquido": 100,
                    "adesao": 0,
                    "total": 100,
                    "descontoConsumido": false
                  },
                  "upcomingDueDates": [
                    "2026-11-23",
                    "2026-12-23"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Assinaturas"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Remove a exceção de um ciclo. Sem exceção naquele vencimento é `404`.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X DELETE https://api.nivro.app/api/v1/memberships/MEMBERSHIP_ID/exceptions/2026-12-10 \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/webhooks": {
      "post": {
        "operationId": "WebhooksPublicController_create",
        "summary": "Cadastra um webhook e devolve o segredo de assinatura, uma única vez",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookDto"
              },
              "example": {
                "url": "https://exemplo.com.br/nivro/eventos",
                "events": [
                  "membership.created",
                  "charge.paid"
                ],
                "description": "ERP da academia"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "url": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "description": {
                      "type": "string"
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "consecutiveFailures": {
                      "type": "integer"
                    },
                    "disabledReason": {
                      "nullable": true
                    },
                    "secretPrefix": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "secret": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "b3960424-02ca-4de2-8307-607a5190125c",
                  "url": "https://exemplo.com.br/nivro/eventos",
                  "events": [
                    "charge.paid",
                    "membership.created"
                  ],
                  "description": "ERP da academia",
                  "active": true,
                  "consecutiveFailures": 0,
                  "disabledReason": null,
                  "secretPrefix": "whsec_4f9c...",
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "secret": "whsec_4f9c2a7e4f9c2a7e4f9c2a7e4f9c2a7e4f9c2a7e4f9c2a7e4f9c2a7e4f9c2a7e"
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Cadastra um webhook. Devolve o `secret` (`whsec_...`) UMA vez: guarde-o, ele não aparece de novo. `events` vazio ou omitido recebe todos os tipos; um tipo fora da lista dá `400` com a lista válida. A URL precisa ser `https://` e pública (`400` com `code` explicando o motivo se não for). Limite de 10 webhooks por empresa (`409` com `webhook_limit_reached`).\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/webhooks \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"url\": \"https://exemplo.com.br/nivro/eventos\", \"events\": [\"membership.created\", \"charge.paid\"], \"description\": \"ERP da academia\"}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      },
      "get": {
        "operationId": "WebhooksPublicController_findAll",
        "summary": "Lista os webhooks cadastrados",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "url": {
                            "type": "string"
                          },
                          "events": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "description": {
                            "type": "string"
                          },
                          "active": {
                            "type": "boolean"
                          },
                          "consecutiveFailures": {
                            "type": "integer"
                          },
                          "disabledReason": {
                            "nullable": true
                          },
                          "secretPrefix": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "items": [
                    {
                      "id": "b3960424-02ca-4de2-8307-607a5190125c",
                      "url": "https://exemplo.com.br/nivro/eventos",
                      "events": [
                        "charge.paid",
                        "membership.created"
                      ],
                      "description": "ERP da academia",
                      "active": true,
                      "consecutiveFailures": 0,
                      "disabledReason": null,
                      "secretPrefix": "whsec_4f9c...",
                      "createdAt": "2026-11-12T14:30:00.000Z",
                      "updatedAt": "2026-11-12T14:30:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Lista os webhooks da empresa. O segredo nunca aparece; só o `secretPrefix`.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X GET https://api.nivro.app/api/v1/webhooks \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/webhooks/{id}": {
      "get": {
        "operationId": "WebhooksPublicController_findOne",
        "summary": "Busca um webhook por id",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "url": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "description": {
                      "type": "string"
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "consecutiveFailures": {
                      "type": "integer"
                    },
                    "disabledReason": {
                      "nullable": true
                    },
                    "secretPrefix": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                },
                "example": {
                  "id": "b3960424-02ca-4de2-8307-607a5190125c",
                  "url": "https://exemplo.com.br/nivro/eventos",
                  "events": [
                    "charge.paid",
                    "membership.created"
                  ],
                  "description": "ERP da academia",
                  "active": true,
                  "consecutiveFailures": 0,
                  "disabledReason": null,
                  "secretPrefix": "whsec_4f9c...",
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Busca um webhook por id, com a situação (`active`), as falhas seguidas e, se foi desligado, o motivo.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X GET https://api.nivro.app/api/v1/webhooks/WEBHOOK_ID \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      },
      "patch": {
        "operationId": "WebhooksPublicController_update",
        "summary": "Altera a URL, os eventos, a descrição ou liga e desliga o webhook",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookDto"
              },
              "example": {
                "events": [
                  "membership.canceled",
                  "membership.past_due"
                ],
                "active": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "url": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "description": {
                      "type": "string"
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "consecutiveFailures": {
                      "type": "integer"
                    },
                    "disabledReason": {
                      "nullable": true
                    },
                    "secretPrefix": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                },
                "example": {
                  "id": "b3960424-02ca-4de2-8307-607a5190125c",
                  "url": "https://exemplo.com.br/nivro/eventos",
                  "events": [
                    "membership.canceled",
                    "membership.past_due"
                  ],
                  "description": "ERP da academia",
                  "active": true,
                  "consecutiveFailures": 0,
                  "disabledReason": null,
                  "secretPrefix": "whsec_4f9c...",
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Altera a URL, os tipos de evento, a descrição ou liga e desliga o webhook. Mandar `active: true` em um webhook desligado o reativa e zera a contagem de falhas seguidas. A URL nova passa pela mesma conferência do cadastro.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X PATCH https://api.nivro.app/api/v1/webhooks/WEBHOOK_ID \\\n  -H \"Authorization: Bearer nv_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"events\": [\"membership.canceled\", \"membership.past_due\"], \"active\": true}'"
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      },
      "delete": {
        "operationId": "WebhooksPublicController_remove",
        "summary": "Apaga o webhook e o histórico de entregas dele",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "deleted": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "id": "b3960424-02ca-4de2-8307-607a5190125c",
                  "deleted": true
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Apaga o webhook e o histórico de entregas dele. As entregas ainda na fila deixam de sair.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X DELETE https://api.nivro.app/api/v1/webhooks/WEBHOOK_ID \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/webhooks/{id}/rotate-secret": {
      "post": {
        "operationId": "WebhooksPublicController_rotateSecret",
        "summary": "Troca o segredo de assinatura e devolve o novo, uma única vez",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "url": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "description": {
                      "type": "string"
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "consecutiveFailures": {
                      "type": "integer"
                    },
                    "disabledReason": {
                      "nullable": true
                    },
                    "secretPrefix": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "secret": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "b3960424-02ca-4de2-8307-607a5190125c",
                  "url": "https://exemplo.com.br/nivro/eventos",
                  "events": [
                    "membership.canceled",
                    "membership.past_due"
                  ],
                  "description": "ERP da academia",
                  "active": true,
                  "consecutiveFailures": 0,
                  "disabledReason": null,
                  "secretPrefix": "whsec_4f9c...",
                  "createdAt": "2026-11-12T14:30:00.000Z",
                  "updatedAt": "2026-11-12T14:30:00.000Z",
                  "secret": "whsec_4f9c2a7e4f9c2a7e4f9c2a7e4f9c2a7e4f9c2a7e4f9c2a7e4f9c2a7e4f9c2a7e"
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Gira o segredo de assinatura e devolve o novo, uma única vez. O segredo antigo deixa de valer na hora: atualize o receptor antes, ou aceite os dois por um tempo.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/webhooks/WEBHOOK_ID/rotate-secret \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/webhooks/{id}/test": {
      "post": {
        "operationId": "WebhooksPublicController_test",
        "summary": "Envia um evento de teste (ping) para o webhook",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deliveryId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "eventId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "status": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "deliveryId": "ca90d73b-d488-47b3-8676-c0be2e67d88b",
                  "eventId": "63c37205-e21e-4e9c-8dfa-da52578aab77",
                  "status": "PENDING"
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Coloca um evento `ping` na fila para este webhook (mesmo que ele não esteja inscrito em `ping`) e devolve o id da entrega, para acompanhar em `GET /v1/webhooks/:id/deliveries`. Webhook desligado dá `409`.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/webhooks/WEBHOOK_ID/test \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/webhooks/{id}/deliveries": {
      "get": {
        "operationId": "WebhooksPublicController_deliveries",
        "summary": "Log recente das entregas do webhook, da mais nova para a mais antiga",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "description": "Só as entregas nesta situação.",
            "schema": {
              "enum": [
                "PENDING",
                "DELIVERED",
                "FAILED"
              ],
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Quantas entregas devolver (padrão 50, máximo 100).",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "eventId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "eventType": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "attempts": {
                            "type": "integer"
                          },
                          "nextAttemptAt": {
                            "nullable": true
                          },
                          "lastStatusCode": {
                            "type": "integer"
                          },
                          "lastError": {
                            "type": "string"
                          },
                          "deliveredAt": {
                            "nullable": true
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "items": [
                    {
                      "id": "ca90d73b-d488-47b3-8676-c0be2e67d88b",
                      "eventId": "63c37205-e21e-4e9c-8dfa-da52578aab77",
                      "eventType": "ping",
                      "status": "FAILED",
                      "attempts": 8,
                      "nextAttemptAt": null,
                      "lastStatusCode": 500,
                      "lastError": "HTTP 500: Internal Server Error",
                      "deliveredAt": null,
                      "createdAt": "2026-11-12T14:30:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Log recente de entregas do webhook, da mais nova para a mais antiga: tipo do evento, situação (`PENDING`, `DELIVERED` ou `FAILED`), tentativas, código da última resposta e o motivo da última falha. Não traz o corpo enviado. `status` filtra por situação e `limit` vai de 1 a 100 (padrão 50).\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl \"https://api.nivro.app/api/v1/webhooks/WEBHOOK_ID/deliveries?status=FAILED&limit=20\" \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/webhooks/{id}/deliveries/{deliveryId}/retry": {
      "post": {
        "operationId": "WebhooksPublicController_retry",
        "summary": "Recoloca na fila uma entrega que falhou",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            },
            "description": "Id do recurso (UUID)."
          },
          {
            "name": "deliveryId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "status": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "ca90d73b-d488-47b3-8676-c0be2e67d88b",
                  "status": "PENDING"
                }
              }
            }
          },
          "400": {
            "description": "Parâmetro ou corpo inválido. A mensagem diz qual campo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BAD_REQUEST",
                  "code": "BAD_REQUEST",
                  "message": "take inválido: o máximo é 200."
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "404": {
            "description": "Não encontrado, ou de outra empresa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "NOT_FOUND",
                  "code": "NOT_FOUND",
                  "message": "Order 16db273e-10da-449d-8124-331bfd7d1def not found"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Recoloca na fila uma entrega que falhou (`FAILED`), com a contagem de tentativas zerada. Entrega que não falhou, ou webhook desligado, dá `409`.\n\n**Papel mínimo do token:** Gerente.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST https://api.nivro.app/api/v1/webhooks/WEBHOOK_ID/deliveries/DELIVERY_ID/retry \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ],
        "x-papeis": [
          "Gerente",
          "Proprietário"
        ]
      }
    },
    "/v1/me": {
      "get": {
        "operationId": "MePublicController_me",
        "summary": "Confere o token e devolve a empresa conectada, o papel e a identidade do token",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Sucesso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "tenant": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "token": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "tenant": {
                    "id": "c97d2f13-39f7-4123-8457-6e47a4da5caf",
                    "name": "Loja Exemplo"
                  },
                  "token": {
                    "id": "33fd6607-be6b-458c-8408-9f1061ec6cbe",
                    "name": "exemplos-OWNER",
                    "role": "OWNER"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Token ausente, inválido, revogado ou expirado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "UNAUTHORIZED",
                  "code": "UNAUTHORIZED",
                  "message": "Invalid API token"
                }
              }
            }
          },
          "403": {
            "description": "O papel do token não permite esta ação, ou o plano ou o módulo da empresa não inclui o recurso.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "FORBIDDEN",
                  "code": "FORBIDDEN",
                  "message": "Insufficient permissions. Required action: CUSTOMER_CREATE"
                }
              }
            }
          },
          "429": {
            "description": "Passou de 500 requisições por minuto na empresa. Espere até o horário de `X-RateLimit-Reset`."
          }
        },
        "tags": [
          "Conta e token"
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "description": "Confirma que o token é válido e devolve a empresa conectada, o nome do token e o papel dele. Não exige nenhuma permissão de negócio específica.\n\n**Quem pode chamar:** qualquer token.",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl https://api.nivro.app/api/v1/me \\\n  -H \"Authorization: Bearer nv_...\""
          }
        ]
      }
    }
  },
  "info": {
    "title": "API do Nivro",
    "description": "API pública do Nivro, para integrar a loja a outros sistemas. Faz parte do plano Profissional, inclusive nos 30 dias de teste.\n\n**Autenticação.** O proprietário gera um token em Ajustes, Usuários e acessos, API e tokens. Ele aparece uma vez só. Envie em toda requisição: `Authorization: Bearer nv_...`.\n\n**Papéis.** O token tem o papel de quem o criou (Visualizador, Operador, Gerente ou Proprietário) e vale o mesmo que na tela: o que o papel não vê na tela, a API também não entrega.\n\n**Limites.** 500 requisições por minuto por empresa (todos os tokens somam); acima disso a resposta é `429` com `X-RateLimit-Reset`. Listas têm teto de 200 por página, e períodos de datas vão até 366 dias.",
    "version": "1.0",
    "contact": {}
  },
  "tags": [
    {
      "name": "Conta e token",
      "description": "Confirma que o token funciona, sem criar nada no sistema.\n\nÉ o primeiro endpoint que qualquer integrador chama, porque é o único que responde \"meu token funciona?\" sem criar nada no sistema de ninguém.",
      "x-linha": "Confirma que o token funciona, sem criar nada no sistema."
    },
    {
      "name": "Clientes",
      "description": "Criar, listar e buscar clientes.",
      "x-linha": "Criar, listar e buscar clientes."
    },
    {
      "name": "Produtos",
      "description": "Produtos e serviços: criar, atualizar, listar e ver as variações da grade.\n\n- **type** é o único enum real neste payload. Aceita apenas `PRODUCT` ou `SERVICE` (padrão `PRODUCT` se omitido). Serviços são tratados como um produto sem controle de estoque.\n- **unit** não é um enum, é texto livre (ex.: `\"UN\"`, `\"KG\"`, `\"L\"`) de até 10 caracteres, não validado contra uma lista fixa.\n- **sku** é único na conta sem diferenciar maiúsculas de minúsculas: `ref-2l` e `REF-2L` são o mesmo SKU, e repetir dá `400`.\n- **categoryId** precisa ser uma categoria da conta (senão `400`). **photoUrl** precisa ser uma URL `https` pública. **name** vai até 200 caracteres.\n- Trocar `type` de `PRODUCT` para `SERVICE` com saldo em estoque dá `409`: zere o estoque antes.\n- Token de Operador recebe o produto sem `cost` e `avgCost`.\n- **price** e **cost** são sempre string numérica decimal positiva (ex.: `\"8.90\"`), nunca negativa e nunca zero para `price`.",
      "x-linha": "Produtos e serviços: criar, atualizar, listar e ver as variações da grade."
    },
    {
      "name": "Pedidos",
      "description": "Do rascunho ao faturamento: separar, mudar o status, ver a prévia, faturar e cancelar.\n\nOs pedidos fazem parte do plano Profissional. O pedido passa por rascunho, confirmado, agendado, separado, despachado e entregue, e termina em faturado (`CONVERTED`) ou cancelado (`CANCELLED`). Faturar é o \"dar baixa\" do dia a dia: cria a venda a partir do pedido.\n\n- **Faturar cobra só o que foi separado.** Se a separação foi registrada, a venda sai com as quantidades separadas; sem separação registrada, fatura tudo. A prévia mostra o resultado antes de gravar, e a resposta do faturar traz as faltas.\n- **Faturar emite nota se a conta usa emissão automática**, igual à tela: a nota entra na fila depois da venda gravada.\n- **Faturar acima do limite a prazo do cliente** só passa com `acknowledgeCreditLimit: true` e token de Gerente ou Proprietário. Em token de Operador o campo é ignorado e a API recusa com o aviso do limite.\n- **Produto com IMEI ou série** precisa de `serials` (id da linha do pedido para o IMEI) quando a série não foi gravada na linha.\n- **items[].unitPrice** aceita número ou string numérica. O `POST` devolve o pedido completo, com itens e totais.\n- Na separação, `pickedQty` não pode passar da quantidade do item. No faturar, `channel` é `OTHER` se omitido.",
      "x-linha": "Do rascunho ao faturamento: separar, mudar o status, ver a prévia, faturar e cancelar."
    },
    {
      "name": "Vendas",
      "description": "Criar, listar, abrir e cancelar vendas.\n\nSem `sellerId`, a venda fica com quem criou o token. Para atribuir a outro vendedor, mande o `sellerId` dele: precisa ser um usuário ativo da conta, senão a resposta é `400`.\n\n- **occurredAt** (data da venda) é opcional e não pode estar mais de 1 dia no futuro.\n- **Grade e IMEI:** em produto com variação (tamanho, cor), mande `items[].variantId`, senão a baixa cai na variação padrão. Em produto com número de série, mande `items[].unitSerial`; sem `unitPrice`, vale o preço da unidade.\n- **Idempotency-Key:** mande este header com uma chave sua em `POST /v1/sales` e repetir a chamada (timeout, retry) devolve a mesma venda em vez de criar outra. A chave vale por conta. Reusar a chave com um corpo diferente dá `422`.\n- **Limite a prazo:** a venda a prazo que passa do limite do cliente é recusada. `acknowledgeCreditLimit: true` só vale com token de Gerente ou Proprietário.\n- **Operador não vê o custo:** em `GET /v1/sales/:id`, token de Operador recebe a venda sem o custo da linha e sem a comissão de outros vendedores, como na tela.\n- **channel** aceita: `POS`, `ONLINE`, `WHATSAPP`, `PHONE`, `OTHER` (padrão `OTHER` se omitido).\n- **payments[].method** aceita: `PIX`, `CASH`, `CARD`, `CREDIT_CARD`, `DEBIT_CARD`, `BANK_TRANSFER`, `CHECK`, `FIADO`, `OTHER`. Um valor fora dessa lista é rejeitado no momento de salvar.\n- **Atenção ao formato dos valores:** `items[].unitPrice` é sempre **string** (ex.: `\"49.90\"`), enquanto `payments[].amount` e `receivables[].amount` são **number** puro (ex.: `49.90`). Não é um erro, apenas um detalhe fácil de deixar passar ao montar o payload.\n- **items[].product.type** em `GET /v1/sales/:id` indica se o item vendido é `PRODUCT` ou `SERVICE`, útil para não tentar repor estoque de um item de serviço, por exemplo.",
      "x-linha": "Criar, listar, abrir e cancelar vendas."
    },
    {
      "name": "Contas a receber",
      "description": "Parcelas a prazo, só leitura; a baixa é feita dentro do Nivro.\n\nParcelas a prazo, só leitura. A baixa de parcela é feita dentro do Nivro.",
      "x-linha": "Parcelas a prazo, só leitura; a baixa é feita dentro do Nivro."
    },
    {
      "name": "Assinaturas",
      "description": "Mensalidades: planos, assinaturas, cobranças de cada ciclo; criar, pausar, retomar, suspender, reativar, trocar de plano, cancelar, manter, dar desconto, reajustar, editar, isentar ciclo e dar baixa.\n\nExige o módulo Assinaturas ligado; sem ele a rota fica só leitura. Operador lê a situação e não vê preço negociado, desconto nem histórico; criar, pausar, retomar, suspender, reativar, trocar de plano, cancelar, manter, dar desconto, reajustar, editar e isentar ciclo são de Gerente em diante, e a baixa segue a baixa de parcela (Operador em diante). Visualizador não lê. Os relatórios de MRR e churn ficam dentro do Nivro.\n\n- **Dar baixa em um ciclo:** leia a assinatura (`GET /v1/memberships/:id`) ou as cobranças (`GET /v1/memberships/charges`), pegue o `receivableId` do ciclo e mande em `POST /v1/memberships/:id/receive`. A baixa é sempre pelo valor integral da parcela; o Nivro não aceita pagamento parcial por aqui.\n- **Idempotency-Key:** mande este header com uma chave sua em `POST /v1/memberships` e em `POST /v1/memberships/:id/receive`. Repetir a chamada (timeout, retry) devolve o mesmo resultado, com o header `Idempotent-Replayed: true`, em vez de assinar duas vezes ou dar baixa duas vezes. A chave vale por conta. Reusar a chave com um corpo diferente dá `422`. Sem a chave, repetir uma baixa já feita devolve `409` (`receivable_not_open`), sem pagar de novo.\n- **Baixa em lote:** `receivableIds` aceita até 60 parcelas da mesma assinatura. Cada baixa é gravada à parte: se uma falha, as outras ficam pagas e a resposta traz `ok: false` e a lista `failed`. Para tentar só as que falharam, mande uma chave nova com os ids que sobraram.\n- **method** da baixa aceita: `CASH`, `PIX`, `CARD`, `CREDIT_CARD`, `DEBIT_CARD`, `BANK_TRANSFER`, `BOLETO`, `CHECK`, `OTHER`. `paidAt` (AAAA-MM-DD ou data e hora) é opcional e vale agora se omitido.\n- **Pausar x suspender:** pausar é combinado com o cliente (`until` opcional, `resume` volta). Suspender é decisão de quem vende, por exemplo por atraso: a assinatura sai do MRR e só volta com `reactivate`, sem cobrar os vencimentos que passaram.\n- **Trocar de plano** (`change-plan`) vale a partir do próximo ciclo: nada muda na cobrança que já foi gerada. Mandar o plano atual desfaz a troca agendada. `price` negocia um valor no plano novo; sem ele vale o preço do plano.\n- **Desconto:** `POST /v1/memberships/:id/discount` aplica um desconto no estilo cupom, `PERCENT` (até 100) ou `AMOUNT`, por `cycles` ciclos ou para sempre se omitido; aplicar outro substitui o atual. 100% zera o ciclo: não há cobrança, mas o ciclo conta para `cycles`. O desconto não altera um ciclo que já foi cobrado e não vale sobre a taxa de adesão. `DELETE /v1/memberships/:id/discount` remove (`409` se não há desconto). Também dá para já criar a assinatura com desconto.\n- **Reajustar e editar:** `POST /v1/memberships/:id/reprice` muda o preço negociado a partir do próximo ciclo a gerar (o mesmo preço atual é `400`). `PATCH /v1/memberships/:id` altera `endDate` (AAAA-MM-DD, depois do início; `null` tira o término) e `notes`; só o que for enviado muda. Nenhum dos dois altera um ciclo já cobrado.\n- **Exceção de ciclo:** `POST /v1/memberships/:id/exceptions` com `periodStart` (um vencimento FUTURO da assinatura) e `type`: `SKIP` isenta o mês (não gera cobrança nem gasta desconto) ou `OVERRIDE` cobra `amountOverride` naquele mês, valor final. Ciclo já cobrado é `409` (`cycle_already_charged`); data que não é vencimento é `400` (`not_a_due_date`). `DELETE /v1/memberships/:id/exceptions/:periodStart` remove.\n- **Cancelar e manter:** `cancel` com `atPeriodEnd: true` só agenda o fim; `keep` desfaz esse agendamento. O cancelamento imediato não se desfaz: crie outra assinatura.\n- **Módulo Contas a receber:** a baixa exige o módulo ligado; sem ele a resposta é `403` com `code: module_disabled`.",
      "x-linha": "Mensalidades: planos, assinaturas, cobranças de cada ciclo; criar, pausar, retomar, suspender, reativar, trocar de plano, cancelar, manter, dar desconto, reajustar, editar, isentar ciclo e dar baixa."
    },
    {
      "name": "Webhooks",
      "description": "Receba por POST assinado os eventos das assinaturas, sem consultar a API: cadastrar, testar, girar o segredo e acompanhar as entregas.\n\nEm vez de consultar a API de tempos em tempos, cadastre uma URL e o Nivro envia um `POST` assinado a cada evento de assinatura. Exige o papel Gerente ou Proprietário no token. A URL precisa ser `https://`, pública e na porta 443 ou 8443; endereços internos (rede privada, `localhost`, metadado da nuvem) e URLs com usuário e senha são recusados, no cadastro e a cada entrega.\n\n**Como verificar a assinatura.** Cada entrega traz `Nivro-Timestamp` (segundos Unix) e `Nivro-Signature: v1=<hex>`, o HMAC-SHA256 de `\"<timestamp>.<corpo>\"` com o seu segredo (`whsec_...`, devolvido uma única vez ao cadastrar). Confira sobre o corpo CRU, antes de qualquer `JSON.parse`, e recuse entregas com `Nivro-Timestamp` de mais de 5 minutos atrás.\n\nNode.js:\n\n```js\nconst crypto = require('crypto')\n\nfunction confere(segredo, headers, corpoCru) {\n  const esperado = 'v1=' + crypto.createHmac('sha256', segredo).update(headers['nivro-timestamp'] + '.' + corpoCru).digest('hex')\n  const a = Buffer.from(esperado)\n  const b = Buffer.from(headers['nivro-signature'] || '')\n  const recente = Math.abs(Date.now() / 1000 - Number(headers['nivro-timestamp'])) < 300\n  return recente && a.length === b.length && crypto.timingSafeEqual(a, b)\n}\n```\n\nPython:\n\n```python\nimport hmac, hashlib, time\n\ndef confere(segredo, headers, corpo_cru):\n    msg = headers['Nivro-Timestamp'].encode() + b'.' + corpo_cru\n    esperado = 'v1=' + hmac.new(segredo.encode(), msg, hashlib.sha256).hexdigest()\n    recente = abs(time.time() - int(headers['Nivro-Timestamp'])) < 300\n    return recente and hmac.compare_digest(esperado, headers['Nivro-Signature'])\n```\n\nResponda com qualquer `2xx` em até 10 segundos. Qualquer outra resposta (inclusive redirecionamento, que o Nivro não segue) conta como falha e a entrega é repetida.\n\n- **Cabeçalhos de cada entrega:** `Content-Type: application/json`, `User-Agent: Nivro-Webhooks/1`, `Nivro-Event` (o tipo), `Nivro-Delivery` (id desta entrega), `Nivro-Timestamp` e `Nivro-Signature`.\n- **Corpo:** `{ \"id\": \"<id do evento>\", \"type\": \"membership.paused\", \"createdAt\": \"2026-11-12T13:00:00.000Z\", \"data\": { \"membership\": { ... } } }`. Os eventos de cobrança trazem também `data.charge` (`id`, `cycleNo`, `dueDate`, `amount`, `situation`, `receivableId`). `data.membership` traz `id`, `customerId`, `planId`, `status`, `price`, `billingInterval`, `startDate`, `nextChargeDate`, `trialEndsAt`, `pausedUntil`, `endDate`, `cancelAtPeriodEnd` e `createdAt`. Não leva dado interno do Nivro.\n- **Entrega pelo menos uma vez.** Uma entrega pode chegar mais de uma vez (a sua resposta se perdeu, o servidor reiniciou) e a ordem entre eventos não é garantida. Deduplique pelo campo `id` do corpo, que é o mesmo em toda repetição, e ordene por `createdAt`.\n- **Tentativas.** Se a resposta não for `2xx`, o Nivro tenta de novo depois de 1 minuto, 5 minutos, 30 minutos, 2 horas, 6 horas, 12 horas e 24 horas. A 8ª falha encerra a entrega (`FAILED`); reenvie à mão em `POST /v1/webhooks/:id/deliveries/:deliveryId/retry`.\n- **Desligamento automático.** Depois de 50 falhas seguidas o webhook é desativado (`active: false`, com o motivo em `disabledReason`) e para de receber eventos novos. Corrija o endereço e reative com `PATCH /v1/webhooks/:id` e `active: true`. Uma entrega com sucesso zera a contagem.\n- **Eventos.** `membership.created`, `membership.paused`, `membership.resumed`, `membership.suspended`, `membership.reactivated`, `membership.plan_changed`, `membership.canceled`, `membership.past_due`, `charge.created`, `charge.paid` e `ping`. Sem `events` no cadastro, o webhook recebe todos.\n- **Quando cada evento sai.** `membership.plan_changed` sai quando a troca é APLICADA (no primeiro ciclo do plano novo), não quando é agendada. `membership.canceled` sai no cancelamento imediato, no fim do período agendado e quando o contrato chega à data de término (neste caso com `status: ENDED`). `membership.reactivated` sai ao reativar uma assinatura suspensa e quando quitar a dívida tira a assinatura de inadimplente. `charge.created` sai quando o ciclo vira cobrança a prazo; `charge.paid` sai uma vez por parcela, quando ela fica quitada (e de novo se a baixa for estornada e a parcela paga outra vez). Se o Nivro cair no meio da baixa, o evento é recuperado em até alguns minutos, sem duplicar. `ping` só sai por `POST /v1/webhooks/:id/test`.\n- **Segredo.** `secret` aparece só ao cadastrar e ao girar (`rotate-secret`); nas leituras vem só `secretPrefix`. Ao girar, o segredo antigo deixa de valer na hora, inclusive para entregas já na fila.\n- **Limites.** Até 10 webhooks por empresa. O log de entregas guarda 30 dias e não traz o corpo enviado, só situação, tentativas, código de resposta e o motivo da última falha.",
      "x-linha": "Receba por POST assinado os eventos das assinaturas, sem consultar a API: cadastrar, testar, girar o segredo e acompanhar as entregas."
    },
    {
      "name": "Financeiro",
      "description": "Lançamentos e resumo do fluxo de caixa.",
      "x-linha": "Lançamentos e resumo do fluxo de caixa."
    },
    {
      "name": "Relatórios",
      "description": "Resumo diário e comparação de vendas, de Gerente em diante.",
      "x-linha": "Resumo diário e comparação de vendas, de Gerente em diante."
    }
  ],
  "servers": [
    {
      "url": "https://api.nivro.app/api",
      "description": "Produção"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "type": "http",
        "description": "Token de API, no formato `nv_...`."
      }
    },
    "schemas": {
      "CreateCustomerDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "customerType": {
            "type": "string",
            "enum": [
              "PF",
              "PJ"
            ]
          },
          "firstName": {
            "type": "string",
            "maxLength": 200
          },
          "lastName": {
            "type": "string",
            "maxLength": 200
          },
          "nameOfficial": {
            "type": "string",
            "maxLength": 200
          },
          "nameDisplay": {
            "type": "string",
            "maxLength": 200
          },
          "stateRegistration": {
            "type": "string"
          },
          "municipalRegistration": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "doc": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "street": {
            "type": "string"
          },
          "number": {
            "type": "string"
          },
          "complement": {
            "type": "string"
          },
          "district": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "postalCode": {
            "type": "string"
          },
          "cityIbgeCode": {
            "type": "string",
            "description": "Código IBGE do município, 7 dígitos."
          },
          "country": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "birthDate": {
            "type": "string"
          },
          "creditLimitCents": {
            "type": "number",
            "description": "Limite de crédito para venda a prazo, em centavos. Ausente/NULL = sem limite (comportamento de hoje). 0 = bloqueia qualquer venda a prazo.",
            "minimum": 0
          },
          "preferences": {
            "type": "object",
            "description": "Preferências estruturadas do cliente (tamanho, sabor, restrições etc.). Shape livre de propósito — ver comentário do campo no schema."
          }
        }
      },
      "ProductGridAxisDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "nome": {
            "type": "string"
          },
          "values": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "valores": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "InitialStockCellDto": {
        "type": "object",
        "properties": {
          "attributes": {
            "type": "object"
          },
          "name": {
            "type": "string"
          },
          "quantity": {
            "type": "number",
            "minimum": 0
          },
          "unitCost": {
            "type": "number",
            "minimum": 0,
            "maximum": 99999999
          }
        },
        "required": [
          "quantity"
        ]
      },
      "CreateProductDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "type": {
            "type": "string",
            "default": "PRODUCT",
            "enum": [
              "PRODUCT",
              "SERVICE"
            ]
          },
          "sku": {
            "type": "string"
          },
          "brand": {
            "type": "string",
            "description": "Marca do produto. Texto livre, independente da categoria e do fornecedor.",
            "maxLength": 80
          },
          "price": {
            "type": "string",
            "description": "Preço de venda, como texto numérico sem sinal de menos (\"49.90\"). Obrigatório para o que se vende; item só de insumo (`hiddenFromSales: true`) pode vir sem preço.",
            "pattern": "^\\d*\\.?\\d+$"
          },
          "hiddenFromSales": {
            "type": "boolean",
            "description": "Item só de insumo: não aparece no PDV nem no catálogo."
          },
          "rentable": {
            "type": "boolean",
            "description": "Produto locável (módulo Locação), com preço por período. Exige `rentPrice` e `rentUnit`; serviço e produto controlado por série não podem ser locáveis."
          },
          "rentPrice": {
            "type": "string",
            "pattern": "^\\d*\\.?\\d+$"
          },
          "rentUnit": {
            "type": "string",
            "enum": [
              "DAY",
              "WEEK",
              "MONTH",
              "EVENT"
            ]
          },
          "rentMinPeriods": {
            "type": "number",
            "minimum": 1
          },
          "replacementPrice": {
            "type": "string",
            "pattern": "^\\d*\\.?\\d+$"
          },
          "cost": {
            "type": "string",
            "pattern": "^\\d*\\.?\\d+$"
          },
          "promotionalPrice": {
            "type": "string",
            "nullable": true,
            "description": "Preço promocional (\"de/por\"), com início e fim opcionais. Vale para todas as variações da grade. Tem de ser menor que o preço normal, e o fim depois do início.",
            "pattern": "^\\d*\\.?\\d+$"
          },
          "promotionStartsAt": {
            "type": "string",
            "nullable": true
          },
          "promotionEndsAt": {
            "type": "string",
            "nullable": true
          },
          "unit": {
            "type": "string",
            "maxLength": 10
          },
          "categoryId": {
            "type": "string"
          },
          "photoUrl": {
            "type": "string"
          },
          "photoKey": {
            "type": "string"
          },
          "photoThumbUrl": {
            "type": "string"
          },
          "photoThumbKey": {
            "type": "string"
          },
          "minStock": {
            "type": "number",
            "minimum": 0
          },
          "maxStock": {
            "type": "number",
            "description": "Estoque máximo: acima dele o estoque é considerado excesso (capital parado)."
          },
          "reorderPoint": {
            "type": "number"
          },
          "allowsFractionalQty": {
            "type": "boolean",
            "nullable": true,
            "description": "Aceita quantidade fracionada neste produto? `null` (padrão) decide pela unidade; `true` ou `false` forçam a regra."
          },
          "ncm": {
            "type": "string",
            "maxLength": 10
          },
          "cest": {
            "type": "string",
            "maxLength": 10
          },
          "cfopDefault": {
            "type": "string",
            "maxLength": 10
          },
          "origem": {
            "type": "string",
            "maxLength": 2
          },
          "tracksExpiry": {
            "type": "boolean",
            "nullable": true,
            "description": "O produto tem validade? Campo ausente faz o produto herdar a regra da categoria; `false` é uma resposta (\"este não tem\")."
          },
          "axes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductGridAxisDto"
            }
          },
          "initialStockByCell": {
            "description": "Estoque inicial por combinação. Exige `axes`.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InitialStockCellDto"
            }
          }
        },
        "required": [
          "name",
          "unit"
        ]
      },
      "UpdateProductDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "type": {
            "type": "string",
            "enum": [
              "PRODUCT",
              "SERVICE"
            ]
          },
          "sku": {
            "type": "string"
          },
          "trackingMode": {
            "type": "object",
            "description": "Controle por número de série (IMEI ou série por unidade). Só `NONE` e `SERIAL` são aceitos. Virar `SERIAL` com saldo em estoque é recusado (`serial_conversion_required`): o saldo precisa de uma série por unidade, e isso se faz pela conversão em `POST /stock-units/convert-to-serial`."
          },
          "brand": {
            "type": "string",
            "description": "Marca do produto. Texto livre, independente da categoria e do fornecedor.",
            "maxLength": 80
          },
          "price": {
            "type": "string",
            "pattern": "^\\d*\\.?\\d+$"
          },
          "cost": {
            "type": "string",
            "pattern": "^\\d*\\.?\\d+$"
          },
          "promotionalPrice": {
            "type": "string",
            "nullable": true,
            "description": "Preço promocional (\"de/por\"), com início e fim opcionais. Vale para todas as variações da grade. `null` encerra a promoção; campo ausente não muda.",
            "pattern": "^\\d*\\.?\\d+$"
          },
          "promotionStartsAt": {
            "type": "string",
            "nullable": true
          },
          "promotionEndsAt": {
            "type": "string",
            "nullable": true
          },
          "unit": {
            "type": "string",
            "maxLength": 10
          },
          "categoryId": {
            "type": "string"
          },
          "photoUrl": {
            "type": "string"
          },
          "photoKey": {
            "type": "string"
          },
          "photoThumbUrl": {
            "type": "string"
          },
          "photoThumbKey": {
            "type": "string"
          },
          "minStock": {
            "type": "number",
            "minimum": 0
          },
          "maxStock": {
            "type": "number",
            "description": "Estoque máximo: acima dele o estoque é considerado excesso (capital parado)."
          },
          "reorderPoint": {
            "type": "number"
          },
          "commissionPercentage": {
            "type": "number",
            "nullable": true,
            "description": "Comissão deste produto. `null` limpa a taxa (volta a herdar da categoria); campo ausente não muda.",
            "minimum": 0,
            "maximum": 100
          },
          "hiddenFromSales": {
            "type": "boolean"
          },
          "rentable": {
            "type": "boolean",
            "description": "Produto locável (módulo Locação). `rentPrice`, `rentUnit` e `replacementPrice` aceitam `null` para limpar; campo ausente não muda. Locável exige preço e unidade; serviço e produto com série não podem ser locáveis."
          },
          "rentPrice": {
            "type": "number",
            "nullable": true,
            "minimum": 0
          },
          "rentUnit": {
            "type": "string",
            "enum": [
              "DAY",
              "WEEK",
              "MONTH",
              "EVENT"
            ]
          },
          "rentMinPeriods": {
            "type": "number",
            "minimum": 1
          },
          "replacementPrice": {
            "type": "number",
            "nullable": true,
            "minimum": 0
          },
          "allowsFractionalQty": {
            "type": "boolean",
            "nullable": true,
            "description": "Aceita quantidade fracionada neste produto? `null` decide pela unidade; `true` ou `false` forçam a regra."
          },
          "ncm": {
            "type": "string",
            "nullable": true,
            "maxLength": 10
          },
          "cest": {
            "type": "string",
            "nullable": true,
            "maxLength": 10
          },
          "cfopDefault": {
            "type": "string",
            "nullable": true,
            "maxLength": 10
          },
          "origem": {
            "type": "string",
            "nullable": true,
            "maxLength": 2
          },
          "cBenef": {
            "type": "string",
            "nullable": true,
            "description": "Código de benefício fiscal da UF do emitente (`prod.cBenef`, I05f)."
          },
          "ibsCbsCst": {
            "type": "string",
            "nullable": true,
            "description": "Código de situação tributária do IBS/CBS do produto. O formato é conferido ao salvar."
          },
          "ibsCbsClassTrib": {
            "type": "string",
            "nullable": true
          },
          "icmsCst": {
            "type": "string",
            "nullable": true,
            "description": "Sobrepõe o padrão do tenant. `null` volta a herdar.",
            "maxLength": 20
          },
          "icmsAliquota": {
            "type": "object"
          },
          "pisCst": {
            "type": "string",
            "nullable": true,
            "maxLength": 3
          },
          "pisAliquota": {
            "type": "object"
          },
          "cofinsCst": {
            "type": "string",
            "nullable": true,
            "maxLength": 3
          },
          "cofinsAliquota": {
            "type": "object"
          },
          "cfopSufixoVenda": {
            "type": "string",
            "nullable": true
          },
          "tracksExpiry": {
            "type": "boolean",
            "nullable": true,
            "description": "O produto tem validade? Campo ausente faz o produto herdar a regra da categoria; `false` é uma resposta (\"este não tem\")."
          }
        }
      },
      "CreateOrderItemDto": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string"
          },
          "qty": {
            "type": "number",
            "minimum": 1
          },
          "unitPrice": {
            "type": "number",
            "minimum": 0
          },
          "costAtTime": {
            "type": "number",
            "minimum": 0
          },
          "discount": {
            "type": "number",
            "minimum": 0
          },
          "variantId": {
            "type": "string",
            "description": "Variação (tamanho/cor) quando o produto tem grade."
          },
          "unitSerial": {
            "type": "string",
            "description": "IMEI/série da unidade escolhida (produto controlado por série). Opcional no pedido; o faturamento exige."
          }
        },
        "required": [
          "productId",
          "qty",
          "unitPrice"
        ]
      },
      "ScheduleOrderDto": {
        "type": "object",
        "properties": {
          "rrule": {
            "type": "string",
            "description": "RRULE string defining recurrence pattern",
            "example": "FREQ=WEEKLY;BYDAY=MO"
          },
          "timezone": {
            "type": "string",
            "description": "Fuso horário do agendamento",
            "example": "America/Sao_Paulo"
          },
          "active": {
            "type": "boolean",
            "description": "Se o agendamento está ativo",
            "example": true
          }
        },
        "required": [
          "rrule",
          "timezone",
          "active"
        ]
      },
      "CreateOrderDto": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "string"
          },
          "sellerId": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateOrderItemDto"
            }
          },
          "discountTotal": {
            "type": "number",
            "minimum": 0
          },
          "discountPercentage": {
            "type": "number",
            "minimum": 0,
            "description": "Desconto em percentual (0 a 100)"
          },
          "taxRate": {
            "type": "number",
            "minimum": 0,
            "description": "Alíquota de imposto em percentual (0 a 100)"
          },
          "notes": {
            "type": "string"
          },
          "deliveryAt": {
            "type": "string"
          },
          "cobranca": {
            "type": "string",
            "enum": [
              "ANTECIPADA",
              "NA_ENTREGA"
            ],
            "description": "Quando o pedido é cobrado: `ANTECIPADA` (padrão) converte em venda sem depender de entrega; `NA_ENTREGA` quer dizer que o entregador recebe na porta e a venda nasce depois, com o valor que ele trouxe."
          },
          "validUntil": {
            "type": "string",
            "description": "Validade do orçamento — depois dessa data sem resposta do cliente, o lojista é notificado."
          },
          "pedeAprovacao": {
            "type": "boolean",
            "description": "O cliente precisa aprovar este pedido? Omitido, vale o padrão da loja. `false` grava o pedido sem validade e sem aceite pelo link público; uma `validUntil` enviada junto é descartada."
          },
          "allowInsufficientStock": {
            "type": "boolean",
            "default": false,
            "description": "Permite criar pedido mesmo com estoque insuficiente (exige confirmação explícita do usuário)."
          },
          "schedule": {
            "description": "Agenda a recorrência do pedido no mesmo ato da criação.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ScheduleOrderDto"
              }
            ]
          }
        },
        "required": [
          "customerId",
          "items"
        ]
      },
      "UpdateOrderStatusDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "CONFIRMED",
              "SEPARATED",
              "DISPATCHED",
              "DELIVERED"
            ]
          },
          "reason": {
            "type": "string"
          },
          "allowInsufficientStock": {
            "type": "boolean",
            "description": "Só vale ao aceitar pedido do catálogo (rascunho para confirmado), que passa a reservar estoque: aceita mesmo sem saldo. Sem isto, a falta de estoque recusa com `insufficient_stock`."
          }
        },
        "required": [
          "status"
        ]
      },
      "PickingItemDto": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string"
          },
          "pickedQty": {
            "type": "number",
            "nullable": true,
            "description": "Quantidade conferida na prateleira. `null` desfaz a conferência do item; `0` quer dizer \"conferi e não achei\". Não pode passar da quantidade pedida.",
            "minimum": 0
          }
        },
        "required": [
          "itemId",
          "pickedQty"
        ]
      },
      "RecordPickingDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PickingItemDto"
            }
          },
          "markSeparatedWhenComplete": {
            "type": "boolean",
            "description": "Com `true`, avança o pedido para `SEPARATED` na mesma chamada se todos os itens ficarem conferidos. Opcional, porque conferir agora e fechar depois é um fluxo válido."
          }
        },
        "required": [
          "items"
        ]
      },
      "AdvanceResolutionDto": {
        "type": "object",
        "properties": {
          "action": {
            "enum": [
              "REFUND",
              "CREDIT"
            ],
            "type": "string"
          },
          "method": {
            "type": "string",
            "enum": [
              "PIX",
              "CASH",
              "CARD",
              "CREDIT_CARD",
              "DEBIT_CARD",
              "BANK_TRANSFER",
              "BOLETO",
              "CHECK",
              "OTHER"
            ],
            "description": "Só vale em REFUND."
          }
        },
        "required": [
          "action"
        ]
      },
      "CancelOrderDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "maxLength": 1000
          },
          "advanceResolution": {
            "$ref": "#/components/schemas/AdvanceResolutionDto"
          }
        }
      },
      "CreatePaymentDto": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "PIX",
              "CASH",
              "CARD",
              "FIADO",
              "CREDIT_CARD",
              "DEBIT_CARD",
              "BANK_TRANSFER",
              "BOLETO",
              "CHECK",
              "OTHER",
              "STORE_CREDIT"
            ]
          },
          "amount": {
            "type": "number",
            "minimum": 0
          },
          "receivedByUserId": {
            "type": "string"
          }
        },
        "required": [
          "method",
          "amount"
        ]
      },
      "ConvertOrderDto": {
        "type": "object",
        "properties": {
          "paymentType": {
            "enum": [
              "CASH",
              "INSTALLMENTS"
            ],
            "type": "string"
          },
          "installments": {
            "type": "number"
          },
          "payments": {
            "description": "Pagamentos com que a venda já nasce. Para o dinheiro que já entrou, mande `payments` e a venda nasce quitada.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreatePaymentDto"
            }
          },
          "acknowledgeCreditLimit": {
            "type": "boolean",
            "description": "Autoriza o faturamento a prazo que estoura o limite de crédito do cliente. Vale só se quem converte é dono ou gerente; ver `CreateSaleDto.acknowledgeCreditLimit`."
          },
          "acknowledgeBlockedImei": {
            "type": "boolean",
            "description": "Autoriza faturar pedido com aparelho cujo IMEI está bloqueado. Só vale para Gerente ou Proprietário; a API pública não repassa esta autorização."
          },
          "channel": {
            "type": "string",
            "description": "Canal da venda gerada. Ausente: `POS` (balcão) quando o pedido é faturado sem entrega, e `OTHER` quando há entrega.",
            "enum": [
              "POS",
              "ONLINE",
              "WHATSAPP",
              "PHONE",
              "OTHER"
            ]
          },
          "serials": {
            "type": "object",
            "description": "Séries por linha do pedido (id da linha do pedido para o IMEI ou série), para produto controlado por número de série. Vence a série gravada na linha. Faturar produto com série sem série por nenhum dos dois caminhos é recusado com `serial_required`.",
            "additionalProperties": {
              "type": "string"
            }
          }
        },
        "required": [
          "paymentType"
        ]
      },
      "CreateSaleItemDto": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string"
          },
          "qty": {
            "type": "number",
            "description": "Quantidade vendida. Aceita fração (2,5 kg) em produto vendido por peso; produto contado em peças é arredondado conforme a unidade."
          },
          "unitPrice": {
            "type": "string",
            "pattern": "^\\+?(\\d+\\.?\\d*|\\.\\d+)$"
          },
          "costAtTime": {
            "type": "string"
          },
          "variantId": {
            "type": "string",
            "description": "Célula da grade que está saindo — o 38 preto, não \"o tênis\"."
          },
          "confirmedExpired": {
            "type": "boolean",
            "description": "O operador viu o aviso de lote vencido e confirmou vender mesmo assim."
          },
          "unitSerial": {
            "type": "string",
            "description": "IMEI ou série da unidade que está saindo. Obrigatório para produto com `trackingMode` `SERIAL` e proibido nos demais. A quantidade da linha é sempre 1: cada unidade é uma linha."
          }
        },
        "required": [
          "productId",
          "qty",
          "unitPrice",
          "costAtTime"
        ]
      },
      "CreateSaleReceivableDto": {
        "type": "object",
        "properties": {
          "installmentNo": {
            "type": "number"
          },
          "dueDate": {
            "type": "string"
          },
          "amount": {
            "type": "number"
          }
        },
        "required": [
          "dueDate",
          "amount"
        ]
      },
      "CreateSaleDto": {
        "type": "object",
        "properties": {
          "sellerId": {
            "type": "string"
          },
          "commissionSellerId": {
            "type": "string",
            "description": "Quem RECEBE a comissão, quando não é quem operou o caixa."
          },
          "customerId": {
            "type": "string"
          },
          "occurredAt": {
            "type": "string",
            "description": "Quando a venda aconteceu, DECLARADO PELO APARELHO. ISO 8601."
          },
          "orderId": {
            "type": "string"
          },
          "serviceOrderId": {
            "type": "string"
          },
          "discount": {
            "type": "string"
          },
          "autorizacaoDesconto": {
            "type": "string",
            "description": "Token da autorização do gestor (`POST /sales/autorizacoes`), para passar do teto de desconto do vendedor. Opcional; só é lido quando o desconto passa do teto, e vale uma vez, para a loja, o pedido e o desconto autorizados.",
            "maxLength": 1000
          },
          "deliveryFee": {
            "type": "string",
            "nullable": true,
            "description": "Taxa de entrega — receita da venda que não é receita de mercadoria."
          },
          "channel": {
            "type": "string",
            "enum": [
              "POS",
              "ONLINE",
              "WHATSAPP",
              "PHONE",
              "OTHER"
            ]
          },
          "fiscalModeloEscolhido": {
            "type": "string",
            "description": "Documento que o operador escolheu no balcão: `NFE` ou `NFCE`.",
            "enum": [
              "NFE",
              "NFCE"
            ]
          },
          "fiscalEmailCupom": {
            "type": "string",
            "description": "E-mail para onde mandar o cupom desta venda.",
            "maxLength": 200
          },
          "acknowledgeCreditLimit": {
            "type": "boolean",
            "description": "Autoriza a venda a prazo que estoura o limite de crédito do cliente."
          },
          "acknowledgeBlockedImei": {
            "type": "boolean",
            "description": "Autoriza vender aparelho cujo IMEI está bloqueado (Anatel/Celular Legal). Só vale para Gerente ou Proprietário; a API pública não repassa esta autorização, e a venda segue recusada com `imei_blocked`."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateSaleItemDto"
            }
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreatePaymentDto"
            }
          },
          "receivables": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateSaleReceivableDto"
            }
          },
          "advanceIds": {
            "description": "Adiantamentos do pedido (`order_advance`) que esta venda absorve como pagamento já recebido.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "CancelSaleDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "maxLength": 500,
            "description": "Motivo do cancelamento"
          }
        }
      },
      "CreateMembershipDto": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "string"
          },
          "planId": {
            "type": "string"
          },
          "startDate": {
            "type": "string",
            "description": "Início da assinatura (dia da loja). Padrão: hoje.",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "billingDay": {
            "type": "number",
            "description": "Dia do vencimento (1 a 31; no plano semanal, 1 = segunda a 7 = domingo). Padrão: o dia da âncora.",
            "minimum": 1,
            "maximum": 31
          },
          "price": {
            "type": "number",
            "description": "Preço negociado. Padrão: o do plano. Fica congelado na adesão.",
            "minimum": 0.01
          },
          "trialDays": {
            "type": "number",
            "description": "Dias de teste. Padrão: os do plano; 0 pula o teste.",
            "minimum": 0,
            "maximum": 365
          },
          "endDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "notes": {
            "type": "string",
            "maxLength": 1000
          },
          "discountType": {
            "type": "string",
            "enum": [
              "PERCENT",
              "AMOUNT"
            ]
          },
          "discountValue": {
            "type": "number",
            "minimum": 0.01
          },
          "discountCycles": {
            "type": "number",
            "description": "Por quantos ciclos o desconto vale; ausente = para sempre.",
            "minimum": 1,
            "maximum": 600
          }
        },
        "required": [
          "customerId",
          "planId"
        ]
      },
      "ReceiveMembershipDto": {
        "type": "object",
        "properties": {
          "receivableIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "method": {
            "type": "string",
            "enum": [
              "CASH",
              "PIX",
              "CARD",
              "CREDIT_CARD",
              "DEBIT_CARD",
              "BANK_TRANSFER",
              "BOLETO",
              "CHECK",
              "OTHER"
            ]
          },
          "paidAt": {
            "type": "string",
            "description": "Data (AAAA-MM-DD) ou instante; vazio = agora. Mesma regra de `POST /receivable-payments`."
          }
        },
        "required": [
          "receivableIds",
          "method"
        ]
      },
      "PauseMembershipDto": {
        "type": "object",
        "properties": {
          "until": {
            "type": "string",
            "description": "Volta sozinha nesta data. Ausente = pausada até alguém retomar.",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "reason": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "CancelMembershipDto": {
        "type": "object",
        "properties": {
          "atPeriodEnd": {
            "type": "boolean",
            "description": "`true`: segue valendo até o fim do período já cobrado e cancela no próximo vencimento. Padrão: cancela agora."
          },
          "reason": {
            "type": "string",
            "maxLength": 500
          },
          "cancelOpenCharges": {
            "type": "boolean",
            "description": "Cancela também as parcelas ainda em aberto (sem nenhum pagamento) dos ciclos já gerados. Padrão: mantém."
          }
        }
      },
      "SuspendMembershipDto": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Por que o lojista suspende (fica no histórico).",
            "maxLength": 500
          }
        }
      },
      "ChangePlanDto": {
        "type": "object",
        "properties": {
          "planId": {
            "type": "string"
          },
          "price": {
            "type": "number",
            "description": "Preço negociado no plano novo. Padrão: o preço do plano.",
            "minimum": 0.01
          },
          "reason": {
            "type": "string",
            "maxLength": 500
          }
        },
        "required": [
          "planId"
        ]
      },
      "SetDiscountDto": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "PERCENT",
              "AMOUNT"
            ]
          },
          "value": {
            "type": "number",
            "minimum": 0.01
          },
          "cycles": {
            "type": "number",
            "nullable": true,
            "description": "Por quantos ciclos vale; `null` ou ausente = para sempre.",
            "minimum": 1,
            "maximum": 600
          },
          "reason": {
            "type": "string",
            "maxLength": 500
          }
        },
        "required": [
          "type",
          "value"
        ]
      },
      "RepriceMembershipDto": {
        "type": "object",
        "properties": {
          "price": {
            "type": "number",
            "minimum": 0.01
          },
          "reason": {
            "type": "string",
            "maxLength": 500
          }
        },
        "required": [
          "price"
        ]
      },
      "UpdateMembershipDto": {
        "type": "object",
        "properties": {
          "endDate": {
            "type": "string",
            "nullable": true,
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "maxLength": 1000
          }
        }
      },
      "SetChargeExceptionDto": {
        "type": "object",
        "properties": {
          "periodStart": {
            "type": "string",
            "description": "Vencimento do ciclo afetado (precisa ser um vencimento futuro da assinatura).",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "type": {
            "type": "string",
            "description": "SKIP isenta o ciclo; OVERRIDE troca o valor dele.",
            "enum": [
              "SKIP",
              "OVERRIDE"
            ]
          },
          "amountOverride": {
            "type": "number",
            "minimum": 0
          },
          "reason": {
            "type": "string",
            "maxLength": 500
          }
        },
        "required": [
          "periodStart",
          "type"
        ]
      },
      "CreateWebhookDto": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "Endereço que recebe os eventos. Precisa ser `https://`, público, na porta 443 ou 8443, sem usuário e senha.",
            "maxLength": 2048
          },
          "events": {
            "description": "Tipos de evento a receber (veja a lista no grupo Webhooks). Vazio ou omitido: todos.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "description": {
            "type": "string",
            "maxLength": 300,
            "description": "Texto livre para você reconhecer o webhook (até 300 caracteres)."
          }
        },
        "required": [
          "url"
        ]
      },
      "UpdateWebhookDto": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "description": "Novo endereço. Precisa passar pela mesma conferência do cadastro."
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Nova lista de tipos de evento. Lista vazia: todos."
          },
          "description": {
            "type": "string",
            "maxLength": 300,
            "description": "Novo texto de descrição. Texto vazio apaga a descrição."
          },
          "active": {
            "type": "boolean",
            "description": "`true` reativa um webhook desligado e zera as falhas seguidas; `false` o desliga."
          }
        }
      }
    }
  }
}
