basePath: / definitions: domain.AdminDashboard: properties: gmv_cents: type: integer new_companies: type: integer window_start_at: type: string type: object domain.CartItem: properties: batch: type: string buyer_id: type: string created_at: type: string expires_at: type: string id: type: string product_id: type: string product_name: type: string quantity: type: integer unit_cents: type: integer updated_at: type: string type: object domain.CartSummary: properties: discount_cents: type: integer discount_reason: type: string items: items: $ref: '#/definitions/domain.CartItem' type: array subtotal_cents: type: integer total_cents: type: integer type: object domain.Company: properties: cnpj: type: string corporate_name: type: string created_at: type: string id: type: string is_verified: type: boolean license_number: type: string role: description: pharmacy, distributor, admin type: string updated_at: type: string type: object domain.CompanyRating: properties: average_score: type: number company_id: type: string total_reviews: type: integer type: object domain.InventoryItem: properties: batch: type: string expires_at: type: string name: type: string price_cents: type: integer product_id: type: string quantity: type: integer seller_id: type: string updated_at: type: string type: object domain.Order: properties: buyer_id: type: string created_at: type: string id: type: string items: items: $ref: '#/definitions/domain.OrderItem' type: array seller_id: type: string shipping: $ref: '#/definitions/domain.ShippingAddress' status: $ref: '#/definitions/domain.OrderStatus' total_cents: type: integer updated_at: type: string type: object domain.OrderItem: properties: batch: type: string expires_at: type: string id: type: string order_id: type: string product_id: type: string quantity: type: integer unit_cents: type: integer type: object domain.OrderStatus: enum: - Pendente - Pago - Faturado - Entregue type: string x-enum-varnames: - OrderStatusPending - OrderStatusPaid - OrderStatusInvoiced - OrderStatusDelivered domain.PaymentPreference: properties: commission_pct: type: number gateway: type: string marketplace_fee: type: integer order_id: type: string payment_url: type: string seller_receivable: type: integer type: object domain.PaymentSplitResult: properties: marketplace_fee: type: integer order_id: type: string payment_id: type: string seller_receivable: type: integer status: type: string total_paid_amount: type: integer type: object domain.PaymentWebhookEvent: properties: marketplace_fee: type: integer order_id: type: string payment_id: type: string seller_amount: type: integer status: type: string total_paid_amount: type: integer type: object domain.Product: properties: batch: type: string created_at: type: string description: type: string expires_at: type: string id: type: string name: type: string price_cents: type: integer seller_id: type: string stock: type: integer updated_at: type: string type: object domain.Review: properties: buyer_id: type: string comment: type: string created_at: type: string id: type: string order_id: type: string rating: type: integer seller_id: type: string type: object domain.SellerDashboard: properties: low_stock_alerts: items: $ref: '#/definitions/domain.Product' type: array orders_count: type: integer seller_id: type: string top_products: items: $ref: '#/definitions/domain.TopProduct' type: array total_sales_cents: type: integer type: object domain.Shipment: properties: carrier: type: string created_at: type: string external_tracking: type: string id: type: string order_id: type: string status: type: string tracking_code: type: string updated_at: type: string type: object domain.ShippingAddress: properties: city: type: string complement: type: string country: type: string district: type: string number: type: string recipient_name: type: string state: type: string street: type: string zip_code: type: string type: object domain.TopProduct: properties: name: type: string product_id: type: string revenue_cents: type: integer total_quantity: type: integer type: object domain.User: properties: company_id: type: string created_at: type: string email: type: string id: type: string name: type: string role: type: string updated_at: type: string type: object domain.UserPage: properties: page: type: integer page_size: type: integer total: type: integer users: items: $ref: '#/definitions/domain.User' type: array type: object handler.addCartItemRequest: properties: product_id: type: string quantity: type: integer type: object handler.authResponse: properties: expires_at: type: string token: type: string type: object handler.createOrderRequest: properties: buyer_id: type: string items: items: $ref: '#/definitions/domain.OrderItem' type: array seller_id: type: string shipping: $ref: '#/definitions/domain.ShippingAddress' type: object handler.createReviewRequest: properties: comment: type: string order_id: type: string rating: type: integer type: object handler.createShipmentRequest: properties: carrier: type: string external_tracking: type: string order_id: type: string tracking_code: type: string type: object handler.createUserRequest: properties: company_id: type: string email: type: string name: type: string password: type: string role: type: string type: object handler.inventoryAdjustRequest: properties: delta: type: integer product_id: type: string reason: type: string type: object handler.loginRequest: properties: email: type: string password: type: string type: object handler.registerAuthRequest: properties: company: $ref: '#/definitions/handler.registerCompanyTarget' company_id: type: string email: type: string name: type: string password: type: string role: type: string type: object handler.registerCompanyRequest: properties: cnpj: type: string corporate_name: type: string license_number: type: string role: type: string type: object handler.registerCompanyTarget: properties: cnpj: type: string corporate_name: type: string id: type: string license_number: type: string role: type: string type: object handler.registerProductRequest: properties: batch: type: string description: type: string expires_at: type: string name: type: string price_cents: type: integer seller_id: type: string stock: type: integer type: object handler.updateCompanyRequest: properties: cnpj: type: string corporate_name: type: string is_verified: type: boolean license_number: type: string role: type: string type: object handler.updateProductRequest: properties: batch: type: string description: type: string expires_at: type: string name: type: string price_cents: type: integer seller_id: type: string stock: type: integer type: object handler.updateStatusRequest: properties: status: type: string type: object handler.updateUserRequest: properties: company_id: type: string email: type: string name: type: string password: type: string role: type: string type: object info: contact: email: devops@saveinmed.com name: Engenharia SaveInMed description: API REST B2B para marketplace farmacêutico com split de pagamento e rastreabilidade. title: SaveInMed Performance Core API version: "1.0" paths: /api/companies: get: produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/domain.Company' type: array summary: Lista empresas tags: - Empresas post: consumes: - application/json description: Cadastra farmácia, distribuidora ou administrador com CNPJ e licença sanitária. parameters: - description: Dados da empresa in: body name: company required: true schema: $ref: '#/definitions/handler.registerCompanyRequest' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/domain.Company' summary: Registro de empresas tags: - Empresas /api/companies/{id}: delete: parameters: - description: Company ID in: path name: id required: true type: string responses: "204": description: "" "400": description: Bad Request schema: additionalProperties: type: string type: object "404": description: Not Found schema: additionalProperties: type: string type: object summary: Remover empresa tags: - Empresas get: parameters: - description: Company ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.Company' "404": description: Not Found schema: additionalProperties: type: string type: object summary: Obter empresa tags: - Empresas patch: consumes: - application/json parameters: - description: Company ID in: path name: id required: true type: string - description: Campos para atualização in: body name: payload required: true schema: $ref: '#/definitions/handler.updateCompanyRequest' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.Company' "400": description: Bad Request schema: additionalProperties: type: string type: object "404": description: Not Found schema: additionalProperties: type: string type: object summary: Atualizar empresa tags: - Empresas /api/orders: get: produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/domain.Order' type: array security: - BearerAuth: [] summary: Listar pedidos tags: - Pedidos post: consumes: - application/json parameters: - description: Pedido in: body name: order required: true schema: $ref: '#/definitions/handler.createOrderRequest' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/domain.Order' summary: Criação de pedido com split tags: - Pedidos /api/orders/{id}: delete: parameters: - description: Order ID in: path name: id required: true type: string responses: "204": description: "" "400": description: Bad Request schema: additionalProperties: type: string type: object "404": description: Not Found schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Remover pedido tags: - Pedidos get: parameters: - description: Order ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.Order' security: - BearerAuth: [] summary: Consulta pedido tags: - Pedidos /api/orders/{id}/payment: post: parameters: - description: Order ID in: path name: id required: true type: string produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/domain.PaymentPreference' security: - BearerAuth: [] summary: Cria preferência de pagamento Mercado Pago com split nativo tags: - Pagamentos /api/orders/{id}/status: patch: consumes: - application/json parameters: - description: Order ID in: path name: id required: true type: string - description: Novo status in: body name: status required: true schema: $ref: '#/definitions/handler.updateStatusRequest' produces: - application/json responses: "204": description: "" security: - BearerAuth: [] summary: Atualiza status do pedido tags: - Pedidos /api/products: get: produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/domain.Product' type: array summary: Lista catálogo com lote e validade tags: - Produtos post: consumes: - application/json parameters: - description: Produto in: body name: product required: true schema: $ref: '#/definitions/handler.registerProductRequest' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/domain.Product' summary: Cadastro de produto com rastreabilidade de lote tags: - Produtos /api/products/{id}: delete: parameters: - description: Product ID in: path name: id required: true type: string responses: "204": description: "" "400": description: Bad Request schema: additionalProperties: type: string type: object "404": description: Not Found schema: additionalProperties: type: string type: object summary: Remover produto tags: - Produtos get: parameters: - description: Product ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.Product' "404": description: Not Found schema: additionalProperties: type: string type: object summary: Obter produto tags: - Produtos patch: consumes: - application/json parameters: - description: Product ID in: path name: id required: true type: string - description: Campos para atualização in: body name: payload required: true schema: $ref: '#/definitions/handler.updateProductRequest' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.Product' "400": description: Bad Request schema: additionalProperties: type: string type: object "404": description: Not Found schema: additionalProperties: type: string type: object summary: Atualizar produto tags: - Produtos /api/v1/auth/login: post: consumes: - application/json description: Autentica usuário e retorna token JWT. parameters: - description: Credenciais in: body name: payload required: true schema: $ref: '#/definitions/handler.loginRequest' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handler.authResponse' "400": description: Bad Request schema: additionalProperties: type: string type: object "401": description: Unauthorized schema: additionalProperties: type: string type: object summary: Login tags: - Autenticação /api/v1/auth/register: post: consumes: - application/json description: Cria um usuário e opcionalmente uma empresa, retornando token JWT. parameters: - description: Dados do usuário e empresa in: body name: payload required: true schema: $ref: '#/definitions/handler.registerAuthRequest' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/handler.authResponse' "400": description: Bad Request schema: additionalProperties: type: string type: object "500": description: Internal Server Error schema: additionalProperties: type: string type: object summary: Cadastro de usuário tags: - Autenticação /api/v1/cart: get: produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.CartSummary' security: - BearerAuth: [] summary: Obter carrinho tags: - Carrinho post: consumes: - application/json parameters: - description: Item do carrinho in: body name: payload required: true schema: $ref: '#/definitions/handler.addCartItemRequest' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/domain.CartSummary' "400": description: Bad Request schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Adicionar item ao carrinho tags: - Carrinho /api/v1/cart/{id}: delete: parameters: - description: Cart item ID in: path name: id required: true type: string responses: "200": description: OK schema: $ref: '#/definitions/domain.CartSummary' "400": description: Bad Request schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Remover item do carrinho tags: - Carrinho /api/v1/companies: get: produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/domain.Company' type: array summary: Lista empresas tags: - Empresas post: consumes: - application/json description: Cadastra farmácia, distribuidora ou administrador com CNPJ e licença sanitária. parameters: - description: Dados da empresa in: body name: company required: true schema: $ref: '#/definitions/handler.registerCompanyRequest' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/domain.Company' summary: Registro de empresas tags: - Empresas /api/v1/companies/{id}: delete: parameters: - description: Company ID in: path name: id required: true type: string responses: "204": description: "" "400": description: Bad Request schema: additionalProperties: type: string type: object "404": description: Not Found schema: additionalProperties: type: string type: object summary: Remover empresa tags: - Empresas get: parameters: - description: Company ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.Company' "404": description: Not Found schema: additionalProperties: type: string type: object summary: Obter empresa tags: - Empresas patch: consumes: - application/json parameters: - description: Company ID in: path name: id required: true type: string - description: Campos para atualização in: body name: payload required: true schema: $ref: '#/definitions/handler.updateCompanyRequest' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.Company' "400": description: Bad Request schema: additionalProperties: type: string type: object "404": description: Not Found schema: additionalProperties: type: string type: object summary: Atualizar empresa tags: - Empresas /api/v1/companies/{id}/rating: get: parameters: - description: Company ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.CompanyRating' summary: Obter avaliação da empresa tags: - Empresas /api/v1/companies/{id}/verify: patch: parameters: - description: Company ID in: path name: id required: true type: string responses: "200": description: OK schema: $ref: '#/definitions/domain.Company' security: - BearerAuth: [] summary: Verificar empresa tags: - Empresas /api/v1/companies/me: get: produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.Company' security: - BearerAuth: [] summary: Obter minha empresa tags: - Empresas /api/v1/dashboard/admin: get: produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.AdminDashboard' security: - BearerAuth: [] summary: Dashboard do administrador tags: - Dashboard /api/v1/dashboard/seller: get: parameters: - description: Seller ID in: query name: seller_id type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.SellerDashboard' security: - BearerAuth: [] summary: Dashboard do vendedor tags: - Dashboard /api/v1/inventory: get: parameters: - description: Dias para expiração in: query name: expires_in_days type: integer produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/domain.InventoryItem' type: array security: - BearerAuth: [] summary: Listar estoque tags: - Estoque /api/v1/inventory/adjust: post: consumes: - application/json parameters: - description: Ajuste de estoque in: body name: payload required: true schema: $ref: '#/definitions/handler.inventoryAdjustRequest' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.InventoryItem' "400": description: Bad Request schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Ajustar estoque tags: - Estoque /api/v1/orders: get: produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/domain.Order' type: array security: - BearerAuth: [] summary: Listar pedidos tags: - Pedidos post: consumes: - application/json parameters: - description: Pedido in: body name: order required: true schema: $ref: '#/definitions/handler.createOrderRequest' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/domain.Order' summary: Criação de pedido com split tags: - Pedidos /api/v1/orders/{id}: delete: parameters: - description: Order ID in: path name: id required: true type: string responses: "204": description: "" "400": description: Bad Request schema: additionalProperties: type: string type: object "404": description: Not Found schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Remover pedido tags: - Pedidos get: parameters: - description: Order ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.Order' security: - BearerAuth: [] summary: Consulta pedido tags: - Pedidos /api/v1/orders/{id}/payment: post: parameters: - description: Order ID in: path name: id required: true type: string produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/domain.PaymentPreference' security: - BearerAuth: [] summary: Cria preferência de pagamento Mercado Pago com split nativo tags: - Pagamentos /api/v1/orders/{id}/status: patch: consumes: - application/json parameters: - description: Order ID in: path name: id required: true type: string - description: Novo status in: body name: status required: true schema: $ref: '#/definitions/handler.updateStatusRequest' produces: - application/json responses: "204": description: "" security: - BearerAuth: [] summary: Atualiza status do pedido tags: - Pedidos /api/v1/payments/webhook: post: consumes: - application/json parameters: - description: Evento do gateway in: body name: notification required: true schema: $ref: '#/definitions/domain.PaymentWebhookEvent' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.PaymentSplitResult' summary: Recebe notificações do Mercado Pago tags: - Pagamentos /api/v1/products: get: produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/domain.Product' type: array summary: Lista catálogo com lote e validade tags: - Produtos post: consumes: - application/json parameters: - description: Produto in: body name: product required: true schema: $ref: '#/definitions/handler.registerProductRequest' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/domain.Product' summary: Cadastro de produto com rastreabilidade de lote tags: - Produtos /api/v1/products/{id}: delete: parameters: - description: Product ID in: path name: id required: true type: string responses: "204": description: "" "400": description: Bad Request schema: additionalProperties: type: string type: object "404": description: Not Found schema: additionalProperties: type: string type: object summary: Remover produto tags: - Produtos get: parameters: - description: Product ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.Product' "404": description: Not Found schema: additionalProperties: type: string type: object summary: Obter produto tags: - Produtos patch: consumes: - application/json parameters: - description: Product ID in: path name: id required: true type: string - description: Campos para atualização in: body name: payload required: true schema: $ref: '#/definitions/handler.updateProductRequest' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.Product' "400": description: Bad Request schema: additionalProperties: type: string type: object "404": description: Not Found schema: additionalProperties: type: string type: object summary: Atualizar produto tags: - Produtos /api/v1/reviews: post: consumes: - application/json parameters: - description: Dados da avaliação in: body name: payload required: true schema: $ref: '#/definitions/handler.createReviewRequest' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/domain.Review' "400": description: Bad Request schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Criar avaliação tags: - Avaliações /api/v1/shipments: post: consumes: - application/json parameters: - description: Dados de envio in: body name: shipment required: true schema: $ref: '#/definitions/handler.createShipmentRequest' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/domain.Shipment' security: - BearerAuth: [] summary: Gera guia de postagem/transporte tags: - Logistica /api/v1/shipments/{order_id}: get: parameters: - description: Order ID in: path name: order_id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.Shipment' security: - BearerAuth: [] summary: Rastreia entrega tags: - Logistica /api/v1/users: get: parameters: - description: Página in: query name: page type: integer - description: Tamanho da página in: query name: page_size type: integer - description: Filtro por empresa in: query name: company_id type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.UserPage' "400": description: Bad Request schema: additionalProperties: type: string type: object "500": description: Internal Server Error schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Listar usuários tags: - Usuários post: consumes: - application/json parameters: - description: Novo usuário in: body name: payload required: true schema: $ref: '#/definitions/handler.createUserRequest' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/domain.User' "400": description: Bad Request schema: additionalProperties: type: string type: object "403": description: Forbidden schema: additionalProperties: type: string type: object "500": description: Internal Server Error schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Criar usuário tags: - Usuários /api/v1/users/{id}: delete: parameters: - description: User ID in: path name: id required: true type: string responses: "204": description: No Content schema: type: string "400": description: Bad Request schema: additionalProperties: type: string type: object "403": description: Forbidden schema: additionalProperties: type: string type: object "404": description: Not Found schema: additionalProperties: type: string type: object "500": description: Internal Server Error schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Excluir usuário tags: - Usuários get: parameters: - description: User ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.User' "400": description: Bad Request schema: additionalProperties: type: string type: object "403": description: Forbidden schema: additionalProperties: type: string type: object "404": description: Not Found schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Obter usuário tags: - Usuários put: consumes: - application/json parameters: - description: User ID in: path name: id required: true type: string - description: Campos para atualização in: body name: payload required: true schema: $ref: '#/definitions/handler.updateUserRequest' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/domain.User' "400": description: Bad Request schema: additionalProperties: type: string type: object "403": description: Forbidden schema: additionalProperties: type: string type: object "404": description: Not Found schema: additionalProperties: type: string type: object "500": description: Internal Server Error schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Atualizar usuário tags: - Usuários schemes: - http securityDefinitions: BearerAuth: in: header name: Authorization type: apiKey swagger: "2.0"