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:
      category:
        description: farmacia, distribuidora
        type: string
      city:
        type: string
      cnpj:
        type: string
      corporate_name:
        type: string
      created_at:
        type: string
      id:
        type: string
      is_verified:
        type: boolean
      latitude:
        description: Location
        type: number
      license_number:
        type: string
      longitude:
        type: number
      state:
        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.ProductPaginationResponse:
    properties:
      current_page:
        type: integer
      items:
        items:
          $ref: '#/definitions/domain.Product'
        type: array
      total_count:
        type: integer
      total_pages:
        type: integer
    type: object
  domain.ProductSearchPage:
    properties:
      page:
        type: integer
      page_size:
        type: integer
      products:
        items:
          $ref: '#/definitions/domain.ProductWithDistance'
        type: array
      total:
        type: integer
    type: object
  domain.ProductWithDistance:
    properties:
      batch:
        type: string
      created_at:
        type: string
      description:
        type: string
      distance_km:
        type: number
      expires_at:
        type: string
      id:
        type: string
      name:
        type: string
      price_cents:
        type: integer
      seller_id:
        type: string
      stock:
        type: integer
      tenant_city:
        type: string
      tenant_state:
        type: string
      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.ShippingMethod:
    properties:
      active:
        type: boolean
      created_at:
        type: string
      free_shipping_threshold_cents:
        type: integer
      id:
        type: string
      max_radius_km:
        type: number
      min_fee_cents:
        type: integer
      pickup_address:
        type: string
      pickup_hours:
        type: string
      preparation_minutes:
        type: integer
      price_per_km_cents:
        type: integer
      type:
        $ref: '#/definitions/domain.ShippingMethodType'
      updated_at:
        type: string
      vendor_id:
        type: string
    type: object
  domain.ShippingMethodType:
    enum:
    - pickup
    - own_delivery
    - third_party_delivery
    type: string
    x-enum-varnames:
    - ShippingMethodPickup
    - ShippingMethodOwnDelivery
    - ShippingMethodThirdParty
  domain.ShippingOption:
    properties:
      description:
        type: string
      distance_km:
        type: number
      estimated_minutes:
        type: integer
      type:
        type: string
      value_cents:
        type: integer
    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
      email_verified:
        type: boolean
      id:
        type: string
      name:
        type: string
      role:
        type: string
      updated_at:
        type: string
      username:
        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
      username:
        type: string
    type: object
  handler.forgotPasswordRequest:
    properties:
      email:
        type: string
    type: object
  handler.inventoryAdjustRequest:
    properties:
      delta:
        type: integer
      product_id:
        type: string
      reason:
        type: string
    type: object
  handler.loginRequest:
    properties:
      password:
        type: string
      username:
        type: string
    type: object
  handler.messageResponse:
    properties:
      message:
        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
      username:
        type: string
    type: object
  handler.registerCompanyRequest:
    properties:
      category:
        type: string
      city:
        type: string
      cnpj:
        type: string
      corporate_name:
        type: string
      latitude:
        type: number
      license_number:
        type: string
      longitude:
        type: number
      state:
        type: string
    type: object
  handler.registerCompanyTarget:
    properties:
      category:
        type: string
      city:
        type: string
      cnpj:
        type: string
      corporate_name:
        type: string
      id:
        type: string
      latitude:
        type: number
      license_number:
        type: string
      longitude:
        type: number
      state:
        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.resetPasswordRequest:
    properties:
      password:
        type: string
      token:
        type: string
    type: object
  handler.resetTokenResponse:
    properties:
      expires_at:
        type: string
      message:
        type: string
      reset_token:
        type: string
    type: object
  handler.shippingCalculateRequest:
    properties:
      address_id:
        type: string
      buyer_latitude:
        type: number
      buyer_longitude:
        type: number
      cart_total_cents:
        type: integer
      postal_code:
        type: string
      vendor_id:
        type: string
    type: object
  handler.shippingMethodRequest:
    properties:
      active:
        type: boolean
      free_shipping_threshold_cents:
        type: integer
      max_radius_km:
        type: number
      min_fee_cents:
        type: integer
      pickup_address:
        type: string
      pickup_hours:
        type: string
      preparation_minutes:
        type: integer
      price_per_km_cents:
        type: integer
      type:
        type: string
    type: object
  handler.shippingSettingsRequest:
    properties:
      methods:
        items:
          $ref: '#/definitions/handler.shippingMethodRequest'
        type: array
    type: object
  handler.updateCompanyRequest:
    properties:
      category:
        type: string
      city:
        type: string
      cnpj:
        type: string
      corporate_name:
        type: string
      is_verified:
        type: boolean
      latitude:
        type: number
      license_number:
        type: string
      longitude:
        type: number
      state:
        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
      username:
        type: string
    type: object
  handler.verifyEmailRequest:
    properties:
      token:
        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/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/logout:
    post:
      description: Endpoint para logout (invalidação client-side).
      responses:
        "204":
          description: No Content
          schema:
            type: string
      summary: Logout
      tags:
      - Autenticação
  /api/v1/auth/password/forgot:
    post:
      consumes:
      - application/json
      description: Gera um token de redefinição de senha.
      parameters:
      - description: Email do usuário
        in: body
        name: payload
        required: true
        schema:
          $ref: '#/definitions/handler.forgotPasswordRequest'
      produces:
      - application/json
      responses:
        "202":
          description: Accepted
          schema:
            $ref: '#/definitions/handler.resetTokenResponse'
        "400":
          description: Bad Request
          schema:
            additionalProperties:
              type: string
            type: object
      summary: Solicitar redefinição de senha
      tags:
      - Autenticação
  /api/v1/auth/password/reset:
    post:
      consumes:
      - application/json
      description: Atualiza a senha usando o token de redefinição.
      parameters:
      - description: Token e nova senha
        in: body
        name: payload
        required: true
        schema:
          $ref: '#/definitions/handler.resetPasswordRequest'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/handler.messageResponse'
        "400":
          description: Bad Request
          schema:
            additionalProperties:
              type: string
            type: object
        "401":
          description: Unauthorized
          schema:
            additionalProperties:
              type: string
            type: object
      summary: Redefinir senha
      tags:
      - Autenticação
  /api/v1/auth/refresh-token:
    post:
      consumes:
      - application/json
      description: Gera um novo JWT a partir de um token válido.
      parameters:
      - description: Bearer token
        in: header
        name: Authorization
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/handler.authResponse'
        "401":
          description: Unauthorized
          schema:
            additionalProperties:
              type: string
            type: object
      summary: Atualizar token
      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/auth/register/customer:
    post:
      consumes:
      - application/json
      description: Cria um usuário do tipo cliente 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 cliente
      tags:
      - Autenticação
  /api/v1/auth/register/tenant:
    post:
      consumes:
      - application/json
      description: Cria um usuário do tipo tenant 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 tenant
      tags:
      - Autenticação
  /api/v1/auth/verify-email:
    post:
      consumes:
      - application/json
      description: Marca o email como verificado usando um token JWT.
      parameters:
      - description: Token de verificação
        in: body
        name: payload
        required: true
        schema:
          $ref: '#/definitions/handler.verifyEmailRequest'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/handler.messageResponse'
        "400":
          description: Bad Request
          schema:
            additionalProperties:
              type: string
            type: object
        "401":
          description: Unauthorized
          schema:
            additionalProperties:
              type: string
            type: object
      summary: Verificar email
      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/marketplace/records:
    get:
      parameters:
      - description: Busca textual
        in: query
        name: query
        type: string
      - description: Campo de ordenação (created_at|updated_at)
        in: query
        name: sort_by
        type: string
      - description: Direção (asc|desc)
        in: query
        name: sort_order
        type: string
      - description: Data mínima (RFC3339)
        in: query
        name: created_after
        type: string
      - description: Data máxima (RFC3339)
        in: query
        name: created_before
        type: string
      - description: Página
        in: query
        name: page
        type: integer
      - description: Itens por página
        in: query
        name: page_size
        type: integer
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/domain.ProductPaginationResponse'
      summary: Busca avançada no marketplace
      tags:
      - Marketplace
  /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/products/search:
    get:
      description: Retorna produtos ordenados por validade, com distância aproximada.
        Vendedor anônimo até checkout.
      parameters:
      - description: Termo de busca
        in: query
        name: search
        type: string
      - description: Preço mínimo em centavos
        in: query
        name: min_price
        type: integer
      - description: Preço máximo em centavos
        in: query
        name: max_price
        type: integer
      - description: Distância máxima em km
        in: query
        name: max_distance
        type: number
      - description: Latitude do comprador
        in: query
        name: lat
        required: true
        type: number
      - description: Longitude do comprador
        in: query
        name: lng
        required: true
        type: number
      - description: Página
        in: query
        name: page
        type: integer
      - description: Itens por página
        in: query
        name: page_size
        type: integer
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/domain.ProductSearchPage'
      summary: Busca avançada de produtos com filtros e distância
      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/shipping/calculate:
    post:
      consumes:
      - application/json
      description: Calculates shipping or pickup options based on vendor config and
        buyer location.
      parameters:
      - description: Calculation inputs
        in: body
        name: payload
        required: true
        schema:
          $ref: '#/definitions/handler.shippingCalculateRequest'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: '#/definitions/domain.ShippingOption'
            type: array
        "400":
          description: Bad Request
          schema:
            additionalProperties:
              type: string
            type: object
        "500":
          description: Internal Server Error
          schema:
            additionalProperties:
              type: string
            type: object
      summary: Calculate shipping options
      tags:
      - Shipping
  /api/v1/shipping/settings/{vendor_id}:
    get:
      description: Returns pickup and delivery settings for a vendor.
      parameters:
      - description: Vendor ID
        in: path
        name: vendor_id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: '#/definitions/domain.ShippingMethod'
            type: array
        "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
      summary: Get vendor shipping settings
      tags:
      - Shipping
    put:
      consumes:
      - application/json
      description: Stores pickup and delivery settings for a vendor.
      parameters:
      - description: Vendor ID
        in: path
        name: vendor_id
        required: true
        type: string
      - description: Shipping settings
        in: body
        name: payload
        required: true
        schema:
          $ref: '#/definitions/handler.shippingSettingsRequest'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: '#/definitions/domain.ShippingMethod'
            type: array
        "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
      summary: Update vendor shipping settings
      tags:
      - Shipping
  /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"
