{
  "openapi": "3.1.1",
  "info": {
    "title": "Pega Vez API",
    "description": "API de integração do Pega Vez para o próprio salão: serviços, profissionais, disponibilidade, agendamentos, clientes, comandas e relatórios básicos. Autentique com um token pessoal do salão (Authorization: Bearer pv_...), criado no painel do Pega Vez; as permissões são as do token limitadas às de quem o criou. POSTs que criam recurso aceitam o header Idempotency-Key.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.pegavez.com.br"
    }
  ],
  "paths": {
    "/api/salons/{salonId}/services": {
      "get": {
        "tags": [
          "Catalog"
        ],
        "summary": "Serviços do salão, com filtros de busca, categoria e status.",
        "operationId": "ListServices",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "categoryId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "uncategorized",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/ServiceStatusFilter"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ServiceResponse"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/services/{serviceId}": {
      "get": {
        "tags": [
          "Catalog"
        ],
        "summary": "Um serviço.",
        "operationId": "GetService",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "serviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found"
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/customers": {
      "get": {
        "tags": [
          "Customers"
        ],
        "summary": "Clientes do salão com busca, filtro de selo e paginação.",
        "operationId": "ListCustomers",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "badge",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/ReputationBadge"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerListResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      },
      "post": {
        "tags": [
          "Customers"
        ],
        "summary": "Cadastra um cliente (sem conta).",
        "operationId": "CreateCustomer",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Chave única (1 a 255 caracteres visíveis) para repetir a requisição sem criar de novo por 24 horas. Repetição concluída devolve a mesma resposta com Idempotency-Replayed: true; ainda em andamento: 409 (code idempotency_in_progress); a primeira gravou mas não respondeu e passaram 2 minutos: 409 (code idempotency_unknown_result, consulte o recurso e, se precisar, use outra chave); mesma chave com outro corpo: 422 (code idempotency_mismatch).",
            "schema": {
              "maxLength": 255,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveCustomerRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerDetailResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/customers/{customerId}": {
      "get": {
        "tags": [
          "Customers"
        ],
        "summary": "Detalhe do cliente com indicadores dos últimos 12 meses. Observações só com customers.edit.",
        "operationId": "GetCustomer",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerDetailResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      },
      "put": {
        "tags": [
          "Customers"
        ],
        "summary": "Edita os dados do cliente.",
        "operationId": "UpdateCustomer",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveCustomerRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerDetailResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/orders": {
      "get": {
        "tags": [
          "Finance"
        ],
        "summary": "Comandas (paginado, mais recentes primeiro), com filtros de status, busca, período e saldo devedor.",
        "operationId": "ListOrders",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/OrderStatus"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "withBalance",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderListResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/orders/{orderId}": {
      "get": {
        "tags": [
          "Finance"
        ],
        "summary": "Uma comanda, com itens, gorjetas, pagamentos e recebíveis.",
        "operationId": "GetOrder",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found"
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/reports/revenue": {
      "get": {
        "tags": [
          "Reports"
        ],
        "summary": "Faturamento pela data de fechamento: totais, por dia, por tipo, por profissional, por serviço e por produto.",
        "operationId": "GetRevenueReport",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "professionalId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevenueReportResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/reports/receipts": {
      "get": {
        "tags": [
          "Reports"
        ],
        "summary": "Recebimentos pela data do pagamento, por forma: valor, taxas e líquido.",
        "operationId": "GetReceiptsReport",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptsReportResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/availability": {
      "get": {
        "tags": [
          "Scheduling"
        ],
        "summary": "Horários livres por profissional para os serviços escolhidos (equipe: sem antecedência mínima nem janela).",
        "operationId": "GetStaffAvailability",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "date",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "professionalIds",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          {
            "name": "serviceIds",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          {
            "name": "excludeAppointmentId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StaffAvailabilityResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/appointments": {
      "get": {
        "tags": [
          "Scheduling"
        ],
        "summary": "Agendamentos com filtros (cliente, profissional, período, status), do mais recente ao mais antigo.",
        "operationId": "ListAppointments",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "professionalId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/AppointmentStatus"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppointmentListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      },
      "post": {
        "tags": [
          "Scheduling"
        ],
        "summary": "Agenda pela equipe (entra Confirmado). Cliente existente ou novo; encaixe ignora a jornada.",
        "operationId": "CreateAppointment",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Chave única (1 a 255 caracteres visíveis) para repetir a requisição sem criar de novo por 24 horas. Repetição concluída devolve a mesma resposta com Idempotency-Replayed: true; ainda em andamento: 409 (code idempotency_in_progress); a primeira gravou mas não respondeu e passaram 2 minutos: 409 (code idempotency_unknown_result, consulte o recurso e, se precisar, use outra chave); mesma chave com outro corpo: 422 (code idempotency_mismatch).",
            "schema": {
              "maxLength": 255,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAppointmentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppointmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/appointments/{appointmentId}": {
      "get": {
        "tags": [
          "Scheduling"
        ],
        "summary": "Um agendamento.",
        "operationId": "GetAppointment",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "appointmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppointmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/appointments/{appointmentId}/reschedule": {
      "post": {
        "tags": [
          "Scheduling"
        ],
        "summary": "Move para outro horário e/ou profissional.",
        "operationId": "RescheduleAppointment",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "appointmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RescheduleAppointmentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppointmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/appointments/{appointmentId}/confirm": {
      "post": {
        "tags": [
          "Scheduling"
        ],
        "summary": "Solicitado → Confirmado.",
        "operationId": "ConfirmAppointment",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "appointmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppointmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/appointments/{appointmentId}/arrive": {
      "post": {
        "tags": [
          "Scheduling"
        ],
        "summary": "Cliente chegou (também corrige um \"não compareceu\"). Hora real opcional; sem ela, agora.",
        "operationId": "MarkAppointmentArrived",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "appointmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/MarkArrivedRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppointmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/appointments/{appointmentId}/start": {
      "post": {
        "tags": [
          "Scheduling"
        ],
        "summary": "Chegou → Em atendimento. Hora real opcional; sem ela, agora.",
        "operationId": "StartAppointment",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "appointmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/StartAppointmentRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppointmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/appointments/{appointmentId}/complete": {
      "post": {
        "tags": [
          "Scheduling"
        ],
        "summary": "Chegou / Em atendimento → Concluído. Hora real opcional; sem ela, agora.",
        "operationId": "CompleteAppointment",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "appointmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/CompleteAppointmentRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppointmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/appointments/{appointmentId}/cancel": {
      "post": {
        "tags": [
          "Scheduling"
        ],
        "summary": "Cancela (informando se foi o cliente ou o salão).",
        "operationId": "CancelAppointment",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "appointmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelAppointmentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppointmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/appointments/{appointmentId}/no-show": {
      "post": {
        "tags": [
          "Scheduling"
        ],
        "summary": "Não compareceu (liberado alguns minutos após o início, conforme o salão).",
        "operationId": "MarkAppointmentNoShow",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "appointmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppointmentResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/professionals": {
      "get": {
        "tags": [
          "Staff"
        ],
        "summary": "Profissionais (com agenda.view Own, só o próprio; sem agenda.view, 403; no painel, staff.manage também vê todos).",
        "operationId": "ListProfessionals",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "default": "All",
              "$ref": "#/components/schemas/ProfessionalStatusFilter"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProfessionalResponse"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/salons/{salonId}/professionals/{professionalId}": {
      "get": {
        "tags": [
          "Staff"
        ],
        "summary": "Um profissional (404 se não existe ou se quem pede não pode vê-lo).",
        "operationId": "GetProfessional",
        "parameters": [
          {
            "name": "salonId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "professionalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfessionalResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found"
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "AppliedPromotionResponse": {
        "required": [
          "id",
          "name",
          "discount"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "discount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AppointmentAction": {
        "enum": [
          "Confirm",
          "Arrive",
          "Start",
          "Complete",
          "Cancel",
          "MarkNoShow",
          "Reschedule",
          "EditNotes"
        ]
      },
      "AppointmentCustomerResponse": {
        "required": [
          "id",
          "name",
          "phone",
          "email",
          "badge",
          "notes",
          "hasAccount",
          "isAnonymized"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "phone": {
            "type": [
              "null",
              "string"
            ]
          },
          "email": {
            "type": [
              "null",
              "string"
            ]
          },
          "badge": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ReputationBadge"
              }
            ]
          },
          "notes": {
            "type": [
              "null",
              "string"
            ]
          },
          "hasAccount": {
            "type": "boolean"
          },
          "isAnonymized": {
            "type": "boolean"
          }
        }
      },
      "AppointmentListResponse": {
        "required": [
          "timeZone",
          "items",
          "page",
          "pageSize",
          "total"
        ],
        "type": "object",
        "properties": {
          "timeZone": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppointmentResponse"
            }
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "AppointmentOrigin": {
        "enum": [
          "Online",
          "Reception",
          "Professional"
        ]
      },
      "AppointmentResponse": {
        "required": [
          "id",
          "professionalId",
          "professionalName",
          "customer",
          "startsAt",
          "endsAt",
          "occupiedUntil",
          "durationMinutes",
          "bufferAfterMinutes",
          "status",
          "origin",
          "notes",
          "outsideWorkingHours",
          "services",
          "totalPrice",
          "arrivedAt",
          "startedAt",
          "completedAt",
          "cancelledAt",
          "cancelledBy",
          "cancellationReason",
          "noShowAt",
          "customerConfirmedAt",
          "noShowAvailableAt",
          "allowedActions",
          "createdAt",
          "noShowSuggested",
          "comboId",
          "comboName",
          "listTotalPrice",
          "promotions",
          "seriesId"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "professionalId": {
            "type": "string",
            "format": "uuid"
          },
          "professionalName": {
            "type": "string"
          },
          "customer": {
            "$ref": "#/components/schemas/AppointmentCustomerResponse"
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "occupiedUntil": {
            "type": "string",
            "format": "date-time"
          },
          "durationMinutes": {
            "type": "integer",
            "format": "int32"
          },
          "bufferAfterMinutes": {
            "type": "integer",
            "format": "int32"
          },
          "status": {
            "$ref": "#/components/schemas/AppointmentStatus"
          },
          "origin": {
            "$ref": "#/components/schemas/AppointmentOrigin"
          },
          "notes": {
            "type": [
              "null",
              "string"
            ]
          },
          "outsideWorkingHours": {
            "type": "boolean"
          },
          "services": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppointmentServiceResponse"
            }
          },
          "totalPrice": {
            "type": "number",
            "format": "double"
          },
          "arrivedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "startedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "cancelledAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "cancelledBy": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CancelledBy"
              }
            ]
          },
          "cancellationReason": {
            "type": [
              "null",
              "string"
            ]
          },
          "noShowAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "customerConfirmedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "noShowAvailableAt": {
            "type": "string",
            "format": "date-time"
          },
          "allowedActions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppointmentAction"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "noShowSuggested": {
            "type": "boolean"
          },
          "comboId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "comboName": {
            "type": [
              "null",
              "string"
            ]
          },
          "listTotalPrice": {
            "type": "number",
            "format": "double"
          },
          "promotions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppliedPromotionResponse"
            }
          },
          "seriesId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          }
        }
      },
      "AppointmentServiceResponse": {
        "required": [
          "serviceId",
          "name",
          "price",
          "durationMinutes",
          "bufferAfterMinutes",
          "listPrice",
          "promotionId",
          "promotionName"
        ],
        "type": "object",
        "properties": {
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "price": {
            "type": "number",
            "format": "double"
          },
          "durationMinutes": {
            "type": "integer",
            "format": "int32"
          },
          "bufferAfterMinutes": {
            "type": "integer",
            "format": "int32"
          },
          "listPrice": {
            "type": "number",
            "format": "double"
          },
          "promotionId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "promotionName": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "AppointmentStatus": {
        "enum": [
          "Requested",
          "Confirmed",
          "Arrived",
          "InService",
          "Completed",
          "Cancelled",
          "NoShow"
        ]
      },
      "CancelAppointmentRequest": {
        "required": [
          "cancelledBy"
        ],
        "type": "object",
        "properties": {
          "cancelledBy": {
            "$ref": "#/components/schemas/CancelledBy"
          },
          "reason": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "CancelledBy": {
        "enum": [
          "Customer",
          "Salon",
          null
        ]
      },
      "CommissionRule": {
        "required": [
          "type",
          "value"
        ],
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/CommissionType"
          },
          "value": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "CommissionType": {
        "enum": [
          "Percent",
          "Fixed"
        ]
      },
      "CompleteAppointmentRequest": {
        "type": "object",
        "properties": {
          "completedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          }
        }
      },
      "CreateAppointmentRequest": {
        "required": [
          "professionalId",
          "startsAt"
        ],
        "type": "object",
        "properties": {
          "professionalId": {
            "type": "string",
            "format": "uuid"
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "serviceIds": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "customerId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "newCustomer": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/NewCustomerRequest"
              }
            ]
          },
          "notes": {
            "type": [
              "null",
              "string"
            ]
          },
          "allowOutsideWorkingHours": {
            "type": "boolean"
          },
          "callbackRequestId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "comboId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          }
        }
      },
      "CustomerDetailResponse": {
        "required": [
          "id",
          "name",
          "phone",
          "email",
          "birthDate",
          "notes",
          "blockedFromOnlineBooking",
          "requiresDeposit",
          "hasAccount",
          "isAnonymized",
          "createdAt",
          "updatedAt",
          "canSeePrivateData",
          "indicators"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "phone": {
            "type": [
              "null",
              "string"
            ]
          },
          "email": {
            "type": [
              "null",
              "string"
            ]
          },
          "birthDate": {
            "type": [
              "null",
              "string"
            ],
            "format": "date"
          },
          "notes": {
            "type": [
              "null",
              "string"
            ]
          },
          "blockedFromOnlineBooking": {
            "type": "boolean"
          },
          "requiresDeposit": {
            "type": "boolean"
          },
          "hasAccount": {
            "type": "boolean"
          },
          "isAnonymized": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "canSeePrivateData": {
            "type": "boolean"
          },
          "indicators": {
            "$ref": "#/components/schemas/CustomerIndicators"
          }
        }
      },
      "CustomerIndicators": {
        "required": [
          "badge",
          "appointments",
          "attended",
          "noShows",
          "cancellations",
          "lateCancellations",
          "attendanceRate",
          "averageLateMinutes",
          "lastVisitAt",
          "averageTicket"
        ],
        "type": "object",
        "properties": {
          "badge": {
            "$ref": "#/components/schemas/ReputationBadge"
          },
          "appointments": {
            "type": [
              "null",
              "integer"
            ],
            "format": "int32"
          },
          "attended": {
            "type": [
              "null",
              "integer"
            ],
            "format": "int32"
          },
          "noShows": {
            "type": [
              "null",
              "integer"
            ],
            "format": "int32"
          },
          "cancellations": {
            "type": [
              "null",
              "integer"
            ],
            "format": "int32"
          },
          "lateCancellations": {
            "type": [
              "null",
              "integer"
            ],
            "format": "int32"
          },
          "attendanceRate": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "averageLateMinutes": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "lastVisitAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "averageTicket": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          }
        }
      },
      "CustomerListItemResponse": {
        "required": [
          "id",
          "name",
          "phone",
          "email",
          "badge",
          "lastVisitAt",
          "hasAccount",
          "blockedFromOnlineBooking",
          "requiresDeposit"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "phone": {
            "type": [
              "null",
              "string"
            ]
          },
          "email": {
            "type": [
              "null",
              "string"
            ]
          },
          "badge": {
            "$ref": "#/components/schemas/ReputationBadge"
          },
          "lastVisitAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "hasAccount": {
            "type": "boolean"
          },
          "blockedFromOnlineBooking": {
            "type": "boolean"
          },
          "requiresDeposit": {
            "type": "boolean"
          }
        }
      },
      "CustomerListResponse": {
        "required": [
          "items",
          "page",
          "pageSize",
          "total"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerListItemResponse"
            }
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "DiscountResponse": {
        "required": [
          "type",
          "value"
        ],
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/DiscountType"
          },
          "value": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "DiscountType": {
        "enum": [
          "Percent",
          "Amount"
        ]
      },
      "HttpValidationProblemDetails": {
        "required": [
          "errors"
        ],
        "type": "object",
        "properties": {
          "type": {
            "type": [
              "null",
              "string"
            ]
          },
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "type": [
              "null",
              "integer"
            ],
            "format": "int32"
          },
          "detail": {
            "type": [
              "null",
              "string"
            ]
          },
          "instance": {
            "type": [
              "null",
              "string"
            ]
          },
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      },
      "MarkArrivedRequest": {
        "type": "object",
        "properties": {
          "arrivedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          }
        }
      },
      "NewCustomerRequest": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "phone": {
            "type": [
              "null",
              "string"
            ]
          },
          "email": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "OrderCustomerResponse": {
        "required": [
          "id",
          "name",
          "phone"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "phone": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "OrderItemKind": {
        "enum": [
          "Service",
          "Product",
          "Custom"
        ]
      },
      "OrderItemResponse": {
        "required": [
          "id",
          "kind",
          "description",
          "quantity",
          "unitPrice",
          "listUnitPrice",
          "promotionName",
          "grossAmount",
          "discount",
          "discountAmount",
          "orderDiscountAmount",
          "netAmount",
          "professionalId",
          "professionalName",
          "productId",
          "productStock",
          "appointmentId",
          "serviceId"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "$ref": "#/components/schemas/OrderItemKind"
          },
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int32"
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          },
          "listUnitPrice": {
            "type": [
              "null",
              "number"
            ],
            "format": "double"
          },
          "promotionName": {
            "type": [
              "null",
              "string"
            ]
          },
          "grossAmount": {
            "type": "number",
            "format": "double"
          },
          "discount": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/DiscountResponse"
              }
            ]
          },
          "discountAmount": {
            "type": "number",
            "format": "double"
          },
          "orderDiscountAmount": {
            "type": "number",
            "format": "double"
          },
          "netAmount": {
            "type": "number",
            "format": "double"
          },
          "professionalId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "professionalName": {
            "type": [
              "null",
              "string"
            ]
          },
          "productId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "productStock": {
            "type": [
              "null",
              "integer"
            ],
            "format": "int32"
          },
          "appointmentId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "serviceId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          }
        }
      },
      "OrderListResponse": {
        "required": [
          "items",
          "page",
          "pageSize",
          "total",
          "timeZone"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderSummaryResponse"
            }
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "total": {
            "type": "integer",
            "format": "int32"
          },
          "timeZone": {
            "type": "string"
          }
        }
      },
      "OrderPaymentResponse": {
        "required": [
          "id",
          "paymentMethodId",
          "methodName",
          "methodKind",
          "installments",
          "amount",
          "receivedAmount",
          "changeAmount",
          "feePercent",
          "feeAmount",
          "netAmount",
          "paidAt",
          "afterClose",
          "status",
          "reversedAt",
          "receivables"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "paymentMethodId": {
            "type": "string",
            "format": "uuid"
          },
          "methodName": {
            "type": "string"
          },
          "methodKind": {
            "$ref": "#/components/schemas/PaymentMethodKind"
          },
          "installments": {
            "type": "integer",
            "format": "int32"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "receivedAmount": {
            "type": "number",
            "format": "double"
          },
          "changeAmount": {
            "type": "number",
            "format": "double"
          },
          "feePercent": {
            "type": "number",
            "format": "double"
          },
          "feeAmount": {
            "type": "number",
            "format": "double"
          },
          "netAmount": {
            "type": "number",
            "format": "double"
          },
          "paidAt": {
            "type": "string",
            "format": "date-time"
          },
          "afterClose": {
            "type": "boolean"
          },
          "status": {
            "$ref": "#/components/schemas/PaymentStatus"
          },
          "reversedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "receivables": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceivableResponse"
            }
          }
        }
      },
      "OrderResponse": {
        "required": [
          "id",
          "number",
          "status",
          "customer",
          "businessDate",
          "openedAt",
          "openedByName",
          "closedAt",
          "cancelledAt",
          "cancellationReason",
          "discount",
          "subtotal",
          "discountTotal",
          "total",
          "tipTotal",
          "amountDue",
          "paidTotal",
          "balance",
          "items",
          "tips",
          "payments",
          "appointmentIds",
          "timeZone"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "number": {
            "type": "integer",
            "format": "int32"
          },
          "status": {
            "$ref": "#/components/schemas/OrderStatus"
          },
          "customer": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/OrderCustomerResponse"
              }
            ]
          },
          "businessDate": {
            "type": "string",
            "format": "date"
          },
          "openedAt": {
            "type": "string",
            "format": "date-time"
          },
          "openedByName": {
            "type": [
              "null",
              "string"
            ]
          },
          "closedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "cancelledAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "cancellationReason": {
            "type": [
              "null",
              "string"
            ]
          },
          "discount": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/DiscountResponse"
              }
            ]
          },
          "subtotal": {
            "type": "number",
            "format": "double"
          },
          "discountTotal": {
            "type": "number",
            "format": "double"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "tipTotal": {
            "type": "number",
            "format": "double"
          },
          "amountDue": {
            "type": "number",
            "format": "double"
          },
          "paidTotal": {
            "type": "number",
            "format": "double"
          },
          "balance": {
            "type": "number",
            "format": "double"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderItemResponse"
            }
          },
          "tips": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderTipResponse"
            }
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderPaymentResponse"
            }
          },
          "appointmentIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "timeZone": {
            "type": "string"
          }
        }
      },
      "OrderStatus": {
        "enum": [
          "Open",
          "Closed",
          "Cancelled"
        ]
      },
      "OrderSummaryResponse": {
        "required": [
          "id",
          "number",
          "status",
          "customerId",
          "customerName",
          "businessDate",
          "openedAt",
          "closedAt",
          "description",
          "itemCount",
          "total",
          "tipTotal",
          "paidTotal",
          "balance"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "number": {
            "type": "integer",
            "format": "int32"
          },
          "status": {
            "$ref": "#/components/schemas/OrderStatus"
          },
          "customerId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "customerName": {
            "type": [
              "null",
              "string"
            ]
          },
          "businessDate": {
            "type": "string",
            "format": "date"
          },
          "openedAt": {
            "type": "string",
            "format": "date-time"
          },
          "closedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "description": {
            "type": "string"
          },
          "itemCount": {
            "type": "integer",
            "format": "int32"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "tipTotal": {
            "type": "number",
            "format": "double"
          },
          "paidTotal": {
            "type": "number",
            "format": "double"
          },
          "balance": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "OrderTipResponse": {
        "required": [
          "id",
          "professionalId",
          "professionalName",
          "amount"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "professionalId": {
            "type": "string",
            "format": "uuid"
          },
          "professionalName": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "PaymentMethodKind": {
        "enum": [
          "Cash",
          "Pix",
          "Debit",
          "Credit",
          "Other"
        ]
      },
      "PaymentStatus": {
        "enum": [
          "Active",
          "Reversed"
        ]
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": [
              "null",
              "string"
            ]
          },
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "type": [
              "null",
              "integer"
            ],
            "format": "int32"
          },
          "detail": {
            "type": [
              "null",
              "string"
            ]
          },
          "instance": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "ProfessionalAvailability": {
        "required": [
          "professionalId",
          "displayName",
          "durationMinutes",
          "bufferAfterMinutes",
          "slots",
          "unavailableReason"
        ],
        "type": "object",
        "properties": {
          "professionalId": {
            "type": "string",
            "format": "uuid"
          },
          "displayName": {
            "type": "string"
          },
          "durationMinutes": {
            "type": "integer",
            "format": "int32"
          },
          "bufferAfterMinutes": {
            "type": "integer",
            "format": "int32"
          },
          "slots": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "date-time"
            }
          },
          "unavailableReason": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "ProfessionalResponse": {
        "required": [
          "id",
          "displayName",
          "memberId",
          "memberName",
          "color",
          "photoUrl",
          "active",
          "acceptsOnlineBooking",
          "displayOrder"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "displayName": {
            "type": "string"
          },
          "memberId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "memberName": {
            "type": [
              "null",
              "string"
            ]
          },
          "color": {
            "type": "string"
          },
          "photoUrl": {
            "type": [
              "null",
              "string"
            ]
          },
          "active": {
            "type": "boolean"
          },
          "acceptsOnlineBooking": {
            "type": "boolean"
          },
          "displayOrder": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "ProfessionalStatusFilter": {
        "enum": [
          "Active",
          "Inactive",
          "All"
        ]
      },
      "ReceiptMethodRow": {
        "required": [
          "paymentMethodId",
          "name",
          "kind",
          "count",
          "amount",
          "feeAmount",
          "netAmount",
          "afterCloseAmount"
        ],
        "type": "object",
        "properties": {
          "paymentMethodId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/PaymentMethodKind"
          },
          "count": {
            "type": "integer",
            "format": "int32"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "feeAmount": {
            "type": "number",
            "format": "double"
          },
          "netAmount": {
            "type": "number",
            "format": "double"
          },
          "afterCloseAmount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "ReceiptsReportResponse": {
        "required": [
          "period",
          "totals",
          "byMethod"
        ],
        "type": "object",
        "properties": {
          "period": {
            "$ref": "#/components/schemas/ReportPeriodResponse"
          },
          "totals": {
            "$ref": "#/components/schemas/ReceiptTotals"
          },
          "byMethod": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptMethodRow"
            }
          }
        }
      },
      "ReceiptTotals": {
        "required": [
          "count",
          "amount",
          "feeAmount",
          "netAmount",
          "afterCloseAmount"
        ],
        "type": "object",
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "feeAmount": {
            "type": "number",
            "format": "double"
          },
          "netAmount": {
            "type": "number",
            "format": "double"
          },
          "afterCloseAmount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "ReceivableResponse": {
        "required": [
          "installmentNumber",
          "installmentCount",
          "dueDate",
          "grossAmount",
          "feeAmount",
          "netAmount",
          "status"
        ],
        "type": "object",
        "properties": {
          "installmentNumber": {
            "type": "integer",
            "format": "int32"
          },
          "installmentCount": {
            "type": "integer",
            "format": "int32"
          },
          "dueDate": {
            "type": "string",
            "format": "date"
          },
          "grossAmount": {
            "type": "number",
            "format": "double"
          },
          "feeAmount": {
            "type": "number",
            "format": "double"
          },
          "netAmount": {
            "type": "number",
            "format": "double"
          },
          "status": {
            "$ref": "#/components/schemas/ReceivableStatus"
          }
        }
      },
      "ReceivableStatus": {
        "enum": [
          "Expected",
          "Cancelled"
        ]
      },
      "ReportPeriodResponse": {
        "required": [
          "from",
          "to",
          "professionalId",
          "professionalName"
        ],
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date"
          },
          "to": {
            "type": "string",
            "format": "date"
          },
          "professionalId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "professionalName": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "ReputationBadge": {
        "enum": [
          "New",
          "Trusted",
          "Attention",
          "Risk"
        ]
      },
      "RescheduleAppointmentRequest": {
        "required": [
          "startsAt"
        ],
        "type": "object",
        "properties": {
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "professionalId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "allowOutsideWorkingHours": {
            "type": "boolean"
          }
        }
      },
      "RevenueDayRow": {
        "required": [
          "date",
          "orderCount",
          "grossAmount",
          "discountAmount",
          "netAmount",
          "averageTicket"
        ],
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "orderCount": {
            "type": "integer",
            "format": "int32"
          },
          "grossAmount": {
            "type": "number",
            "format": "double"
          },
          "discountAmount": {
            "type": "number",
            "format": "double"
          },
          "netAmount": {
            "type": "number",
            "format": "double"
          },
          "averageTicket": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "RevenueKindRow": {
        "required": [
          "kind",
          "quantity",
          "grossAmount",
          "discountAmount",
          "netAmount"
        ],
        "type": "object",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/OrderItemKind"
          },
          "quantity": {
            "type": "integer",
            "format": "int32"
          },
          "grossAmount": {
            "type": "number",
            "format": "double"
          },
          "discountAmount": {
            "type": "number",
            "format": "double"
          },
          "netAmount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "RevenueProductRow": {
        "required": [
          "productId",
          "name",
          "quantity",
          "grossAmount",
          "discountAmount",
          "netAmount",
          "costAmount"
        ],
        "type": "object",
        "properties": {
          "productId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int32"
          },
          "grossAmount": {
            "type": "number",
            "format": "double"
          },
          "discountAmount": {
            "type": "number",
            "format": "double"
          },
          "netAmount": {
            "type": "number",
            "format": "double"
          },
          "costAmount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "RevenueProfessionalRow": {
        "required": [
          "professionalId",
          "name",
          "orderCount",
          "grossAmount",
          "discountAmount",
          "netAmount",
          "tipAmount"
        ],
        "type": "object",
        "properties": {
          "professionalId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "orderCount": {
            "type": "integer",
            "format": "int32"
          },
          "grossAmount": {
            "type": "number",
            "format": "double"
          },
          "discountAmount": {
            "type": "number",
            "format": "double"
          },
          "netAmount": {
            "type": "number",
            "format": "double"
          },
          "tipAmount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "RevenueReportResponse": {
        "required": [
          "period",
          "totals",
          "byDay",
          "byKind",
          "byProfessional",
          "byService",
          "byProduct"
        ],
        "type": "object",
        "properties": {
          "period": {
            "$ref": "#/components/schemas/ReportPeriodResponse"
          },
          "totals": {
            "$ref": "#/components/schemas/RevenueTotals"
          },
          "byDay": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevenueDayRow"
            }
          },
          "byKind": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevenueKindRow"
            }
          },
          "byProfessional": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevenueProfessionalRow"
            }
          },
          "byService": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevenueServiceRow"
            }
          },
          "byProduct": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevenueProductRow"
            }
          }
        }
      },
      "RevenueServiceRow": {
        "required": [
          "serviceId",
          "name",
          "quantity",
          "grossAmount",
          "discountAmount",
          "netAmount"
        ],
        "type": "object",
        "properties": {
          "serviceId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int32"
          },
          "grossAmount": {
            "type": "number",
            "format": "double"
          },
          "discountAmount": {
            "type": "number",
            "format": "double"
          },
          "netAmount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "RevenueTotals": {
        "required": [
          "orderCount",
          "grossAmount",
          "discountAmount",
          "netAmount",
          "averageTicket",
          "tipAmount"
        ],
        "type": "object",
        "properties": {
          "orderCount": {
            "type": "integer",
            "format": "int32"
          },
          "grossAmount": {
            "type": "number",
            "format": "double"
          },
          "discountAmount": {
            "type": "number",
            "format": "double"
          },
          "netAmount": {
            "type": "number",
            "format": "double"
          },
          "averageTicket": {
            "type": "number",
            "format": "double"
          },
          "tipAmount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "SaveCustomerRequest": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "phone": {
            "type": [
              "null",
              "string"
            ]
          },
          "email": {
            "type": [
              "null",
              "string"
            ]
          },
          "birthDate": {
            "type": [
              "null",
              "string"
            ],
            "format": "date"
          },
          "notes": {
            "type": [
              "null",
              "string"
            ]
          },
          "blockedFromOnlineBooking": {
            "type": "boolean"
          },
          "requiresDeposit": {
            "type": "boolean"
          }
        }
      },
      "ServiceResponse": {
        "required": [
          "id",
          "name",
          "description",
          "categoryId",
          "categoryName",
          "durationMinutes",
          "price",
          "bufferAfterMinutes",
          "commission",
          "visibleOnline",
          "active",
          "sortOrder",
          "professionalCount"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "categoryId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "categoryName": {
            "type": [
              "null",
              "string"
            ]
          },
          "durationMinutes": {
            "type": "integer",
            "format": "int32"
          },
          "price": {
            "type": "number",
            "format": "double"
          },
          "bufferAfterMinutes": {
            "type": "integer",
            "format": "int32"
          },
          "commission": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CommissionRule"
              }
            ]
          },
          "visibleOnline": {
            "type": "boolean"
          },
          "active": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          },
          "professionalCount": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "ServiceStatusFilter": {
        "enum": [
          "Active",
          "Inactive",
          "All",
          null
        ]
      },
      "StaffAvailabilityResponse": {
        "required": [
          "timeZone",
          "slotStepMinutes",
          "professionals"
        ],
        "type": "object",
        "properties": {
          "timeZone": {
            "type": "string"
          },
          "slotStepMinutes": {
            "type": "integer",
            "format": "int32"
          },
          "professionals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfessionalAvailability"
            }
          }
        }
      },
      "StartAppointmentRequest": {
        "type": "object",
        "properties": {
          "startedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          }
        }
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "http",
        "description": "Token pessoal de API do salão (pv_ + 43 caracteres), mostrado uma única vez na criação.",
        "scheme": "bearer",
        "bearerFormat": "pv_..."
      }
    }
  },
  "tags": [
    {
      "name": "Catalog"
    },
    {
      "name": "Customers"
    },
    {
      "name": "Finance"
    },
    {
      "name": "Reports"
    },
    {
      "name": "Scheduling"
    },
    {
      "name": "Staff"
    }
  ]
}