get:
  tags:
    - Statistics
  summary: Get sales statistics
  description: |
    Returns a list of sales statistics for a specified period.
  operationId: statsSales
  parameters:
    - name: period
      in: query
      description: The time period for grouping sales data
      required: false
      schema:
        type: string
        enum: [day, month, quarter, year]
        default: week
    - name: from
      in: query
      description: Start date for the statistics (e.g., 2017-12-31)
      required: false
      schema:
        type: string
        format: date
    - name: to
      in: query
      description: End date for the statistics
      required: false
      schema:
        type: string
        format: date
  responses:
    '200':
      description: Successful operation
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                type: object
                properties:
                  amounts:
                    type: object
                    description: Sales amounts grouped by currency
                    additionalProperties:
                      type: array
                      items:
                        type: object
                        properties:
                          from:
                            type: string
                            format: date
                            description: Start date of the period
                          to:
                            type: string
                            format: date
                            description: End date of the period
                          vendor_share_amount:
                            type: number
                            description: Payout amount as vendor
                          vendor_brutto_amount:
                            type: number
                            description: Gross amount as vendor
                          vendor_netto_amount:
                            type: number
                            description: Net amount as vendor
                          affiliate_share_amount:
                            type: number
                            description: Payout amount as affiliate
                          affiliate_brutto_amount:
                            type: number
                            description: Gross amount as affiliate
                          affiliate_netto_amount:
                            type: number
                            description: Net amount as affiliate
                          other_share_amount:
                            type: number
                            description: Payout amount in other roles
                          other_brutto_amount:
                            type: number
                            description: Gross amount in other roles
                          other_netto_amount:
                            type: number
                            description: Net amount in other roles
                          total_share_amount:
                            type: number
                            description: Total payout amount
                          total_brutto_amount:
                            type: number
                            description: Total gross amount
                          total_netto_amount:
                            type: number
                            description: Total net amount
                  from:
                    type: string
                    format: date
                    description: Overall start date of the statistics
                  to:
                    type: string
                    format: date
                    description: Overall end date of the statistics
                  period:
                    type: string
                    enum: [day, month, quarter, year]
                    description: The time period used for grouping
  security:
    - ApiKeyAuth: []
