openapi: 3.0.3
info:
  title: Repzo API - Rep Balance Summary
  version: 1.0.0
  description: OpenAPI specification for Repzo Rep Balance Summary endpoints.
servers:
  - url: https://sv.api.repzo.me
paths:
  /rep-balance-summary:
    get:
      summary: Find rep balance summaries
      operationId: findRepBalanceSummaries
      parameters:
        - in: query
          name: rep
          required: true
          schema:
            type: string
          description: The rep ID to get balance summary for
        - in: query
          name: page
          schema:
            type: integer
            minimum: 1
            default: 1
          description: Page number for pagination
        - in: query
          name: per_page
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
          description: Number of items per page
        - in: query
          name: disabled
          schema:
            type: boolean
            default: false
          description: Whether to include disabled records
        - in: query
          name: populatedKeys
          schema:
            type: array
            items:
              type: string
          description: Keys to populate in the response
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  total_result:
                    type: integer
                    description: Total number of results
                  current_count:
                    type: integer
                    description: Number of results in current page
                  total_pages:
                    type: integer
                    description: Total number of pages
                  current_page:
                    type: integer
                    description: Current page number
                  per_page:
                    type: integer
                    description: Number of items per page
                  first_page_url:
                    type: string
                    description: URL for first page
                  last_page_url:
                    type: string
                    description: URL for last page
                  next_page_url:
                    type: string
                    nullable: true
                    description: URL for next page
                  prev_page_url:
                    type: string
                    nullable: true
                    description: URL for previous page
                  path:
                    type: string
                    description: Base path for the endpoint
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/RepBalanceSummary"
                  totals:
                    type: object
                    properties:
                      total_balances:
                        type: number
                        description: Sum of all balance summaries
                  options:
                    type: object
                    properties:
                      has_more:
                        type: boolean
                        description: Whether there are more results
                      include_documents_count:
                        type: boolean
                        description: Whether document count is included
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error

components:
  schemas:
    RepBalanceSummary:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the rep balance summary
        rep:
          type: string
          description: Rep ID
        rep_name:
          type: string
          description: Rep name
        total_outstanding_balance_of_invoices_created_by_rep:
          type: number
          description: Total outstanding balance of invoices created by the rep
      required:
        - _id
        - rep
        - rep_name
        - total_outstanding_balance_of_invoices_created_by_rep
