openapi: 3.0.0
info:
  version: 0.1.0
  title: CRM API
  description: API which is used by admin portal, and is partially exposed to public.
  termsOfService: https://wintrado.com/terms
  contact:
    email: tech@wintrado.com
servers:
  - url: http://localhost:3000/api
  - url: https://cashier.staging.wintrado.com/api
tags:
  - name: Activities
  - name: Adapters
  - name: Affiliates
  - name: Affiliate Keys
  - name: Analytics
  - name: Banners
  - name: Bonuses
  - name: Bookmarks
  - name: Calls
  - name: Coins
  - name: Comments
  - name: Commissions
  - name: Communications
  - name: Competitions
  - name: Conversions
  - name: Copytrading
  - name: Countries
  - name: Customers - Affiliate APIs
  - name: Customers - Admin APIs
  - name: Customers
  - name: Customer Field Configurations
  - name: Dashboard
  - name: Documents
  - name: Downtimes
  - name: Emails
  - name: Exchange Rate
  - name: Forgot Password
  - name: Forms
  - name: Group Messages
  - name: Health
  - name: Instruments
  - name: KYC
  - name: Landing Pages
  - name: Leads
  - name: Market Data
  - name: Mass Bonuses
  - name: Messages
  - name: OAuth
  - name: Onboarding Step Configuration
  - name: Orders
  - name: Payment Providers
  - name: Positions
  - name: Push Notifications
  - name: Referrers
  - name: Reports
  - name: Risk
  - name: Sales Desk
  - name: Sales Status
  - name: Settings
  - name: Sessions
  - name: Statements
  - name: Target Groups
  - name: Transactions
  - name: Position Durations
  - name: Max Risks
  - name: Users
  - name: Wallets
  - name: Watchlists
  - name: Withdraw
  - name: Proptrading
paths:
  /api/admin/activity:
    get:
      summary: List all activities
      tags:
        - Activities
      description: Retrieve a list of all activities
      operationId: AdminGetActivities
      parameters:
        - name: limit
          in: query
          schema:
            type: number
          required: true
        - name: offset
          in: query
          schema:
            type: number
          required: true
        - name: filter
          in: query
          schema:
            type: string
        - name: filters
          in: query
          schema:
            $ref: '#/components/schemas/AdminActivitiesFilters'
      responses:
        '200':
          description: A list of activities and the total count
          content:
            application/json:
              schema:
                type: object
                properties:
                  activities:
                    type: array
                    items:
                      $ref: '#/components/schemas/AdminActivity'
                  count:
                    type: number
  /api/activity:
    post:
      summary: Create a new activity
      operationId: CreateActivity
      tags:
        - Activities
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateActivityDTO'
      responses:
        '200':
          description: Activity successfully created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/adapters:
    get:
      summary: Get a list of all adapters
      operationId: GetAdapters
      security:
        - BearerAuth: []
      tags:
        - Adapters
      parameters:
        - name: onlyTradingAdapters
          in: query
          schema:
            type: boolean
          required: true
      responses:
        '200':
          description: A list of adapters
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Adapter'
    post:
      summary: Create a new adapter
      operationId: CreateAdapter
      security:
        - BearerAuth: []
      tags:
        - Adapters
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAdapterDTO'
      responses:
        '200':
          description: Adapter successfully created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/adapters/{name}:
    get:
      summary: Get a specific adapter by its name
      operationId: GetAdapter
      security:
        - BearerAuth: []
      tags:
        - Adapters
      parameters:
        - name: name
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: An adapter
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Adapter'
    put:
      summary: Update a specific adapter by its name
      operationId: UpdateAdapter
      security:
        - BearerAuth: []
      tags:
        - Adapters
      parameters:
        - name: name
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAdapterDTO'
      responses:
        '200':
          description: Adapter successfully updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
    delete:
      summary: Delete a specific adapter by its name
      operationId: DeleteAdapter
      security:
        - BearerAuth: []
      tags:
        - Adapters
      parameters:
        - name: name
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Adapter successfully deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/affiliate/keys:
    post:
      summary: Generate a new affiliate key
      operationId: GenerateAPIKey
      tags:
        - Affiliate Keys
      security:
        - BearerAuth: []
      responses:
        '200':
          description: API key successfully generated
          content:
            application/json:
              schema:
                type: object
                properties:
                  key:
                    type: string
  /api/affiliates/grey_label/logos:
    post:
      summary: Upload grey label logos
      operationId: UploadGreyLabelLogos
      tags:
        - Affiliates
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                rectangularLogo:
                  type: string
                  format: binary
                squareLogo:
                  type: string
                  format: binary
              required:
                - rectangularLogo
                - squareLogo
      responses:
        '200':
          description: Logos successfully uploaded
          content:
            application/json:
              schema:
                type: object
                properties:
                  logos:
                    type: object
                    properties:
                      rectangularLogo:
                        type: string
                      squareLogo:
                        type: string
    get:
      summary: Get grey label logos
      operationId: GetGreyLabelLogos
      tags:
        - Affiliates
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Success - logos object returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  logos:
                    type: object
                    properties:
                      rectangularLogo:
                        type: string
                      squareLogo:
                        type: string
    delete:
      summary: Delete grey label logos
      operationId: DeleteGreyLabelLogos
      tags:
        - Affiliates
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Grey label logos successfully deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/affiliates/grey_label/enabled:
    get:
      summary: Check if grey labeling is enabled
      operationId: GetGreyLabelStatus
      tags:
        - Affiliates
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Returns the availability status of grey labeling feature
          content:
            application/json:
              schema:
                type: object
                properties:
                  enabled:
                    type: boolean
  /api/affiliates/update_refkey:
    post:
      summary: Update the reference key
      operationId: UpdateReferenceKey
      tags:
        - Affiliates
      security:
        - BearerAuth: []
      requestBody:
        content:
          application/json:
            schema:
              properties:
                refKey:
                  type: string
                  minLength: 5
                  maxLength: 20
              required:
                - refKey
      responses:
        '200':
          description: Reference key successfully updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/affiliates/sources:
    get:
      summary: Get sources from referred customers
      operationId: AffiliatesGetSources
      description: Retrieve a list of sources from referred customers
      tags:
        - Affiliates
      security:
        - BearerAuth: []
      responses:
        '200':
          description: A list of sources
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
  /api/affiliates/analytics/downline:
    get:
      summary: Get downline statistics
      operationId: GetAffiliateDownlineStats
      description: Retrieve downline statistics for an affiliate
      tags:
        - Analytics
      security:
        - BearerAuth: []
      responses:
        '200':
          description: A list of downline statistics
          content:
            application/json:
              schema:
                type: object
                properties:
                  stats:
                    type: array
                    items:
                      $ref: '#/components/schemas/AnalyticsDownlineStat'
        '403':
          description: Forbidden, user is not a leader
  /api/admin/analytics/downline:
    get:
      summary: Get downline statistics for admin
      operationId: GetAdminDownlineStats
      description: Retrieve downline statistics for an admin
      tags:
        - Analytics
      security:
        - BearerAuth: []
      responses:
        '200':
          description: A list of downline statistics
          content:
            application/json:
              schema:
                type: object
                properties:
                  stats:
                    type: array
                    items:
                      $ref: '#/components/schemas/IDownlineStats'
        '403':
          description: Forbidden, user does not have the required permissions
  /api/admin/banners:
    get:
      summary: Get all banners
      operationId: GetBanners
      description: Retrieve a list of all banners
      tags:
        - Banners
      security:
        - BearerAuth: []
      responses:
        '200':
          description: A list of banners
          content:
            application/json:
              schema:
                type: object
                properties:
                  banners:
                    type: array
                    items:
                      $ref: '#/components/schemas/Banner'
    post:
      summary: Create a new banner
      operationId: CreateBanner
      tags:
        - Banners
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              properties:
                name:
                  type: string
                startDate:
                  type: string
                  format: date-time
                endDate:
                  type: string
                  format: date-time
                link:
                  type: string
                linkTarget:
                  type: string
                file:
                  type: string
                  format: binary
              required:
                - name
                - startDate
                - endDate
                - file
                - linkTarget
      responses:
        '201':
          description: Banner successfully created
          content:
            application/json:
              schema:
                type: object
                properties:
                  banner:
                    $ref: '#/components/schemas/Banner'
  /api/admin/banners/{id}:
    put:
      summary: Update a banner
      operationId: UpdateBanner
      tags:
        - Banners
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              properties:
                name:
                  type: string
                startDate:
                  type: string
                  format: date-time
                endDate:
                  type: string
                  format: date-time
                link:
                  type: string
                linkTarget:
                  type: string
                file:
                  type: string
                  format: binary
              required:
                - name
                - startDate
                - endDate
                - file
                - linkTarget
      responses:
        '200':
          description: Banner successfully updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  banner:
                    $ref: '#/components/schemas/Banner'
    delete:
      summary: Delete a banner
      operationId: DeleteBanner
      description: Delete a banner by its ID
      tags:
        - Banners
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Banner successfully deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Banner with the provided ID not found
  /api/banners/active:
    get:
      summary: Get the active banner
      operationId: GetActiveBanner
      tags:
        - Banners
      security:
        - BearerAuth: []
      responses:
        '200':
          description: The active banner
          content:
            application/json:
              schema:
                type: object
                properties:
                  banner:
                    $ref: '#/components/schemas/Banner'
        '404':
          description: No active banner found
  /api/banners/file/{token}:
    get:
      summary: Get a banner file
      operationId: GetBannerFile
      description: Retrieve a banner file by its token
      tags:
        - Banners
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: token
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The banner file
          content:
            image/png:
              schema:
                type: string
                format: binary
        '401':
          description: Not authorized
        '404':
          description: Banner file not found
  /api/bonuses:
    get:
      summary: Get all bonuses
      operationId: GetBonuses
      tags:
        - Bonuses
      security:
        - BearerAuth: []
      responses:
        '200':
          description: List of all bonuses
          content:
            application/json:
              schema:
                type: object
                properties:
                  bonuses:
                    type: array
                    items:
                      $ref: '#/components/schemas/Bonus'
    post:
      summary: Create a new bonus
      operationId: CreateBonus
      tags:
        - Bonuses
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBonusDTO'
      responses:
        '201':
          description: Bonus successfully created
          content:
            application/json:
              schema:
                type: object
                properties:
                  bonus:
                    $ref: '#/components/schemas/Bonus'
  /api/bonuses/{id}:
    put:
      summary: Update a bonus
      operationId: UpdateBonus
      tags:
        - Bonuses
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateBonusDTO'
      responses:
        '200':
          description: Bonus successfully updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  bonus:
                    $ref: '#/components/schemas/Bonus'
    delete:
      summary: Delete a bonus
      operationId: DeleteBonus
      tags:
        - Bonuses
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Bonus successfully deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  bonus:
                    $ref: '#/components/schemas/Bonus'
  /api/admin/bookmarks:
    get:
      summary: Get bookmarks for a user
      operationId: GetBookmarks
      tags:
        - Bookmarks
      security:
        - BearerAuth: []
      parameters:
        - in: query
          name: limit
          required: true
          schema:
            type: number
        - in: query
          name: offset
          required: true
          schema:
            type: number
        - in: query
          name: sortBy
          required: true
          schema:
            type: string
        - in: query
          name: search
          required: true
          schema:
            type: string
      responses:
        '200':
          description: List of bookmarks
          content:
            application/json:
              schema:
                type: object
                properties:
                  customers:
                    type: array
                    items:
                      $ref: '#/components/schemas/Customer'
                  pages:
                    type: number
  /api/admin/bookmarks/{id}:
    delete:
      summary: Remove a bookmark
      operationId: RemoveBookmark
      tags:
        - Bookmarks
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Bookmark successfully removed
    post:
      summary: Bookmark a customer
      operationId: BookmarkCustomer
      tags:
        - Bookmarks
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '201':
          description: Customer successfully bookmarked
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/admin/calls/update_variable:
    put:
      summary: Update VoIP URL
      operationId: UpdateVoIPProviderURL
      tags:
        - Calls
      description: Update url for Voiso or Coperato provider
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                variableValue:
                  type: string
                provider:
                  type: string
                  enum:
                    - voiso
                    - coperato
              required:
                - variableValue
                - provider
      responses:
        '200':
          description: Successfully updated variable
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/admin/calls/voip_provider:
    get:
      summary: Get current VoIP provider
      operationId: GetVoIPProvider
      tags:
        - Calls
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Returns the current VoIP provider
          content:
            application/json:
              schema:
                type: object
                properties:
                  provider:
                    type: string
                    enum:
                      - coperato
                      - voiso
                      - null
  /api/admin/calls/update_voip_provider:
    put:
      summary: Update the VoIP provider
      operationId: UpdateVoIPProvider
      tags:
        - Calls
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                provider:
                  type: string
                  enum:
                    - coperato
                    - voiso
              required:
                - provider
      responses:
        '200':
          description: Successfully updated VoIP provider
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/admin/calls/update_api_key:
    put:
      summary: Update API key for Voiso provider
      operationId: UpdatVoIPProviderAPIKey
      tags:
        - Calls
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                variableValue:
                  type: string
                provider:
                  type: string
                  enum:
                    - voiso
              required:
                - variableValue
                - provider
      responses:
        '200':
          description: Successfully updated API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/admin/calls/available:
    get:
      summary: Check if VoIP provider is available
      operationId: CheckVoIPProviderAvailability
      tags:
        - Calls
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Returns availability status and provider
          content:
            application/json:
              schema:
                type: object
                properties:
                  available:
                    type: boolean
                  provider:
                    type: string
                    enum:
                      - voiso
                      - coperato
                      - ''
  /api/admin/calls/request_url:
    get:
      summary: Get request URL for Voiso or Coperato provider
      operationId: GetVoIPProviderRequestURL
      tags:
        - Calls
      security:
        - BearerAuth: []
      parameters:
        - name: provider
          in: query
          required: true
          schema:
            type: string
            enum:
              - voiso
              - coperato
      responses:
        '200':
          description: Returns the request URL
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
  /api/admin/calls/api_key:
    get:
      summary: Get VoIP provider API key
      operationId: GetVoIPProviderAPIKey
      tags:
        - Calls
      security:
        - BearerAuth: []
      parameters:
        - name: provider
          in: query
          required: true
          schema:
            type: string
            enum:
              - voiso
      responses:
        '200':
          description: Returns the API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  apiKey:
                    type: string
  /api/admin/calls/webhook:
    post:
      summary: Handle webhook from Coperato provider
      operationId: CoperatoWebhook
      tags:
        - Calls
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  enum:
                    - RINGING
                    - END
                    - ANSWERED
                duration:
                  type: number
                guid:
                  type: string
                recordingFile:
                  type: string
      responses:
        '200':
          description: Webhook processed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/admin/calls/voiso/webhook:
    post:
      summary: Handle webhook from Voiso provider
      operationId: VoisoWebhook
      tags:
        - Calls
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                disposition:
                  type: string
                  enum:
                    - answered
                    - no_answer
                    - busy
                    - failed
                duration:
                  type: number
                account_id:
                  type: string
      responses:
        '200':
          description: Webhook processed successfully
  /api/admin/calls/configure_call_agent/{id}:
    put:
      summary: Configure call agent for a customer
      operationId: ConfigureVoIPProviderCallAgent
      tags:
        - Calls
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                agentId:
                  type: string
                provider:
                  type: string
                  enum:
                    - voiso
                    - coperato
              required:
                - agentId
                - provider
      responses:
        '200':
          description: Successfully configured call agent
          content:
            application/json:
              schema:
                type: object
                properties:
                  newCustomerAgentMapping:
                    type: object
  /api/admin/calls/customer_agents:
    get:
      summary: Get customers with agents
      operationId: VoIPProviderGetAgents
      tags:
        - Calls
      security:
        - BearerAuth: []
      parameters:
        - name: provider
          in: query
          required: true
          schema:
            type: string
            enum:
              - voiso
              - coperato
        - name: offset
          in: query
          schema:
            type: string
        - name: limit
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Returns customers and pagination details
          content:
            application/json:
              schema:
                type: object
                properties:
                  customers:
                    type: array
                    items:
                      type: object
                  pages:
                    type: number
  /api/admin/calls/{id}:
    post:
      summary: Initiate a call by an agent
      operationId: VoIPProviderInitiateCall
      tags:
        - Calls
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Call initiated successfully
  /api/admin/calls/{id}/lead:
    post:
      summary: Initiate a lead call by an agent
      operationId: VoIPProviderInitiateLeadCall
      tags:
        - Calls
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Lead call initiated successfully
  /api/admin/coins:
    get:
      summary: Get a list of coins transactions
      operationId: GetCoinsTransactions
      tags:
        - Coins
      security:
        - BearerAuth: []
      parameters:
        - name: account
          in: query
          schema:
            type: string
        - name: limit
          in: query
          schema:
            type: number
        - name: offset
          in: query
          schema:
            type: number
        - name: orderBy
          in: query
          schema:
            type: string
        - name: filters
          in: query
          schema:
            type: object
            properties:
              startDate:
                type: string
                format: date
              endDate:
                type: string
                format: date
      responses:
        '200':
          description: List of coins transactions and page count
          content:
            application/json:
              schema:
                type: object
                properties:
                  transactions:
                    type: array
                    items:
                      type: object
                      properties:
                        source:
                          type: string
                        accountId:
                          type: number
                        createdAt:
                          type: string
                          format: date-time
                        amount:
                          type: number
                  pages:
                    type: number
  /api/admin/coins/settings:
    get:
      summary: Get coins settings
      operationId: GetCoinsSettings
      tags:
        - Coins
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Coins settings
          content:
            application/json:
              schema:
                type: object
                properties:
                  coinsEnabled:
                    type: boolean
                  dollarsPerCoin:
                    type: number
    put:
      summary: Update coins settings
      operationId: UpdateCoinsSettings
      tags:
        - Coins
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                coinsEnabled:
                  type: boolean
                dollarsPerCoin:
                  type: number
              required:
                - coinsEnabled
                - dollarsPerCoin
      responses:
        '200':
          description: Successfully updated coins settings
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/coins/exchange_rate:
    get:
      summary: Get the current exchange rate
      operationId: GetCoinsExchangeRate
      tags:
        - Coins
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Current exchange rate
          content:
            application/json:
              schema:
                type: object
                properties:
                  effectiveRate:
                    type: number
                  rate:
                    type: number
                  currency:
                    type: string
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
  /api/coins/exchange:
    post:
      summary: Exchange coins
      operationId: ExchangeCoins
      tags:
        - Coins
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: number
                  enum:
                    - 300
                    - 600
                    - 1200
                    - 2400
                    - 4800
              required:
                - amount
      responses:
        '200':
          description: Exchange successful
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        msg:
                          type: string
                        param:
                          type: string
                        location:
                          type: string
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '503':
          description: Feature unavailable error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
  /api/coins/loyalty_levels:
    get:
      summary: Get loyalty levels
      operationId: GetLoyaltyLevels
      tags:
        - Coins
      security:
        - BearerAuth: []
      responses:
        '200':
          description: List of loyalty levels
          content:
            application/json:
              schema:
                type: object
                properties:
                  loyaltyLevels:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                        leveL:
                          type: number
  /api/admin/commissions:
    post:
      summary: Create a commission model
      operationId: CreateCommissionModel
      tags:
        - Commissions
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrUpdateCommissionModelDTO'
      responses:
        '200':
          description: Successfully created commission model
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
    get:
      summary: Get a list of commission models
      operationId: GetCommissionModels
      tags:
        - Coins
      security:
        - BearerAuth: []
      responses:
        '200':
          description: List of commission models
          content:
            application/json:
              schema:
                type: object
                properties:
                  commissionModels:
                    type: array
                    items:
                      $ref: '#/components/schemas/CommissionModel'
  /api/admin/commissions/{id}:
    delete:
      summary: Delete a commission model
      operationId: DeleteCommissionModel
      tags:
        - Commissions
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: number
      responses:
        '200':
          description: Successfully deleted commission model
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
    put:
      summary: Update a commission model
      operationId: UpdateCommissionModel
      tags:
        - Commissions
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrUpdateCommissionModelDTO'
      responses:
        '200':
          description: Successfully updated commission model
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommissionModel'
  /api/admin/commissions/ledgers:
    get:
      summary: Get a list of commission ledgers
      operationId: GetCommissionLedgers
      tags:
        - Commissions
      security:
        - BearerAuth: []
      parameters:
        - name: limit
          in: query
          schema:
            type: number
          required: true
        - name: offset
          in: query
          schema:
            type: number
          required: true
        - name: orderBy
          in: query
          schema:
            type: string
          required: true
      responses:
        '200':
          description: List of commission ledgers
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CommissionLedger'
  /api/admin/commissions/payouts:
    get:
      summary: Get a list of payout requests
      operationId: GetPayoutRequests
      tags:
        - Commissions
      security:
        - BearerAuth: []
      parameters:
        - name: limit
          in: query
          schema:
            type: number
          required: true
        - name: offset
          in: query
          schema:
            type: number
          required: true
        - name: order
          in: query
          schema:
            type: string
          required: true
        - name: statuses
          in: query
          schema:
            type: array
            items:
              type: string
          required: false
      responses:
        '200':
          description: List of payout requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  payoutRequests:
                    type: array
                    items:
                      $ref: '#/components/schemas/PayoutRequest'
                  count:
                    type: number
  /api/admin/commissions/payouts/{id}/reject:
    patch:
      summary: Reject a payout request
      operationId: RejectPayoutRequest
      tags:
        - Commissions
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RejectPayoutRequestDTO'
      responses:
        '200':
          description: Successfully rejected payout request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayoutRequest'
  /api/admin/commissions/payouts/{id}:
    get:
      summary: Get a payout request
      operationId: GetPayoutRequest
      tags:
        - Commissions
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: number
        - name: limit
          in: query
          schema:
            type: number
        - name: offset
          in: query
          schema:
            type: number
      responses:
        '200':
          description: Payout request details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayoutRequest'
  /api/admin/commissions/payouts/{id}/approve:
    patch:
      summary: Approve a payout request
      operationId: ApprovePayoutRequest
      tags:
        - Commissions
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: number
      responses:
        '200':
          description: Successfully approved payout request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayoutRequest'
  /api/admin/commissions/ledger/{id}:
    patch:
      summary: Update a commission ledger
      operationId: UpdateCommissionLedger
      tags:
        - Commissions
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCommissionLedgerDTO'
      responses:
        '200':
          description: Successfully updated commission ledger
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommissionLedger'
    get:
      summary: Get a commission ledger
      operationId: GetCommissionLedger
      tags:
        - Commissions
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: number
      responses:
        '200':
          description: Commission ledger details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommissionLedger'
  /api/commissions/payouts:
    get:
      summary: Get payout requests
      operationId: GetPayoutRequests
      tags:
        - Commissions
      security:
        - BearerAuth: []
      parameters:
        - in: query
          name: limit
          schema:
            type: number
        - in: query
          name: offset
          schema:
            type: number
        - in: query
          name: order
          schema:
            type: string
            enum:
              - ASC
              - DESC
        - in: query
          name: statuses
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: List of payout requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  payoutRequests:
                    type: array
                    items:
                      $ref: '#/components/schemas/PayoutRequest'
                  count:
                    type: number
  /api/commissions/payouts/has_pending_request:
    get:
      summary: Check if a user has a pending payout request
      operationId: CheckPendingPayoutRequest
      tags:
        - Commissions
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Whether the user has a pending payout request
          content:
            application/json:
              schema:
                type: object
                properties:
                  hasPendingPayoutRequest:
                    type: boolean
  /api/commissions/payouts/{id}:
    get:
      summary: Get a payout request
      operationId: GetPayoutRequest
      tags:
        - Commissions
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: number
        - in: query
          name: limit
          schema:
            type: number
        - in: query
          name: offset
          schema:
            type: number
      responses:
        '200':
          description: Payout request
          content:
            application/json:
              schema:
                type: object
                properties:
                  payoutRequest:
                    $ref: '#/components/schemas/PayoutRequest'
  /api/commissions:
    post:
      summary: Create a payout request
      operationId: CreatePayoutRequest
      tags:
        - Commissions
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                payoutWalletId:
                  type: number
              required:
                - payoutWalletId
      responses:
        '200':
          description: Payout request created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/commissions/ledger:
    get:
      summary: Get commission ledger records
      tags:
        - Commissions
      security:
        - BearerAuth: []
      parameters:
        - in: query
          name: limit
          schema:
            type: number
        - in: query
          name: offset
          schema:
            type: number
        - in: query
          name: order
          schema:
            type: string
            enum:
              - ASC
              - DESC
        - in: query
          name: statuses
          schema:
            type: array
            items:
              type: string
              enum:
                - PENDING
                - PAIDOUT
      responses:
        '200':
          description: Commission ledger records
          content:
            application/json:
              schema:
                type: object
                properties:
                  commissionLedger:
                    type: array
                    items:
                      $ref: '#/components/schemas/CommissionLedger'
  /api/admin/customers/{customerId}/comments:
    get:
      summary: Get comments for a customer
      operationId: GetCustomerComments
      tags:
        - Comments
      security:
        - BearerAuth: []
        - ApiKey: []
      parameters:
        - name: customerId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: List of comments for the customer
          content:
            application/json:
              schema:
                type: object
                properties:
                  comments:
                    type: array
                    items:
                      $ref: '#/components/schemas/Comment'
    post:
      summary: Create a comment for a customer
      operationId: CreateCustomerComment
      tags:
        - Comments
      security:
        - BearerAuth: []
      parameters:
        - name: customerId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCommentDTO'
      responses:
        '200':
          description: Successfully created comment
          content:
            application/json:
              schema:
                type: object
                properties:
                  comment:
                    $ref: '#/components/schemas/Comment'
  /api/admin/communications/{id}:
    get:
      summary: Get customer communications
      operationId: GetCustomerCommunications
      tags:
        - Communications
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
        - in: query
          name: limit
          schema:
            type: number
        - in: query
          name: offset
          schema:
            type: number
      responses:
        '200':
          description: Customer communications
          content:
            application/json:
              schema:
                type: object
                properties:
                  communications:
                    type: array
                    items:
                      $ref: '#/components/schemas/CustomerCommunicationDTO'
                  count:
                    type: number
  /api/competitions:
    get:
      summary: Get a list of competitions
      operationId: GetCompetitions
      tags:
        - Competitions
      security:
        - BearerAuth: []
      parameters:
        - name: search
          in: query
          schema:
            type: string
        - name: limit
          in: query
          schema:
            type: number
        - name: offset
          in: query
          schema:
            type: number
        - name: sortBy
          in: query
          schema:
            type: string
      responses:
        '200':
          description: List of competitions with pagination
          content:
            application/json:
              schema:
                type: object
                properties:
                  competitions:
                    type: array
                    items:
                      $ref: '#/components/schemas/Competition'
                  pages:
                    type: number
    post:
      summary: Create a new competition
      operationId: CreateCompetition
      tags:
        - Competitions
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCompetitionDTO'
      responses:
        '200':
          description: Successfully created competition
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Competition'
  /api/competitions/current:
    get:
      summary: Get the current competition
      operationId: GetCurrentCompetition
      tags:
        - Competitions
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Current competition data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ICurrentCompetition'
  /api/competitions/{id}:
    get:
      summary: Get a specific competition by ID
      operationId: GetCompetition
      tags:
        - Competitions
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Competition details
          content:
            application/json:
              schema:
                type: object
                properties:
                  competition:
                    $ref: '#/components/schemas/Competition'
                  leaderboard:
                    type: array
                    items:
                      $ref: '#/components/schemas/LeaderboardEntry'
    put:
      summary: Update a competition
      operationId: UpdateCompetition
      tags:
        - Competitions
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCompetitionDTO'
      responses:
        '200':
          description: Updated competition data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Competition'
    delete:
      summary: Delete a competition
      operationId: DeleteCompetition
      tags:
        - Competitions
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successfully deleted competition
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/competitions/current/ranks:
    get:
      summary: Get current competition ranks
      operationId: GetCurrentCompetitionRanks
      tags:
        - Competitions
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Current competition ranks
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ranks'
  /api/competitions/current/join:
    post:
      summary: Join the current competition
      operationId: JoinCompetition
      tags:
        - Competitions
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JoinCompetitionDTO'
      responses:
        '200':
          description: Successfully joined competition
          content:
            application/json:
              schema:
                properties:
                  participation:
                    $ref: '#/components/schemas/Participation'
                  competition:
                    $ref: '#/components/schemas/Competition'
                  ranks:
                    type: array
                    items:
                      $ref: '#/components/schemas/Ranks'
  /api/competitions/current/leave:
    post:
      summary: Leave the current competition
      operationId: LeaveCompetition
      tags:
        - Competitions
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Successfully left competition
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Competition'
  /api/competitions/participations/last_nickname:
    get:
      summary: Get the last used nickname in the competition
      operationId: GetLastUsedNickname
      tags:
        - Competitions
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Last used nickname
          content:
            application/json:
              schema:
                type: object
                properties:
                  nickname:
                    type: string
  /api/admin/conversions:
    get:
      summary: List all currency conversions
      operationId: ListConversions
      tags:
        - Conversions
      security:
        - BearerAuth: []
      responses:
        '200':
          description: List of currency conversions
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Conversion'
    post:
      summary: Create a new currency conversion
      operationId: CreateConversion
      tags:
        - Conversions
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConversionDTO'
      responses:
        '201':
          description: Successfully created conversion
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Conversion'
  /api/admin/conversions/{id}:
    get:
      summary: Get a specific currency conversion by ID
      operationId: GetConversion
      tags:
        - Conversions
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Currency conversion details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Conversion'
    put:
      summary: Update a specific currency conversion by ID
      operationId: UpdateConversion
      tags:
        - Conversions
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateConversionDTO'
      responses:
        '200':
          description: Successfully updated conversion
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Conversion'
    delete:
      summary: Delete a specific currency conversion by ID
      operationId: DeleteConversion
      tags:
        - Conversions
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successfully deleted conversion
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/copytrading/strategies:
    get:
      summary: Get all strategies
      operationId: GetStrategies
      tags:
        - Copytrading
      security:
        - BearerAuth: []
      responses:
        '200':
          description: List of strategies
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: number
                  strategies:
                    type: array
                    items:
                      $ref: '#/components/schemas/StrategyDTO'
    post:
      summary: Create a new strategy
      operationId: CreateStrategy
      tags:
        - Copytrading
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateStrategyDTO'
      responses:
        '200':
          description: Successfully created strategy
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StrategyDTO'
  /api/copytrading/strategies/own:
    get:
      summary: Get user's own strategies
      operationId: GetOwnStrategies
      tags:
        - Copytrading
      security:
        - BearerAuth: []
      responses:
        '200':
          description: List of user's own strategies
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: number
                  strategies:
                    type: array
                    items:
                      $ref: '#/components/schemas/StrategyDTO'
  /api/copytrading/strategies/following:
    get:
      summary: Get strategies followed by the user
      operationId: GetFollowingStrategies
      tags:
        - Copytrading
      security:
        - BearerAuth: []
      responses:
        '200':
          description: List of strategies followed by the user
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: number
                  strategies:
                    type: array
                    items:
                      $ref: '#/components/schemas/StrategyDTO'
  /api/copytrading/strategies/{id}:
    get:
      summary: Get a specific strategy by ID
      operationId: GetStrategy
      tags:
        - Copytrading
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Strategy details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StrategyDTO'
    post:
      summary: Follow a specific strategy by ID
      operationId: FollowStrategy
      tags:
        - Copytrading
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FollowStrategyDTO'
      responses:
        '200':
          description: Successfully followed strategy
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: object
                    properties:
                      success:
                        type: boolean
  /api/admin/countries/{id}:
    put:
      summary: Update a country
      operationId: UpdateCountry
      tags:
        - Countries
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                toggle:
                  type: boolean
              required:
                - toggle
      responses:
        '200':
          description: Country updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  country:
                    $ref: '#/components/schemas/Country'
  /api/countries:
    get:
      summary: Get all countries
      operationId: GetCountries
      tags:
        - Countries
      responses:
        '200':
          description: List of countries
          content:
            application/json:
              schema:
                type: object
                properties:
                  countries:
                    type: array
                    items:
                      $ref: '#/components/schemas/Country'
  /api/admin/customer_field_configurations:
    get:
      summary: Get all customer field configurations
      operationId: GetCustomerFieldConfigurations
      tags:
        - Customer Field Configurations
      security:
        - BearerAuth: []
      responses:
        '200':
          description: List of customer field configurations
          content:
            application/json:
              schema:
                type: object
                properties:
                  customerFieldConfigurations:
                    type: array
                    items:
                      $ref: '#/components/schemas/CustomerFieldConfiguration'
    put:
      summary: Update customer field configurations
      operationId: UpdateCustomerFieldConfigurations
      tags:
        - Customer Field Configurations
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                customerFieldConfigurations:
                  type: array
                  items:
                    $ref: '#/components/schemas/CustomerFieldConfiguration'
      responses:
        '200':
          description: Updated customer field configurations
          content:
            application/json:
              schema:
                type: object
                properties:
                  customerFieldConfigurations:
                    type: array
                    items:
                      $ref: '#/components/schemas/CustomerFieldConfiguration'
  /api/admin/customers:
    get:
      summary: Get all customers
      operationId: GetCustomers
      tags:
        - Customers - Admin APIs
      security:
        - ApiKey: []
        - BearerAuth: []
      parameters:
        - name: offset
          in: query
          required: false
          schema:
            type: number
            minimum: 0
        - name: limit
          in: query
          required: false
          schema:
            type: number
            minimum: 0
        - name: search
          in: query
          required: false
          schema:
            type: string
        - name: sortBy
          in: query
          required: false
          schema:
            type: string
        - name: country
          in: query
          required: false
          schema:
            type: string
        - name: group
          in: query
          required: false
          schema:
            type: string
        - name: lastActivityStart
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: lastActivityEnd
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: registrationStart
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: registrationEnd
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: selectedStatuses
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
        - name: selectedKycStatuses
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
        - name: roles
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
        - name: sources
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
        - name: depositCount
          in: query
          required: false
          schema:
            type: string
        - name: salesStatus
          in: query
          required: false
          schema:
            type: string
        - name: activity
          in: query
          required: false
          schema:
            type: string
        - name: positions
          in: query
          required: false
          schema:
            type: string
        - name: introducerId
          in: query
          required: false
          schema:
            type: string
        - name: updatedSince
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: riskStatus
          in: query
          required: false
          schema:
            type: string
        - name: retentionAgents
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
        - name: conversionAgents
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: List of customers
          content:
            application/json:
              schema:
                type: object
                properties:
                  customers:
                    type: array
                    items:
                      $ref: '#/components/schemas/ICustomerDTO'
                  count:
                    type: number
    post:
      summary: Create a new customer
      operationId: CreateCustomer
      tags:
        - Customers - Admin APIs
      security:
        - ApiKey: []
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCustomerDTO'
      responses:
        '200':
          description: Successfully created customer
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/admin/customers/ids:
    get:
      summary: Get customer IDs
      operationId: GetCustomerIds
      tags:
        - Customers - Admin APIs
      security:
        - BearerAuth: []
      responses:
        '200':
          description: List of customer IDs
          content:
            application/json:
              schema:
                type: object
                properties:
                  customersIds:
                    type: array
                    items:
                      type: string
  /api/admin/customers/bulk:
    put:
      summary: Bulk update customers
      operationId: BulkUpdateCustomers
      tags:
        - Customers - Admin APIs
      security:
        - ApiKey: []
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkUpdateCustomerDTO'
      responses:
        '200':
          description: Successfully updated customers
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/admin/customers/{id}:
    get:
      summary: Get a specific customer by ID
      operationId: GetCustomer
      tags:
        - Customers - Admin APIs
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Customer details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ICustomerDTO'
    put:
      summary: Update a specific customer by ID
      operationId: UpdateCustomer
      tags:
        - Customers - Admin APIs
      security:
        - ApiKey: []
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCustomerDTO'
      responses:
        '200':
          description: Successfully updated customer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ICustomerDTO'
  /api/admin/customers/{id}/sendEmail:
    post:
      summary: Send an email to a specific customer by ID
      operationId: SendEmailToCustomer
      tags:
        - Customers - Admin APIs
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendEmailDTO'
      responses:
        '200':
          description: Email sent successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
  /api/affiliates/customers:
    post:
      operationId: AffiliateCreateCustomer
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                properties:
                  redirectUrl:
                    type: string
                  refreshToken:
                    type: string
                  id:
                    type: string
                  success:
                    type: boolean
                  depositUrl:
                    type: string
                    nullable: true
                    description: >-
                      Auto-login URL that redirects to the deposit page on
                      cashier-next
                required:
                  - redirectUrl
                  - refreshToken
                  - id
                  - success
                type: object
      description: >-
        This API enables creation of customers for affiliates via third party
        systems. Password is optional and will be auto-generated if not
        provided. Returns a depositUrl with an embedded auto-login token that
        allows the customer to access the deposit page without manual login.
      tags:
        - Customers - Affiliate APIs
      security:
        - BearerAuth: []
        - ApiKey: []
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AffiliateCreateCustomerDTO'
            example:
              externalId: >-
                Optional - Id in your system as string, which you can later use
                to identify the customer via GET /affiliates/customers endpoint
              firstname: John
              lastname: Doe
              mobilenumber: '+015500475947'
              email: johndoe@gmail.com
              password: JohnDoe500
              wtreferrer: 0BaHeZI1Je
              country: HR
              communicationLanguage: en
              skipOnboardingSteps:
                - SignupDemoForm
                - SignupRealForm
              source: FB
    get:
      operationId: AffiliateGetCustomers
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                properties:
                  pages:
                    type: number
                    format: double
                  customers:
                    items:
                      $ref: '#/components/schemas/IReferredCustomerDTO'
                    type: array
                required:
                  - pages
                  - customers
                type: object
      description: Retrieves all customers that are referred by requesting user
      tags:
        - Customers - Affiliate APIs
      security:
        - BearerAuth: []
        - ApiKey: []
      parameters:
        - description: to limit amount of customers displayed per request
          in: query
          name: limit
          required: true
          schema:
            type: string
        - description: from which record to start listing customers
          in: query
          name: offset
          required: true
          schema:
            type: string
        - description: example name|ASC where name is a column and ASC/DESC is sort order
          in: query
          name: orderBy
          required: true
          schema:
            type: string
        - description: to search by name or account id
          in: query
          name: search
          required: false
          schema:
            type: string
        - description: to search by id in your system
          in: query
          name: externalId
          required: false
          schema:
            type: string
        - description: >-
            show only results that were updated since provided date(E.G.
            2023-09-13)
          in: query
          name: updatedSince
          required: false
          schema:
            type: string
        - description: >-
            show only results that were updated up to provided date(E.G.
            2023-09-13)
          in: query
          name: updatedTo
          required: false
          schema:
            type: string
        - in: query
          name: sources
          required: false
          schema:
            type: array
            items:
              type: string
  /api/affiliates/customers/{id}:
    put:
      operationId: AffiliateUpdateCustomer
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                properties:
                  customer:
                    $ref: '#/components/schemas/IReferredCustomerDTO'
                required:
                  - customer
                type: object
      description: |-
        Updates a referral
        Pass notes in body to add or update notes
      tags:
        - Customers - Affiliate APIs
      security:
        - BearerAuth: []
        - ApiKey: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                source:
                  type: string
                notes:
                  type: string
              type: object
    get:
      operationId: Show
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                properties:
                  customer:
                    $ref: '#/components/schemas/IReferredCustomerWithBookmarkDTO'
                required:
                  - customer
                type: object
      description: Get referral and all it's values
      tags:
        - Customers - Affiliate APIs
      security:
        - BearerAuth: []
        - ApiKey: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
  /api/affiliates/customers/export/count:
    get:
      operationId: CountForExport
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                properties:
                  count:
                    type: number
                    format: double
                required:
                  - count
                type: object
      description: Get count of how many customers there are, used for export
      tags:
        - Customers - Affiliate APIs
      security:
        - BearerAuth: []
        - ApiKey: []
      parameters: []
  /api/affiliates/customers/export/csv:
    get:
      operationId: ExportCSV
      responses:
        '200':
          description: Ok
          content:
            text/csv:
              schema:
                type: string
                format: binary
          headers:
            Content-Disposition:
              description: Indicates that the response is a file attachment
              schema:
                type: string
                example: attachment; filename="referrals-2024-06-18T08:20:00.000Z.csv"
      description: Exports referrals in csv
      tags:
        - Customers - Affiliate APIs
      security:
        - BearerAuth: []
        - ApiKey: []
      parameters: []
  /api/affiliates/customers/wallet:
    get:
      operationId: GetAffiliateWallet
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IWalletWithTransactionsDTO'
      summary: Get affiliate wallet and transactions
      description: >-
        Get the affiliate's wallet balance and all transaction history. This
        includes commission earnings, withdrawals, and other wallet activities.
      tags:
        - Customers - Affiliate APIs
      security:
        - BearerAuth: []
        - ApiKey: []
      parameters: []
  /api/customers/{id}/loyalty:
    get:
      summary: Get customer loyalty level
      operationId: GetCustomerLoyaltyLevel
      tags:
        - Customers
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Customer loyalty level details
          content:
            application/json:
              schema:
                type: object
                properties:
                  currentLevel:
                    type: number
                  currentLevelName:
                    type: string
                  totalCoinsMonth:
                    type: number
                  awardedAt:
                    type: string
                    format: date-time
                  validUntil:
                    type: string
                    format: date-time
                  coinsRequiredToRetain:
                    type: number
                  coinsUntilNextLevel:
                    type: number
                    nullable: true
                  currentLevelRealMoney:
                    type: boolean
  /api/admin/dashboard:
    get:
      summary: Get dashboard data
      operationId: GetAdminDashboardData
      tags:
        - Dashboard
      security:
        - BearerAuth: []
      parameters:
        - in: query
          name: periodStart
          required: true
          schema:
            type: string
            format: date-time
        - in: query
          name: periodEnd
          required: true
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: Dashboard data
          content:
            application/json:
              schema:
                type: object
                properties:
                  totalRegistrations:
                    type: number
                  totalDeposits:
                    type: number
                  totalCoins:
                    type: number
                  totalMessages:
                    type: number
                  totalDownloads:
                    type: number
                  pendingPayouts:
                    type: number
                  registrationsChart:
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                          format: date-time
                        registrations:
                          type: number
                        installations:
                          type: number
                  depositsChart:
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                          format: date-time
                        value:
                          type: number
                  loginsChart:
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                          format: date-time
                        value:
                          type: number
                  tradesPositionsChart:
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                          format: date-time
                        trades:
                          type: number
                        positions:
                          type: number
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
  /api/affiliates/dashboard:
    get:
      summary: Get affiliate dashboard data
      operationId: GetAffiliateDashboardData
      tags:
        - Dashboard
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Affiliate dashboard data
          content:
            application/json:
              schema:
                type: object
                properties:
                  signUpsLastMonth:
                    type: number
                  signupsThisMonth:
                    type: number
                  earningsLastMonth:
                    type: number
                  earningsThisMonth:
                    type: number
                  cpasLastMonth:
                    type: number
                  cpasThisMonth:
                    type: number
                  volumesLastMonth:
                    type: number
                  volumesThisMonth:
                    type: number
                  totalBalance:
                    type: number
                  unpaidBalance:
                    type: number
                  totalLoginsLastMonth:
                    type: number
                  totalLoginsThisMonth:
                    type: number
                  last5SignIns:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                        id:
                          type: string
                        country:
                          type: string
                        lastSignInDate:
                          type: string
                          format: date-time
  /api/admin/documents/file/{token}:
    get:
      summary: Get file by token
      operationId: GetFileByToken
      tags:
        - Documents
      parameters:
        - name: token
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: File content
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
  /api/admin/customers/{id}/documents:
    get:
      summary: Get customer documents
      operationId: GetCustomerDocuments
      tags:
        - Customers - Admin APIs
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: List of customer documents
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/KYCDocument'
    post:
      summary: Upload document for customer
      tags:
        - Customers - Admin APIs
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: userId
          in: query
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        '201':
          description: Document uploaded successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  documents:
                    type: array
                    items:
                      $ref: '#/components/schemas/KYCDocument'
                  customer:
                    $ref: '#/components/schemas/ICustomerDTO'
  /api/documents/upload:
    post:
      summary: Upload document
      operationId: UploadDocument
      tags:
        - Documents
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        '201':
          description: Document uploaded successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Missing upload data
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
      security:
        - BearerAuth: []
  /api/documents/status:
    get:
      summary: Get KYC status
      operationId: GetKYCStatus
      tags:
        - Documents
      responses:
        '200':
          description: KYC status retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
      security:
        - BearerAuth: []
  /api/admin/downtimes:
    get:
      summary: Get list of downtimes
      operationId: GetDowntimes
      tags:
        - Downtimes
      responses:
        '200':
          description: List of downtimes retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: number
                  downtimes:
                    type: array
                    items:
                      type: object
      security:
        - BearerAuth: []
    post:
      summary: Create a new downtime
      operationId: CreateDowntime
      tags:
        - Downtimes
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDowntimeDTO'
      responses:
        '201':
          description: Downtime created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  downtime:
                    type: object
      security:
        - BearerAuth: []
  /api/admin/downtimes/{id}:
    get:
      summary: Get downtime by ID
      operationId: GetDowntimeById
      tags:
        - Downtimes
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: number
      responses:
        '200':
          description: Downtime retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  downtime:
                    type: object
      security:
        - BearerAuth: []
    put:
      summary: Update downtime by ID
      operationId: UpdateDowntimeById
      tags:
        - Downtimes
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDowntimeDTO'
      responses:
        '201':
          description: Downtime updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  downtime:
                    type: object
      security:
        - BearerAuth: []
    delete:
      summary: Delete downtime by ID
      operationId: DeleteDowntimeById
      tags:
        - Downtimes
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: number
      responses:
        '200':
          description: Downtime deleted successfully
      security:
        - BearerAuth: []
  /api/admin/emails:
    get:
      summary: Get emails
      operationId: GetEmails
      tags:
        - Emails
      responses:
        '200':
          description: List of emails retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  emails:
                    type: array
                    items:
                      $ref: '#/components/schemas/EmailDTO'
      security:
        - BearerAuth: []
    post:
      summary: Create email template
      operationId: CreateEmailTemplate
      tags:
        - Emails
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEmailTemplateDTO'
      responses:
        '201':
          description: Email template created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
      security:
        - BearerAuth: []
  /api/admin/emails/triggers:
    get:
      summary: Get email triggers
      operationId: getEmailTriggers
      tags:
        - Emails
      responses:
        '200':
          description: List of triggers retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  triggers:
                    type: array
                    items:
                      type: string
      security:
        - BearerAuth: []
  /api/admin/emails/{id}:
    get:
      summary: Get email template by ID
      operationId: GetEmailTemplateById
      tags:
        - Emails
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Email template retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  email:
                    $ref: '#/components/schemas/EmailDTO'
      security:
        - BearerAuth: []
    put:
      summary: Update email template by ID
      operationId: UpdateEmailTemplateById
      tags:
        - Emails
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateEmailTemplateDTO'
      responses:
        '200':
          description: Email template updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  updatedTemplate:
                    $ref: '#/components/schemas/EmailDTO'
      security:
        - BearerAuth: []
    delete:
      summary: Delete email template by ID
      operationId: DeleteEmailTemplateById
      tags:
        - Emails
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Email template deleted successfully
      security:
        - BearerAuth: []
  /api/admin/emails/{id}/test_email:
    post:
      summary: Send test email
      operationId: SendTestEmail
      tags:
        - Emails
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Test email sent successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
      security:
        - BearerAuth: []
  /api/admin/exchangeRate:
    get:
      summary: Get exchange rate
      operationId: GetExchangeRate
      tags:
        - Exchange Rate
      parameters:
        - name: method
          in: query
          required: true
          schema:
            type: string
          description: The method for currency conversion
        - name: amount
          in: query
          required: true
          schema:
            type: number
          description: The amount to convert
      responses:
        '200':
          description: Exchange rate retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  exchangeRate:
                    type: number
      security:
        - BearerAuth: []
    post:
      summary: Create exchange rate
      operationId: CreateExchangeRate
      tags:
        - Exchange Rate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateExchangeRateDTO'
      responses:
        '200':
          description: Exchange rate created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExchangeRate'
      security:
        - BearerAuth: []
  /api/admin/exchangeRate/rates:
    get:
      summary: Get all exchange rates
      operationId: GetExchangeRates
      tags:
        - Exchange Rate
      responses:
        '200':
          description: List of exchange rates retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ExchangeRate'
      security:
        - BearerAuth: []
  /api/admin/exchangeRate/{id}:
    put:
      summary: Update exchange rate by ID
      operationId: UpdateExchangeRate
      tags:
        - Exchange Rate
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateExchangeRateDTO'
      responses:
        '200':
          description: Exchange rate updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExchangeRate'
      security:
        - BearerAuth: []
  /api/forgot_password:
    post:
      summary: Request password reset
      operationId: ForgotPassword
      tags:
        - Forgot Password
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ForgotPasswordRequest'
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Password reset request successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Invalid request or customer not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/reset_password:
    post:
      summary: Reset customer password
      operationId: ResetPassword
      tags:
        - Forgot Password
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                reset_token:
                  type: string
                password:
                  type: string
                password_confirmation:
                  type: string
              required:
                - reset_token
                - password
                - password_confirmation
      responses:
        '200':
          description: Password reset successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Invalid token or password reset failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - BearerAuth: []
  /api/forms/{step}:
    get:
      summary: Get form attribute configurations for a specific step
      operationId: GetFormAttributeConfigurations
      tags:
        - Forms
      parameters:
        - in: path
          name: step
          required: true
          schema:
            type: string
            enum:
              - SignupDemoForm
              - SignupRealForm
              - CompleteAccountBeforeDepositForm
              - CompleteAccountBeforeWithdrawalForm
              - EmailConfirmation
              - KYC
              - PhoneConfirmation
              - DisclaimerBeforeDeposit
      responses:
        '200':
          description: Form attribute configurations
          content:
            application/json:
              schema:
                type: object
                properties:
                  customerFieldConfigurations:
                    type: array
                    items:
                      $ref: '#/components/schemas/CustomerFieldConfiguration'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      $ref: '#/components/schemas/ValidationError'
  /api/affiliates/group_messages:
    get:
      summary: Get group messages
      operationId: GetGroupMessages
      tags:
        - Group Messages
      responses:
        '200':
          description: Fetches group messages
          content:
            application/json:
              schema:
                type: object
                properties:
                  messages:
                    type: array
                    items:
                      $ref: '#/components/schemas/GroupMessageDTO'
      security:
        - BearerAuth: []
    post:
      summary: Create group message
      operationId: CreateGroupMessage
      tags:
        - Group Messages
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateGroupMessageDTO'
      responses:
        '200':
          description: Group message created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    $ref: '#/components/schemas/GroupMessageDTO'
        '400':
          description: Bad request or creation failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: string
      security:
        - BearerAuth: []
  /api/admin/groups:
    get:
      summary: Get groups
      operationId: GetGroups
      tags:
        - Group Messages
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  groups:
                    type: array
                    items:
                      $ref: '#/components/schemas/GroupWithMarkupsDTO'
      security:
        - BearerAuth: []
    post:
      summary: Create group
      operationId: CreateGroup
      tags:
        - Group Messages
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateGroupDTO'
      responses:
        '200':
          description: Group created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
      security:
        - BearerAuth: []
  /api/admin/groups/{id}:
    get:
      summary: Get group by ID
      operationId: GetGroupById
      tags:
        - Group Messages
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: number
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  group:
                    $ref: '#/components/schemas/GroupWithMarkupsDTO'
        '403':
          description: Forbidden - User does not have permission to view the group
      security:
        - BearerAuth: []
    put:
      summary: Update group by ID
      operationId: UpdateGroupById
      tags:
        - Group Messages
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateGroupDTO'
      responses:
        '200':
          description: Group updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  group:
                    $ref: '#/components/schemas/GroupWithMarkupsDTO'
        '403':
          description: Forbidden - User does not have permission to update the group
      security:
        - BearerAuth: []
    delete:
      summary: Delete group by ID
      operationId: DeleteGroupById
      tags:
        - Group Messages
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: number
      responses:
        '200':
          description: Group deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
      security:
        - BearerAuth: []
  /api/health:
    get:
      summary: Health check
      operationId: HealthCheck
      tags:
        - Health
      responses:
        '200':
          description: Health check response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/admin/instruments:
    get:
      summary: Get instruments
      operationId: GetInstruments
      tags:
        - Instruments
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  instruments:
                    type: array
                    items:
                      $ref: '#/components/schemas/InstrumentDTO'
      security:
        - BearerAuth: []
    post:
      summary: Create instrument
      operationId: CreateInstrument
      tags:
        - Instruments
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInstrumentDTO'
      responses:
        '200':
          description: Instrument created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  instrument:
                    $ref: '#/components/schemas/InstrumentDTO'
      security:
        - BearerAuth: []
  /api/admin/instruments/symbols:
    get:
      summary: Get instrument symbols
      operationId: GetInstrumentSymbols
      tags:
        - Instruments
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  symbols:
                    type: array
                    items:
                      type: string
      security:
        - BearerAuth: []
  /api/admin/instruments/{symbol}:
    get:
      summary: Get instrument by symbol
      operationId: GetInstrumentBySymbol
      tags:
        - Instruments
      parameters:
        - in: path
          name: symbol
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  instrument:
                    $ref: '#/components/schemas/InstrumentDTO'
      security:
        - BearerAuth: []
    put:
      summary: Update instrument by symbol
      operationId: UpdateInstrumentBySymbol
      tags:
        - Instruments
      parameters:
        - in: path
          name: symbol
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInstrumentDTO'
      responses:
        '200':
          description: Instrument updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  instrument:
                    $ref: '#/components/schemas/InstrumentDTO'
      security:
        - BearerAuth: []
    delete:
      summary: Delete instrument by symbol
      operationId: DeleteInstrumentBySymbol
      tags:
        - Instruments
      parameters:
        - in: path
          name: symbol
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Instrument deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
      security:
        - BearerAuth: []
  /api/admin/instruments/sort:
    put:
      summary: Sort instruments
      operationId: SortInstruments
      tags:
        - Instruments
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                additionalProperties:
                  type: number
      responses:
        '200':
          description: Instruments sorted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  instruments:
                    type: array
                    items:
                      $ref: '#/components/schemas/InstrumentDTO'
      security:
        - BearerAuth: []
  /api/admin/instruments/export/xlsx:
    get:
      summary: Export instruments to XLSX
      operationId: ExportInstrumentsToXLSX
      tags:
        - Instruments
      parameters:
        - in: query
          name: token
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation, XLSX file download
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
      security:
        - BearerAuth: []
  /users/instruments:
    get:
      summary: Get user instruments information
      operationId: GetUserInstrumentsInfo
      tags:
        - Instruments
      security:
        - BearerAuth: []
      responses:
        '200':
          description: User instruments information
          content:
            application/json:
              schema:
                type: object
                properties:
                  instruments:
                    $ref: '#/components/schemas/IInstrumentsInfoWithIcons'
  /api/admin/customers/{id}/kyc/approve:
    post:
      summary: Approve KYC for customer
      operationId: ApproveKYC
      tags:
        - Customers - Admin APIs
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: KYC approved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  customer:
                    $ref: '#/components/schemas/ICustomerDTO'
        '404':
          description: Customer not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - BearerAuth: []
  /api/admin/customers/{id}/kyc/revoke:
    post:
      summary: Revoke KYC for customer
      operationId: RevokeKYC
      tags:
        - Customers - Admin APIs
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: KYC revoked successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  customer:
                    $ref: '#/components/schemas/ICustomerDTO'
        '400':
          description: Bad request, customer not found or ID missing
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - BearerAuth: []
  /api/admin/customers/{id}/kyc/reset:
    post:
      summary: Reset KYC for customer
      operationId: ResetKYC
      tags:
        - Customers - Admin APIs
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: KYC reset successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  customer:
                    $ref: '#/components/schemas/ICustomerDTO'
        '400':
          description: Bad request, customer not found or ID missing
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - BearerAuth: []
  /api/kyc/status:
    get:
      summary: Get user's KYC status
      operationId: GetKYCStatus
      tags:
        - KYC
      security:
        - BearerAuth: []
      responses:
        '200':
          description: User's KYC status
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - PENDING
                      - APPROVED
                      - REVOKED
                      - null
  /api/sumsub/token:
    get:
      summary: Get user's SumSub token
      operationId: GetSumSubToken
      tags:
        - KYC
      security:
        - BearerAuth: []
      responses:
        '200':
          description: User's SumSub token
          content:
            application/json:
              schema:
                type: object
                properties:
                  token:
                    type: string
  /api/sumsub/enabled:
    get:
      summary: Get SumSub enabled status
      operationId: GetSumSubEnabledStatus
      tags:
        - KYC
      security:
        - BearerAuth: []
      responses:
        '200':
          description: SumSub enabled status
          content:
            application/json:
              schema:
                type: object
                properties:
                  value:
                    type: boolean
  /api/sumsub/webhook:
    post:
      summary: Handle SumSub webhook
      operationId: HandleSumSubWebhook
      tags:
        - KYC
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                success:
                  type: boolean
      responses:
        '200':
          description: Webhook handled successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Webhook handling failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/affiliates/landing_pages:
    get:
      summary: Get affiliate landing pages
      operationId: GetAffiliateLandingPages
      tags:
        - Landing Pages
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Affiliate landing pages
          content:
            application/json:
              schema:
                type: object
                properties:
                  landing_pages:
                    type: array
                    items:
                      type: object
                      properties:
                        preview:
                          type: string
                        name:
                          type: string
                        url:
                          type: string
                        language:
                          type: string
                          nullable: true
  /api/admin/leads:
    get:
      summary: List leads
      operationId: ListLeads
      tags:
        - Leads
      parameters:
        - in: query
          name: limit
          required: true
          schema:
            type: number
        - in: query
          name: offset
          required: true
          schema:
            type: number
        - in: query
          name: orderBy
          required: true
          schema:
            type: string
        - in: query
          name: filters
          required: true
          schema:
            $ref: '#/components/schemas/FetchLeadFilters'
        - in: query
          name: search
          required: false
          schema:
            type: string
      responses:
        '200':
          description: List of leads
          content:
            application/json:
              schema:
                type: object
                properties:
                  leads:
                    type: array
                    items:
                      $ref: '#/components/schemas/LeadListingDTO'
                  pages:
                    type: number
                  count:
                    type: number
      security:
        - BearerAuth: []
        - ApiKey: []
  /api/admin/leads/sales_people:
    get:
      summary: Get sales people
      operationId: GetLeadsSalesPeople
      tags:
        - Leads
      responses:
        '200':
          description: List of sales people
          content:
            application/json:
              schema:
                type: object
                properties:
                  salesPeople:
                    type: array
                    items:
                      $ref: '#/components/schemas/Customer'
      security:
        - BearerAuth: []
        - ApiKey: []
  /api/admin/leads/check_code:
    get:
      summary: Check signup code
      operationId: CheckSignupCode
      tags:
        - Leads
      parameters:
        - in: query
          name: code
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Signup code details
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
        '400':
          description: Signup code not found or already used
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/leads/sources:
    get:
      summary: Get lead sources
      operationId: GetLeadSources
      tags:
        - Leads
      responses:
        '200':
          description: List of lead sources
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
      security:
        - BearerAuth: []
        - ApiKey: []
  /api/admin/leads/{id}:
    get:
      summary: Get lead by ID
      operationId: GetLeadById
      tags:
        - Leads
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Lead details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetLeadDTO'
        '400':
          description: Lead not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - BearerAuth: []
        - ApiKey: []
  /api/admin/leads/upload:
    post:
      summary: Upload leads from CSV
      operationId: UploadLeadsFromCSV
      tags:
        - Leads
      responses:
        '200':
          description: Leads uploaded successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  saved:
                    type: string
        '400':
          description: Missing upload data or invalid CSV format
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - BearerAuth: []
        - ApiKey: []
  /api/admin/leads/{id}/comment:
    post:
      summary: Create comment on lead
      operationId: CreateComment
      tags:
        - Leads
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCommentDTO'
      responses:
        '200':
          description: Comment created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  comment:
                    type: object
                    properties:
                      id:
                        type: number
                      comment:
                        type: string
                      commentingCustomerId:
                        type: string
                      commentingCustomer:
                        $ref: '#/components/schemas/Customer'
                      createdAt:
                        type: string
                        format: date-time
                      commentedLeadId:
                        type: string
                      commentedLead:
                        $ref: '#/components/schemas/Lead'
        '400':
          description: Lead not found or invalid request body
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - BearerAuth: []
        - ApiKey: []
  /api/admin/leads/{id}/comments:
    get:
      summary: List comments on lead
      operationId: ListComments
      tags:
        - Leads
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: List of comments
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: number
                    comment:
                      type: string
                    commentingCustomer:
                      type: object
                      properties:
                        id:
                          type: string
                        name:
                          type: string
                        avatarUrl:
                          type: string
                    createdAt:
                      type: string
                      format: date-time
      security:
        - BearerAuth: []
        - ApiKey: []
  /api/admin/leads/{id}/communications:
    get:
      summary: List communications related to lead
      operationId: ListCommunications
      tags:
        - Leads
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: List of communications
          content:
            application/json:
              schema:
                type: object
                properties:
                  communications:
                    type: array
                    items:
                      type: object
                      $ref: '#/components/schemas/LeadCommunicationDTO'
      security:
        - BearerAuth: []
        - ApiKey: []
  /api/admin/leads/{id}/claim:
    post:
      summary: Claim lead by ID
      operationId: ClaimLead
      tags:
        - Leads
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Lead claimed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  lead:
                    $ref: '#/components/schemas/Lead'
        '400':
          description: Lead not found or already claimed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - BearerAuth: []
        - ApiKey: []
  /api/admin/leads/bulk:
    put:
      summary: Bulk edit leads
      operationId: BulkEditLeads
      tags:
        - Leads
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkUpdateDTO'
      responses:
        '200':
          description: Leads updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Invalid bulk update request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - BearerAuth: []
        - ApiKey: []
  /api/admin/leads/{id}/assign_sales_person:
    put:
      summary: Assign sales person to lead
      operationId: AssignLeadSalesPerson
      tags:
        - Leads
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateLeadSalesPersonDTO'
      responses:
        '200':
          description: Sales person assigned successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  lead:
                    $ref: '#/components/schemas/Lead'
        '400':
          description: Lead not found or invalid request body
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - BearerAuth: []
        - ApiKey: []
  /api/admin/leads/{id}/email:
    post:
      summary: Send email to lead
      operationId: SendEmailToLead
      tags:
        - Leads
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendEmailDTO'
      responses:
        '200':
          description: Email sent successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '400':
          description: Lead not found, missing email or sender address
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - BearerAuth: []
        - ApiKey: []
  /api/leads:
    post:
      summary: Create a lead
      operationId: CreateLead
      tags:
        - Leads
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ICreateLeadDTO'
      responses:
        '200':
          description: Created lead
          content:
            application/json:
              schema:
                type: object
                properties:
                  lead:
                    $ref: '#/components/schemas/ICreatedLeadDTO'
  /api/market_data/{interval}:
    get:
      summary: Get market data for a given interval
      operationId: GetMarketData
      tags:
        - Market Data
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: interval
          required: true
          schema:
            type: string
          description: The interval for which to get market data
      responses:
        '200':
          description: Market data for the given interval
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    symbol:
                      type: string
                    performance:
                      type: number
  /api/admin/mass_bonuses:
    post:
      summary: Create a mass bonus
      operationId: CreateMassBonus
      tags:
        - Mass Bonuses
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMassBonusDTO'
      responses:
        '200':
          description: Created mass bonus
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: object
                    properties:
                      additionalProperties:
                        type: string
        '422':
          description: Input validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InputValidationError'
  /api/admin/messages:
    post:
      summary: Send a message to specific customers
      operationId: SendMessage
      tags:
        - Messages
      security:
        - BearerAuth: []
        - ApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
                customers:
                  type: array
                  items:
                    type: string
                subject:
                  type: string
              required:
                - message
                - customers
                - subject
      responses:
        '200':
          description: Sent message
          content:
            application/json:
              schema:
                type: object
                properties:
                  messageRecipients:
                    type: number
  /api/admin/messages/all:
    post:
      summary: Send a message to all customers
      operationId: SendMessageToAllCustomers
      tags:
        - Messages
      security:
        - BearerAuth: []
        - ApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
                subject:
                  type: string
      responses:
        '200':
          description: Sent message
          content:
            application/json:
              schema:
                type: object
                properties:
                  messageRecipients:
                    type: number
  /api/affiliates/customers/{customerId}/messages:
    get:
      summary: Get messages for a specific customer
      operationId: GetMessagesForCustomer
      tags:
        - Messages
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: customerId
          required: true
          schema:
            type: string
          description: The ID of the customer
      responses:
        '200':
          description: Messages for the customer
          content:
            application/json:
              schema:
                type: object
                properties:
                  messages:
                    type: array
                    items:
                      $ref: '#/components/schemas/Message'
    post:
      summary: Send a message to a specific customer
      operationId: SendMessageToCustomer
      tags:
        - Messages
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: customerId
          required: true
          schema:
            type: string
          description: The ID of the customer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                subject:
                  type: string
                type:
                  type: string
                  enum:
                    - Message
                    - Push
      responses:
        '200':
          description: Sent message
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    $ref: '#/components/schemas/Message'
        '422':
          description: Input validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      $ref: '#/components/schemas/ValidationError'
  /api/messages/unread_count:
    get:
      summary: Get unread message count
      operationId: GetUnreadMessageCount
      tags:
        - Messages
      responses:
        '200':
          description: Unread message count
          content:
            application/json:
              schema:
                type: object
                properties:
                  unreadCount:
                    type: number
      security:
        - BearerAuth: []
  /api/messages:
    get:
      summary: List messages
      operationId: ListMessages
      tags:
        - Messages
      parameters:
        - in: query
          name: limit
          schema:
            type: string
        - in: query
          name: offset
          schema:
            type: string
      responses:
        '200':
          description: List of messages
          content:
            application/json:
              schema:
                type: object
                properties:
                  messages:
                    type: array
                    items:
                      $ref: '#/components/schemas/Message'
                  pagination:
                    type: object
                    properties:
                      total:
                        type: number
                      limit:
                        type: number
                      offset:
                        type: number
      security:
        - BearerAuth: []
        - ApiKey: []
    parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: number
          default: 10
      - name: offset
        in: query
        required: false
        schema:
          type: number
          default: 0
  /api/messages/{id}:
    get:
      summary: Get message by ID
      operationId: GetMessageById
      tags:
        - Messages
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Message details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
        '404':
          description: Message not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - BearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
  /api/messages/{id}/mark_as_read:
    post:
      summary: Mark message as read
      operationId: MarkMessageAsRead
      tags:
        - Messages
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Message marked as read successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '404':
          description: Message not found or already marked as read
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - BearerAuth: []
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
  /api/oauth/authorize:
    get:
      summary: Redirect to Cashier for authorization
      operationId: OAuthAuthorize
      tags:
        - OAuth
      parameters:
        - in: query
          name: client_id
          schema:
            type: string
        - in: query
          name: redirect_uri
          schema:
            type: string
        - in: query
          name: response_type
          schema:
            type: string
        - in: query
          name: scope
          schema:
            type: string
        - in: query
          name: state
          schema:
            type: string
      responses:
        '302':
          description: Redirect to Cashier
          headers:
            Location:
              schema:
                type: string
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/oauth/token:
    post:
      summary: Request access token
      operationId: OAuthRequestToken
      tags:
        - OAuth
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                client_id:
                  type: string
                client_secret:
                  type: string
                grant_type:
                  type: string
                  enum:
                    - authorization_code
                    - refresh_token
                code:
                  type: string
                refresh_token:
                  type: string
                redirect_uri:
                  type: string
      responses:
        '200':
          description: Token response
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                  token_type:
                    type: string
                  expires_in:
                    type: number
                  refresh_token:
                    type: string
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/oauth/logout:
    post:
      summary: Logout and redirect
      operationId: OAuthLogout
      tags:
        - OAuth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                refreshToken:
                  type: string
                redirectUri:
                  type: string
      responses:
        '200':
          description: Logout successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  redirectUri:
                    type: string
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/onboarding_step_configuration:
    get:
      summary: Get all onboarding step configurations
      operationId: GetOnboardingStepConfigurations
      tags:
        - Onboarding Step Configuration
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  configurations:
                    type: array
                    items:
                      $ref: '#/components/schemas/OnboardingStepConfiguration'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/onboarding_step_configuration/stages:
    get:
      summary: Get all onboarding stages
      operationId: GetOnboardingStages
      tags:
        - Onboarding Step Configuration
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  stages:
                    type: array
                    items:
                      type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/onboarding_step_configuration/{step}:
    put:
      summary: Update onboarding step configuration
      operationId: UpdateOnboardingStepConfiguration
      tags:
        - Onboarding Step Configuration
      parameters:
        - in: path
          name: step
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                stage:
                  type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/users/self/onboarding_steps/{stage}/pending:
    get:
      summary: >-
        Get pending onboarding steps for the authenticated user for a specific
        stage
      operationId: GetPendingOnboardingSteps
      tags:
        - Onboarding Step Configuration
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: stage
          required: true
          schema:
            type: string
            enum:
              - SignUp
              - BeforeSignIn
              - BeforeDeposit
              - BeforeWithdrawal
          description: The stage of the onboarding process
      responses:
        '200':
          description: Pending onboarding steps
          content:
            application/json:
              schema:
                type: object
                properties:
                  steps:
                    type: array
                    items:
                      $ref: '#/components/schemas/OnboardingStepConfiguration'
        '422':
          description: Input validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      $ref: '#/components/schemas/ValidationError'
  /api/admin/orders:
    get:
      summary: Get orders
      operationId: GetOrders
      tags:
        - Orders
      parameters:
        - in: query
          name: limit
          schema:
            type: number
          description: Number of items to return (default is 10)
        - in: query
          name: offset
          schema:
            type: number
          description: Number of items to skip (default is 0)
        - in: query
          name: search
          schema:
            type: string
          description: Search keyword
        - in: query
          name: statuses
          schema:
            type: array
            items:
              type: string
          description: Filter by order statuses
        - in: query
          name: types
          schema:
            type: array
            items:
              type: string
          description: Filter by order types
        - in: query
          name: accountId
          schema:
            type: string
          description: Filter by account ID
        - in: query
          name: symbols
          schema:
            type: array
            items:
              type: string
          description: Filter by symbols
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  orders:
                    type: array
                    items:
                      $ref: '#/components/schemas/IOrderWithIcon'
                  count:
                    type: number
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/orders/{id}:
    get:
      summary: Get order by ID
      operationId: GetOrderById
      tags:
        - Orders
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  order:
                    $ref: '#/components/schemas/IOrder'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '404':
          description: Order not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    patch:
      summary: Update order by ID
      operationId: UpdateOrderById
      tags:
        - Orders
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateOrderDTO'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  order:
                    $ref: '#/components/schemas/IOrder'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    delete:
      summary: Cancel order by ID
      operationId: CancelOrderById
      tags:
        - Orders
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/orders/export/xlsx:
    get:
      summary: Export orders to XLSX format
      operationId: ExportOrdersToXLSX
      tags:
        - Orders
      parameters:
        - in: query
          name: token
          schema:
            type: string
          description: BearerAuth token for authorization
        - in: query
          name: search
          schema:
            type: string
          description: Search keyword
        - in: query
          name: statuses
          schema:
            type: array
            items:
              type: string
          description: Filter by order statuses
        - in: query
          name: types
          schema:
            type: array
            items:
              type: string
          description: Filter by order types
        - in: query
          name: accountId
          schema:
            type: string
          description: Filter by account ID
      responses:
        '200':
          description: Successful response with XLSX attachment
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/payment/available_methods:
    get:
      summary: Get available payment methods for the authenticated user
      operationId: GetAvailablePaymentMethods
      tags:
        - Payment Providers
      security:
        - BearerAuth: []
      parameters:
        - in: query
          name: type
          schema:
            type: string
            enum:
              - withdrawal
              - deposit
          description: The type of transaction
      responses:
        '200':
          description: Available payment methods
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IPaymentMethodSpec'
  /api/payment/demo_top_up:
    get:
      summary: Top up demo wallet with a specific amount
      operationId: TopUpDemoAccount
      tags:
        - Payment Providers
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IDemoTopUpRequest'
      responses:
        '200':
          description: Wallet has been topped up successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IDemoTopUpResponse'
  /api/admin/payment_providers:
    get:
      summary: Get payment providers
      operationId: GetPaymentProviders
      tags:
        - Payment Providers
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  providers:
                    type: array
                    items:
                      $ref: '#/components/schemas/PaymentProviderDTO'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/payment_providers/filters:
    get:
      summary: Get payment provider filters
      operationId: GetPaymentProviderFilters
      tags:
        - Payment Providers
      parameters:
        - in: query
          name: type
          schema:
            type: string
          description: Type of payment methods (withdrawal or deposit)
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  methods:
                    type: array
                    items:
                      type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/payment_providers/{id}:
    get:
      summary: Get payment provider by ID
      operationId: GetPaymentProviderById
      tags:
        - Payment Providers
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  provider:
                    $ref: '#/components/schemas/PaymentProviderDTO'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '404':
          description: Payment provider not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    put:
      summary: Update payment provider by ID
      operationId: UpdatePaymentProviderById
      tags:
        - Payment Providers
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePaymentProviderDTO'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  provider:
                    $ref: '#/components/schemas/PaymentProviderDTO'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/payment_providers/sort:
    put:
      summary: Sort payment providers
      operationId: SortPaymentProviders
      tags:
        - Payment Providers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SortPaymentProvidersDTO'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  providers:
                    type: array
                    items:
                      $ref: '#/components/schemas/PaymentProviderDTO'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/positions:
    get:
      summary: Get positions
      operationId: GetPositions
      tags:
        - Positions
      parameters:
        - in: query
          name: search
          schema:
            type: string
          description: Search query string
        - in: query
          name: limit
          schema:
            type: number
          description: Maximum number of positions to return
        - in: query
          name: offset
          schema:
            type: number
          description: Offset for pagination
        - in: query
          name: filters
          schema:
            $ref: '#/components/schemas/IPositionFilters'
        - in: query
          name: sortBy
          schema:
            type: string
          description: Field to sort positions by
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  positions:
                    type: array
                    items:
                      $ref: '#/components/schemas/PositionDTO'
                  count:
                    type: number
                  pages:
                    type: number
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/positions/{id}:
    get:
      summary: Get position by ID
      operationId: GetPositionById
      tags:
        - Positions
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PositionDTO'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    delete:
      summary: Close position by ID
      operationId: ClosePositionById
      tags:
        - Positions
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PositionDTO'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    patch:
      summary: Update position by ID
      operationId: UpdatePositionById
      tags:
        - Positions
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePositionDTO'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PositionDTO'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    post:
      summary: Create position
      operationId: CreatePosition
      tags:
        - Positions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePositionDTO'
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PositionDTO'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/positions/{id}/orders:
    get:
      summary: Get orders for position by Id
      operationId: GetOrdersForPositionById
      tags:
        - Positions
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/IOrder'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/positions/accounts/{id}/positions:
    get:
      summary: Get positions by account ID
      operationId: GetPositionsByAccountId
      tags:
        - Positions
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
        - in: query
          name: offset
          schema:
            type: number
          description: Offset for pagination
        - in: query
          name: limit
          schema:
            type: number
          description: Maximum number of positions to return
        - in: query
          name: status
          schema:
            type: string
          description: Filter by position status
        - in: query
          name: orderBy
          schema:
            type: string
          description: Field to order positions by
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  positions:
                    type: array
                    items:
                      $ref: '#/components/schemas/PositionDTO'
                  count:
                    type: number
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/positions/export/xlsx:
    get:
      summary: Export positions to XLSX
      operationId: ExportPositionsToXLSX
      tags:
        - Positions
      parameters:
        - in: query
          name: token
          schema:
            type: string
          description: JWT token for authorization
        - in: query
          name: search
          schema:
            type: string
          description: Search query string
        - in: query
          name: filters
          schema:
            $ref: '#/components/schemas/IPositionFilters'
      responses:
        '200':
          description: Successful response
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/push_notifications/vapid_key:
    get:
      summary: Get VAPID public key
      operationId: GetVapidKey
      tags:
        - Push Notifications
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  publicVapidKey:
                    type: string
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/push_notifications/subscriptions:
    post:
      summary: Create subscription
      operationId: CreateSubscription
      tags:
        - Push Notifications
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                subscription:
                  type: object
                  properties:
                    endpoint:
                      type: string
                      description: URL of the push notification endpoint
                    keys:
                      type: object
                      properties:
                        p256dh:
                          type: string
                          description: Public key for encryption
                        auth:
                          type: string
                          description: Authentication secret
                    topic:
                      type: string
                      description: Subscription topic (Admin, User, etc.)
                topic:
                  type: string
                  description: Topic for the subscription (Admin, User, etc.)
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PushNotificationSubscriptionDTO'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    delete:
      summary: Delete subscription
      operationId: DeleteSubscription
      tags:
        - Push Notifications
      parameters:
        - in: query
          name: id
          schema:
            type: number
          description: ID of the subscription to delete
        - in: query
          name: endpoint
          schema:
            type: string
          description: URL of the push notification endpoint to delete
        - in: query
          name: topic
          schema:
            type: string
          description: Topic of subscriptions to delete
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    get:
      summary: Get subscriptions
      operationId: GetSubscriptions
      tags:
        - Push Notifications
      parameters:
        - in: query
          name: topic
          schema:
            type: string
          description: Topic of subscriptions to retrieve
        - in: query
          name: endpoint
          schema:
            type: string
          description: URL of the push notification endpoint to retrieve
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  subscriptions:
                    type: array
                    items:
                      $ref: '#/components/schemas/PushNotificationSubscriptionDTO'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/push_notifications/notify:
    post:
      summary: Send notification by customer ID and topic
      operationId: SendNotification
      tags:
        - Push Notifications
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                customerId:
                  type: string
                  description: ID of the customer to send notification to
                notification:
                  type: object
                  description: Notification payload
                  properties:
                    title:
                      type: string
                      description: Title of the notification
                    body:
                      type: string
                      description: Body of the notification
                    url:
                      type: string
                      description: URL to open when notification is clicked
                topic:
                  type: string
                  description: Topic of the notification (Admin, User, etc.)
                ttl:
                  type: number
                  description: Time to live (TTL) for the notification
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/referrers/grey_label/logos:
    get:
      summary: Get custom logos for the authenticated user's referrer
      operationId: GetCustomLogosForReferrer
      tags:
        - Referrers
      security:
        - BearerAuth: []
      parameters:
        - in: query
          name: wtreferrer
          schema:
            type: string
          description: The referrer key
      responses:
        '200':
          description: Custom logos for the referrer
          content:
            application/json:
              schema:
                type: object
                properties:
                  logos:
                    type: object
                    properties:
                      squareLogo:
                        type: string
                      rectangularLogo:
                        type: string
                    nullable: true
  /api/admin/reports/profitloss:
    get:
      summary: Get profit loss report
      operationId: GetProfitLossReport
      tags:
        - Reports
      parameters:
        - in: query
          name: limit
          schema:
            type: number
          description: Maximum number of records to retrieve
          required: true
        - in: query
          name: offset
          schema:
            type: number
          description: Number of records to skip
          required: true
        - in: query
          name: sortBy
          schema:
            type: string
          description: Column name to sort by
          required: true
        - in: query
          name: start
          schema:
            type: string
            format: date-time
          required: true
          description: Start of date range
        - in: query
          name: end
          schema:
            type: string
            format: date-time
          required: true
          description: End of date range
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  report:
                    type: array
                    items:
                      $ref: '#/components/schemas/ReportEntry'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/reports/balance:
    get:
      summary: Get balance report
      operationId: GetBalanceReport
      tags:
        - Reports
      parameters:
        - in: query
          name: limit
          schema:
            type: number
          description: Maximum number of records to retrieve
        - in: query
          name: offset
          schema:
            type: number
          description: Number of records to skip
        - in: query
          name: sortBy
          schema:
            type: string
          description: Column name to sort by
        - in: query
          name: start
          schema:
            type: string
            format: date-time
          required: true
          description: Start of date range
        - in: query
          name: end
          schema:
            type: string
            format: date-time
          required: true
          description: End of date range
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  report:
                    type: array
                    items:
                      $ref: '#/components/schemas/ReportEntry'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/reports/coins:
    get:
      summary: Get coins report
      operationId: GetCoinsReport
      tags:
        - Reports
      parameters:
        - in: query
          name: limit
          schema:
            type: number
          description: Maximum number of records to retrieve
        - in: query
          name: offset
          schema:
            type: number
          description: Number of records to skip
        - in: query
          name: sortBy
          schema:
            type: string
          description: Column name to sort by
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  report:
                    type: object
                    properties:
                      count:
                        type: number
                      rows:
                        type: array
                        items:
                          type: object
                          properties:
                            accountId:
                              type: string
                            name:
                              type: string
                            id:
                              type: string
                            balance:
                              type: number
                            totalEarnedFromTrades:
                              type: number
                            totalCreditedToAffiliate:
                              type: number
                            updatedAt:
                              type: string
                              format: date-time
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/reports/export/xlsx:
    get:
      summary: Export report to XLSX
      operationId: ExportReportToXLSX
      tags:
        - Reports
      parameters:
        - in: query
          name: token
          schema:
            type: string
          description: JWT token for authorization
          required: true
        - in: query
          name: type
          schema:
            type: string
            enum:
              - profitloss
              - balance
              - coins
              - affiliation
          description: Type of report to export
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/risk/stats:
    get:
      summary: Get risk statistics for the authenticated admin user
      operationId: GetRiskStatistics
      tags:
        - Risk
      security:
        - BearerAuth: []
      parameters:
        - in: query
          name: group
          schema:
            type: string
          description: The group to get risk statistics for
        - in: query
          name: isDemo
          schema:
            type: boolean
          description: Whether the request is for a demo
      responses:
        '200':
          description: Risk statistics
          content:
            application/json:
              schema:
                type: object
                properties:
                  baseStats:
                    type: object
                    properties:
                      openLots:
                        type: number
                      totalProfitLossThisDay:
                        type: number
                      totalProfitLossThisWeek:
                        type: number
                      totalProfitLossLastWeek:
                        type: number
                  trendingInstruments:
                    type: array
                    items:
                      type: object
                      properties:
                        symbol:
                          type: string
                        sumVolumeTraded:
                          type: number
                  profitLossByMonth:
                    type: array
                    items:
                      type: object
                      properties:
                        month:
                          type: string
                        profitLoss:
                          type: number
                  sumProfitLoss:
                    type: number
                  lotsPerInstrument:
                    type: array
                    items:
                      type: object
                      properties:
                        symbol:
                          type: string
                        lots:
                          type: number
  /api/admin/risk/exposures:
    get:
      summary: Get risk exposures for the authenticated admin user
      operationId: GetRiskExposures
      tags:
        - Risk
      security:
        - BearerAuth: []
      parameters:
        - in: query
          name: group
          schema:
            type: string
          description: The group to get risk exposures for
        - in: query
          name: isDemo
          schema:
            type: boolean
          description: Whether the request is for a demo
      responses:
        '200':
          description: Risk exposures
          content:
            application/json:
              schema:
                type: object
                properties:
                  exposures:
                    type: array
                    items:
                      type: object
                      properties:
                        symbol:
                          type: string
                        exposure:
                          type: number
  /api/admin/salesDesk/create:
    post:
      summary: Create a new sales desk
      operationId: CreateSalesDesk
      tags:
        - Sales Desk
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSalesDeskDTO'
      responses:
        '201':
          description: Successful creation response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SalesDesk'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/salesDesk/{id}:
    put:
      summary: Update an existing sales desk
      operationId: UpdateSalesDesk
      tags:
        - Sales Desk
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          description: ID of the sales desk to update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSalesDeskDTO'
      responses:
        '200':
          description: Successful update response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SalesDesk'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    get:
      summary: Get a sales desk by ID
      operationId: GetSalesDeskById
      tags:
        - Sales Desk
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          description: ID of the sales desk to retrieve
      responses:
        '200':
          description: Successful retrieval response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SalesDesk'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    delete:
      summary: Delete a sales desk by ID
      operationId: deleteSalesDeskById
      tags:
        - Sales Desk
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          description: ID of the sales desk to delete
      responses:
        '200':
          description: Successful deletion response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/salesDesk/list:
    get:
      summary: List all sales desks
      operationId: ListSalesDesks
      tags:
        - Sales Desk
      parameters:
        - in: query
          name: limit
          schema:
            type: number
          description: Maximum number of sales desks to retrieve
        - in: query
          name: offset
          schema:
            type: number
          description: Number of sales desks to skip
      responses:
        '200':
          description: Successful retrieval response
          content:
            application/json:
              schema:
                type: object
                properties:
                  salesDesks:
                    type: array
                    items:
                      $ref: '#/components/schemas/SalesDesk'
                  pages:
                    type: number
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/sales_status:
    post:
      summary: Create a new sales status
      operationId: CreateSalesStatus
      tags:
        - Sales Status
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSalesStatusDTO'
      responses:
        '200':
          description: Successful creation response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SalesStatus'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    get:
      summary: Get all sales statuses
      operationId: GetSalesStatuses
      tags:
        - Sales Status
      responses:
        '200':
          description: Successful retrieval response
          content:
            application/json:
              schema:
                type: object
                properties:
                  statuses:
                    type: array
                    items:
                      $ref: '#/components/schemas/SalesStatus'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/sales_status/{name}:
    get:
      summary: Get a sales status by name
      operationId: GetSalesStatusByName
      tags:
        - Sales Status
      parameters:
        - in: path
          name: name
          required: true
          schema:
            type: string
          description: Name of the sales status to retrieve
      responses:
        '200':
          description: Successful retrieval response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SalesStatus'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    put:
      summary: Update a sales status by ID
      operationId: UpdateSalesStatus
      tags:
        - Sales Status
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: number
          description: ID of the sales status to update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSalesStatusDTO'
      responses:
        '200':
          description: Successful update response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SalesStatus'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/sessions:
    post:
      summary: Create a new session
      operationId: CreateSession
      tags:
        - Sessions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSessionDTO'
      responses:
        '201':
          description: Successful session creation response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionDTO'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      reason:
                        type: string
                      message:
                        type: string
  /api/sessions/impersonate:
    post:
      summary: Impersonate a customer
      operationId: ImpersonateCustomer
      tags:
        - Sessions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                customerId:
                  type: string
              required:
                - customerId
      responses:
        '201':
          description: Successful impersonation response
          content:
            application/json:
              schema:
                type: object
                properties:
                  token:
                    type: string
                  user:
                    $ref: '#/components/schemas/IUserDTO'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      reason:
                        type: string
                      message:
                        type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      reason:
                        type: string
                      message:
                        type: string
  /api/admin/settings/keys/{key}:
    get:
      summary: Get setting value by key
      operationId: GetSettingByKey
      tags:
        - Settings
      parameters:
        - in: path
          name: key
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  value:
                    type: string
    put:
      summary: Update setting value by key
      operationId: UpdateSettingByKey
      tags:
        - Settings
      parameters:
        - in: path
          name: key
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                val:
                  type: string
              required:
                - val
      responses:
        '200':
          description: Successful update response
          content:
            application/json:
              schema:
                type: object
                properties:
                  value:
                    type: string
  /api/admin/settings/voip/coperato:
    put:
      summary: Set Coperato as VOIP provider
      operationId: SetCoperatoAsVoipProvider
      tags:
        - Settings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
              required:
                - url
      responses:
        '200':
          description: Successful response
        '403':
          description: Forbidden
  /api/admin/settings/voip/voiso:
    put:
      summary: Set Voiso as VOIP provider
      operationId: SetVoisoAsVoipProvider
      tags:
        - Settings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                apiKey:
                  type: string
              required:
                - url
                - apiKey
      responses:
        '200':
          description: Successful response
        '403':
          description: Forbidden
  /api/admin/settings/email/sendgrid:
    put:
      summary: Set Sendgrid as email provider
      operationId: SetSendgridAsEmailProvider
      tags:
        - Settings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                sender:
                  type: string
                apiKey:
                  type: string
                staffEmail:
                  type: string
              required:
                - sender
                - apiKey
                - staffEmail
      responses:
        '200':
          description: Successful response
        '403':
          description: Forbidden
  /api/admin/settings/email/mailgun:
    put:
      summary: Set Mailgun as email provider
      operationId: SetMailgunAsEmailProvider
      tags:
        - Settings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                sender:
                  type: string
                apiKey:
                  type: string
                domain:
                  type: string
                username:
                  type: string
                staffEmail:
                  type: string
              required:
                - sender
                - apiKey
                - domain
                - username
                - staffEmail
      responses:
        '200':
          description: Successful response
        '403':
          description: Forbidden
  /api/admin/settings/email/smtp_provider:
    put:
      summary: Set SMTP provider for email
      operationId: SetSmtpProviderForEmail
      tags:
        - Settings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                host:
                  type: string
                sender:
                  type: string
                port:
                  type: number
                username:
                  type: string
                password:
                  type: string
                secure:
                  type: boolean
                staffEmail:
                  type: string
              required:
                - host
                - sender
                - port
                - username
                - password
                - secure
                - staffEmail
      responses:
        '200':
          description: Successful response
        '403':
          description: Forbidden
  /api/admin/settings/email/brevo:
    put:
      summary: Set Brevo as email provider
      operationId: SetBrevoAsEmailProvider
      tags:
        - Settings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                apiKey:
                  type: string
                sender:
                  type: string
                staffEmail:
                  type: string
              required:
                - apiKey
                - sender
                - staffEmail
      responses:
        '200':
          description: Successful response
        '403':
          description: Forbidden
  /api/admin/settings/recaptcha:
    put:
      summary: Update reCAPTCHA settings
      operationId: UpdateRecaptchaSettings
      tags:
        - Settings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                siteKey:
                  type: string
                secret:
                  type: string
                score:
                  type: number
              required:
                - siteKey
                - secret
                - score
      responses:
        '200':
          description: Successful response
        '403':
          description: Forbidden
  /api/admin/settings/sumsub:
    put:
      summary: Configure SumSub for KYC verification
      operationId: ConfigureSumSub
      tags:
        - Settings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                apiUrl:
                  type: string
                secretKey:
                  type: string
                appToken:
                  type: string
                levelName:
                  type: string
                webhookSecretKey:
                  type: string
              required:
                - apiUrl
                - secretKey
                - appToken
                - levelName
                - webhookSecretKey
      responses:
        '200':
          description: Successful response
        '403':
          description: Forbidden
  /api/admin/settings/wallet_configuration:
    put:
      summary: Configure default wallet platform and group
      operationId: ConfigureWalletPlatformAndGroup
      tags:
        - Settings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                platform:
                  type: string
                group:
                  type: string
              required:
                - platform
                - group
      responses:
        '200':
          description: Successful response
        '400':
          description: Bad request
        '403':
          description: Forbidden
  /api/settings/captcha_site_key:
    get:
      summary: Get the CAPTCHA site key
      operationId: GetCaptchaSiteKey
      tags:
        - Settings
      responses:
        '200':
          description: CAPTCHA site key
          content:
            application/json:
              schema:
                type: object
                properties:
                  value:
                    type: string
                    description: The CAPTCHA site key
  /api/statement:
    get:
      summary: Get user statement records
      operationId: GetStatementRecords
      tags:
        - Statements
      parameters:
        - in: query
          name: start
          required: true
          schema:
            type: string
            format: date-time
          description: Start date for the statement records
        - in: query
          name: end
          required: true
          schema:
            type: string
            format: date-time
          description: End date for the statement records
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  statementRecords:
                    type: array
                    items:
                      $ref: '#/components/schemas/IStatementRecord'
                  count:
                    type: number
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/statement/export/xlsx:
    get:
      summary: Export user statement records as XLSX
      operationId: ExportStatementRecords
      tags:
        - Statements
      parameters:
        - in: query
          name: start
          required: true
          schema:
            type: string
            format: date-time
          description: Start date for the statement records
        - in: query
          name: end
          required: true
          schema:
            type: string
            format: date-time
          description: End date for the statement records
      responses:
        '200':
          description: Successful export response
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request - No results found
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/affiliates/target_groups:
    get:
      summary: Get target groups for the authenticated affiliate user
      operationId: GetTargetGroups
      tags:
        - Target Groups
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Target groups
          content:
            application/json:
              schema:
                type: object
                properties:
                  targetGroups:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: The ID of the target group
                        name:
                          type: string
                          description: The name of the target group
                        noRecipients:
                          type: number
                          description: The number of recipients in the target group
  /api/admin/position_durations:
    get:
      summary: Get trading position durations
      operationId: GetPositionDurations
      tags:
        - Position Durations
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  positionDurations:
                    type: array
                    items:
                      type: string
                  defaultValue:
                    type: string
                    format: date-time
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
    put:
      summary: Update trading position durations
      operationId: UpdatePositionDurations
      tags:
        - Position Durations
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePeriodDTO'
      responses:
        '200':
          description: Successful update response
          content:
            application/json:
              schema:
                type: object
                properties:
                  positionDurations:
                    type: array
                    items:
                      type: string
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/max_risks:
    get:
      summary: Get maximum risk configurations
      operationId: GetMaxRisks
      tags:
        - Max Risks
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  maxRisks:
                    type: array
                    items:
                      type: object
                      properties:
                        maxRisks:
                          type: array
                          items:
                            type: string
                        defaultValue:
                          type: string
                  defaultValue:
                    type: number
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
    put:
      summary: Update maximum risk configurations
      operationId: UpdateMaxRisks
      tags:
        - Max Risks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMaxRiskDTO'
      responses:
        '200':
          description: Successful update response
          content:
            application/json:
              schema:
                type: object
                properties:
                  maxRisks:
                    type: array
                    items:
                      type: object
                      properties:
                        maxRisks:
                          type: array
                          items:
                            type: string
                        defaultValue:
                          type: string
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/transactions/export/xlsx:
    get:
      summary: Export transactions to an XLSX file for the authenticated admin user
      operationId: ExportTransactionsToXLSX
      tags:
        - Transactions
      security:
        - BearerAuth: []
      parameters:
        - in: query
          name: token
          schema:
            type: string
          description: The JWT token
          required: true
        - in: query
          name: filters
          schema:
            $ref: '#/components/schemas/ITransactionFilters'
          description: The filters to apply to the transactions
        - in: query
          name: filter
          schema:
            type: string
          description: The filter to apply to the transactions
        - in: query
          name: type
          schema:
            type: string
            enum:
              - CORRECTION
              - BONUS
              - DEPOSIT
              - WITHDRAWAL
              - DEPOSIT_BONUS
              - AFFILIATE_TRANSFER
              - FEE
              - COINS_EXCHANGE
              - WALLET_TRANSFER
              - COMMISSION_PAYOUT
          description: The type of transactions to export
      responses:
        '200':
          description: The XLSX file with the exported transactions
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
        '400':
          description: An error occurred
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
  /api/admin/transactions:
    get:
      summary: Get transactions
      operationId: GetTransactions
      tags:
        - Transactions
      security:
        - BearerAuth: []
        - ApiKey: []
      parameters:
        - in: query
          name: sortBy
          schema:
            type: string
          description: Field to sort by
        - in: query
          name: type
          schema:
            type: string
          description: Type of transaction
        - in: query
          name: limit
          schema:
            type: number
            minimum: 1
            maximum: 10000
          description: Maximum number of transactions to return
          required: true
        - in: query
          name: offset
          schema:
            type: number
            minimum: 0
          description: Offset for pagination
          required: true
        - in: query
          name: search
          schema:
            type: string
          description: Search keyword
        - in: query
          name: filters
          schema:
            $ref: '#/components/schemas/ITransactionFilters'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  transactions:
                    type: array
                    items:
                      $ref: '#/components/schemas/ITransactionDTO'
                  pages:
                    type: number
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/transactions/coins_exchange:
    get:
      summary: Get coins exchange transactions
      operationId: GetCoinsExchangeTransactions
      tags:
        - Transactions
      security:
        - BearerAuth: []
      parameters:
        - in: query
          name: limit
          schema:
            type: number
            minimum: 1
            maximum: 100
          description: Maximum number of transactions to return
        - in: query
          name: offset
          schema:
            type: number
            minimum: 0
          description: Offset for pagination
        - in: query
          name: filters
          schema:
            $ref: '#/components/schemas/ITransactionFilters'
          description: Additional filters
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  conversions:
                    type: array
                    items:
                      $ref: '#/components/schemas/IGetCoinsConversions'
                  count:
                    type: number
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/transactions/withdrawal_methods:
    get:
      summary: Get withdrawal methods
      operationId: GetWithdrawalMethods
      tags:
        - Transactions
      security:
        - BearerAuth: []
      parameters:
        - in: query
          name: country
          schema:
            type: string
          description: Country code
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  methods:
                    type: array
                    items:
                      $ref: '#/components/schemas/IWithdrawalMethodSpec'
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/transactions/{id}:
    get:
      summary: Get transaction by ID
      operationId: GetTransactionById
      tags:
        - Transactions
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
          description: Transaction ID
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  transaction:
                    $ref: '#/components/schemas/ITransactionDTO'
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/transactions/{id}/approve:
    put:
      summary: Approve withdrawal transaction
      operationId: ApproveWithdrawalTransaction
      tags:
        - Transactions
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
          description: Transaction ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                comment:
                  type: string
                changedAmount:
                  type: number
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  transaction:
                    $ref: '#/components/schemas/ITransactionDTO'
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/transactions/{id}/reject:
    put:
      summary: Reject withdrawal transaction
      operationId: RejectWithdrawalTransaction
      tags:
        - Transactions
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
          description: Transaction ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                comment:
                  type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  transaction:
                    $ref: '#/components/schemas/ITransactionDTO'
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/transactions/{id}/refund:
    post:
      summary: Refund withdrawal transaction
      operationId: RefundWithdrawalTransaction
      tags:
        - Transactions
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
          description: Transaction ID
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/transactions/{id}/transfer:
    post:
      summary: Transfer money transaction
      operationId: TransferMoneyTransaction
      tags:
        - Transactions
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransferMoneyDTO'
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
          description: Transaction ID
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  withdrawal:
                    $ref: '#/components/schemas/ITransactionDTO'
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/affiliates/transactions/balance:
    get:
      summary: Get the total balance for the authenticated affiliate user
      operationId: GetTotalBalance
      tags:
        - Transactions
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Total balance
          content:
            application/json:
              schema:
                type: object
                properties:
                  balance:
                    type: number
                    description: The total balance
  /api/users:
    post:
      summary: Create a new user
      operationId: CreateUser
      tags:
        - Users
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserDTO'
      responses:
        '201':
          description: User was created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  refreshToken:
                    type: string
                  redirectUrl:
                    type: string
  /api/users/self:
    put:
      summary: Update user
      operationId: UpdateUser
      tags:
        - Users
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateUserDTO'
      responses:
        '201':
          description: User was updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ISessionUserDTO'
    get:
      summary: Get user
      operationId: GetUser
      tags:
        - Users
      responses:
        '200':
          description: User was retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  user:
                    $ref: '#/components/schemas/ISessionUserDTO'
                  refreshToken:
                    type: string
                  supportedFeatures:
                    type: array
                    items:
                      $ref: '#/components/schemas/SupportedFeatures'
                  wallet:
                    $ref: '#/components/schemas/IBasicWalletWithBalanceDTO'
  /api/users/ip_country:
    get:
      summary: Get user's country by IP
      operationId: GetUserCountryByIp
      tags:
        - Users
      responses:
        '200':
          description: User's country was retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  countryCode:
                    type: string
                  ip:
                    type: string
  /api/users/self/mobile-confirmation/send:
    post:
      summary: Send mobile confirmation code
      operationId: SendMobileConfirmationCode
      security:
        - BearerAuth: []
      tags:
        - Users
      responses:
        '200':
          description: Mobile confirmation code was sent successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/users/self/mobile-confirmation/verify:
    post:
      summary: Verify mobile confirmation code
      operationId: VerifyMobileConfirmationCode
      security:
        - BearerAuth: []
      tags:
        - Users
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                confirmationToken:
                  type: string
              required:
                - confirmationToken
      responses:
        '200':
          description: Mobile confirmation code was verified successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/users/self/deposit-disclaimer:
    post:
      summary: Accept deposit disclaimer
      operationId: AcceptDepositDisclaimer
      security:
        - BearerAuth: []
      tags:
        - Users
      responses:
        '200':
          description: Deposit disclaimer was accepted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/users/verify:
    post:
      summary: Verify user
      operationId: VerifyUser
      security:
        - BearerAuth: []
      tags:
        - Users
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                verifyToken:
                  type: string
              required:
                - verifyToken
      responses:
        '200':
          description: User was verified successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/users/self/profile_picture:
    post:
      summary: Upload profile picture
      operationId: UploadProfilePicture
      security:
        - BearerAuth: []
      tags:
        - Users
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
              required:
                - file
      responses:
        '201':
          description: Profile picture was uploaded successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
    delete:
      summary: Delete profile picture
      operationId: DeleteProfilePicture
      security:
        - BearerAuth: []
      tags:
        - Users
      responses:
        '200':
          description: Profile picture was deleted successfully
    get:
      summary: Get profile picture
      operationId: GetProfilePicture
      security:
        - BearerAuth: []
      tags:
        - Users
      responses:
        '200':
          description: Profile picture token was retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  profilePicture:
                    type: string
  /api/users/self/profile_picture/:token:
    get:
      summary: Get profile picture
      operationId: GetProfilePictureByToken
      parameters:
        - in: path
          name: token
          required: true
          schema:
            type: string
          description: Token of the profile picture
      security:
        - BearerAuth: []
      tags:
        - Users
      responses:
        '200':
          description: Profile picture was retrieved successfully
          content:
            multipart/form-data:
              schema:
                type: string
                format: binary
  /api/users/self/resend_confirmation:
    post:
      summary: Resend confirmation email
      operationId: ResendConfirmationEmail
      security:
        - BearerAuth: []
      tags:
        - Users
      responses:
        '200':
          description: Confirmation email was resent successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  email:
                    type: string
                    format: email
  /api/users/self/email_confirmed:
    get:
      summary: Check if user's email is confirmed
      operationId: CheckEmailConfirmed
      security:
        - BearerAuth: []
      tags:
        - Users
      responses:
        '200':
          description: Email confirmation status was retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  confirmed:
                    type: boolean
  /api/users/self/affiliate_earnings:
    get:
      summary: Get affiliate earnings
      operationId: GetAffiliateEarnings
      security:
        - BearerAuth: []
      tags:
        - Users
      responses:
        '200':
          description: Affiliate earnings were retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  earnings:
                    type: number
  /api/users/self/request_disable_account:
    post:
      summary: Request to disable account
      operationId: RequestDisableAccount
      security:
        - BearerAuth: []
      tags:
        - Users
      responses:
        '200':
          description: Account disable request was sent successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
  /api/admin/wallets:
    get:
      summary: Get wallets
      operationId: GetWallets
      tags:
        - Wallets
      security:
        - BearerAuth: []
      parameters:
        - in: query
          name: search
          schema:
            type: string
        - in: query
          name: currencies
          schema:
            type: array
            items:
              type: string
        - in: query
          name: leverageFrom
          schema:
            type: string
        - in: query
          name: leverageTo
          schema:
            type: string
        - in: query
          name: isDemo
          schema:
            type: string
        - in: query
          name: groups
          schema:
            type: array
            items:
              type: string
        - in: query
          name: onlyShowWalletsWithOpenPositions
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  wallets:
                    type: array
                    items:
                      $ref: '#/components/schemas/IWalletWithBalanceDTO'
                  pages:
                    type: number
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
    post:
      summary: Create wallet
      operationId: CreateWallet
      tags:
        - Wallets
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWalletDTO'
      responses:
        '201':
          description: Successful wallet creation response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IWalletDTO'
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/wallets/{id}:
    get:
      summary: Get wallet by ID
      operationId: GetWalletById
      tags:
        - Wallets
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
          description: Wallet ID
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  wallet:
                    $ref: '#/components/schemas/IAdminWalletWithPerformance'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
    put:
      summary: Update wallet by ID
      operationId: UpdateWalletById
      tags:
        - Wallets
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
          description: Wallet ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWalletDTO'
      responses:
        '200':
          description: Successful update response
          content:
            application/json:
              schema:
                type: object
                properties:
                  wallet:
                    $ref: '#/components/schemas/Wallet'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/wallets/transfer:
    post:
      summary: Transfer money between wallets
      operationId: TransferMoneyBetweenWallets
      tags:
        - Wallets
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WalletTransferDTO'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/wallets/{id}/enable:
    put:
      summary: Enable wallet by ID
      operationId: EnableWalletById
      tags:
        - Wallets
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
          description: Wallet ID
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/wallets/{id}/disable:
    put:
      summary: Disable wallet by ID
      operationId: DisableWalletById
      tags:
        - Wallets
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
          description: Wallet ID
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/wallets/{walletId}/transactions:
    post:
      summary: Get wallet transactions
      operationId: GetWalletTransactions
      tags:
        - Wallets
      security:
        - BearerAuth: []
        - ApiKey: []
      parameters:
        - in: path
          name: walletId
          schema:
            type: string
          required: true
          description: Wallet ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCustomerTransactionDTO'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  transactions:
                    type: array
                    items:
                      $ref: '#/components/schemas/ITransactionDTO'
                  pages:
                    type: number
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/wallets/{id}/balance:
    get:
      summary: Get wallet balance by ID
      operationId: GetWalletBalanceById
      tags:
        - Wallets
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
          description: Wallet ID
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IWalletBalanceResponse'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/users/self/wallets:
    get:
      summary: Get wallets
      operationId: GetWallets
      tags:
        - Wallets
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  wallets:
                    type: array
                    items:
                      $ref: '#/components/schemas/IBasicWalletDTO'
                  pages:
                    type: number
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
    post:
      summary: Create wallet
      operationId: CreateWallet
      tags:
        - Wallets
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCreateWalletDTO'
      responses:
        '201':
          description: Successful wallet creation response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Wallet'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/users/self/wallets/balance:
    get:
      summary: Get wallets balance
      operationId: GetWalletsBalance
      tags:
        - Wallets
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  wallets:
                    type: array
                    items:
                      $ref: '#/components/schemas/IBasicWalletWithBalanceDTO'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/users/self/wallets/leverages:
    get:
      summary: Get wallets leverages
      operationId: GetWalletsLeverages
      tags:
        - Wallets
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  leverages:
                    type: array
                    items:
                      type: string
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/users/self/wallets/{id}/balance:
    get:
      summary: Get wallet balance by id
      operationId: GetWalletBalanceById
      tags:
        - Wallets
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          schema:
            type: number
          required: true
          description: Wallet id
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  balance:
                    type: string
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/users/self/wallets/{id}/wallet:
    get:
      summary: Get wallet by id
      operationId: GetWalletById
      tags:
        - Wallets
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          schema:
            type: number
          required: true
          description: Wallet id
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IBasicWalletWithBalanceDTO'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/users/self/wallets/{id}/transactions:
    get:
      summary: Get wallet transactions by id
      operationId: GetWalletTransactionsById
      tags:
        - Wallets
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: id
          schema:
            type: number
          required: true
          description: Wallet id
        - in: query
          name: startDate
          schema:
            type: string
            format: date-time
          required: true
        - in: query
          name: endDate
          schema:
            type: string
            format: date-time
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  transactions:
                    type: array
                    items:
                      $ref: '#/components/schemas/Transaction'
                  pages:
                    type: number
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/watchlist:
    get:
      summary: Get watchlist for current wallet
      operationId: GetWalletWatchlistByUId
      tags:
        - Watchlists
      security:
        - BearerAuth: []
        - ApiKey: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  watchlist:
                    type: array
                    items:
                      $ref: '#/components/schemas/InstrumentWatchlist'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
    post:
      summary: Add instrument to watchlist for current wallet
      operationId: AddInstrumentToWalletWatchlist
      tags:
        - Watchlists
      security:
        - BearerAuth: []
        - ApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                symbol:
                  type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/watchlist/{symbol}:
    delete:
      summary: Remove instrument from wallet's watchlist
      operationId: RemoveInstrumentFromWalletWatchlist
      tags:
        - Watchlists
      security:
        - BearerAuth: []
        - ApiKey: []
      parameters:
        - in: path
          name: symbol
          schema:
            type: string
          required: true
          description: Symbol
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/payment/withdraw:
    post:
      summary: Withdraw money
      operationId: WithdrawMoney
      tags:
        - Withdraw
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWithdrawalDTO'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  accepted:
                    type: boolean
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/payment/withdraw/current:
    get:
      summary: Get current withdrawal
      operationId: GetCurrentWithdrawal
      tags:
        - Withdraw
      security:
        - BearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  withdrawal:
                    $ref: '#/components/schemas/Transaction'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
  /api/admin/prop-trading/funnels/{id}/remote-start:
    post:
      summary: >-
        Endpoint that website uses to start prop trading funnel, and create a
        customer if it doesn't already exist.
      operationId: Start prop funnel for customer via the 3rd party website
      security:
        - BearerAuth: []
        - ApiKey: []
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
          description: Prop funnel id
      tags:
        - Proptrading
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RemoteStartFunnelDTO'
      responses:
        '200':
          description: Funnel was started successfully
          content:
            application/json:
              schema:
                properties:
                  userCreated:
                    type: boolean
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    ApiKey:
      type: apiKey
      in: header
      name: X-API-KEY
  schemas:
    AdminActivityAction:
      type: string
      enum:
        - TRANSACTION_CREATED
        - CUSTOMER_DETAILS_UPDATED
        - CUSTOMER_STATUS_UPDATED
        - LEAD_DETAILS_UPDATED
        - LEAD_REASSIGNED
        - EMAIL_SENT
        - COMMENT_ADDED_TO_CUSTOMER
        - COMMENT_ADDED_TO_LEAD
        - INSTRUMENT_CREATED
        - INSTRUMENT_UPDATED
        - INSTRUMENT_DELETED
        - CURRENCY_CONVERSION_CREATED
        - CURRENCY_CONVERSION_UPDATED
        - CURRENCY_CONVERSION_DELETED
        - CUSTOMER_POSITION_CREATED
        - COMMISSION_RECORD_UPDATED
        - COMMISSION_PAYOUT_APPROVED
        - COMMISSION_PAYOUT_REJECTED
        - CUSTOMER_KYC_UPDATED
    UserRole:
      enum:
        - ADMIN
        - TRADER
        - AFFILIATE
        - LEADER
        - SALES
        - GROUP_ADMIN
    SupportedFeatures:
      enum:
        - COINS
        - MESSAGES
        - USER_UPDATE
        - COMPETITIONS
        - BANNERS
        - DOCUMENT_UPLOAD
        - CREATE_WALLET
        - COPYTRADING
    AffectedObjectType:
      enum:
        - LEAD
        - CUSTOMER
        - INSTRUMENT
        - CURRENCY_CONVERSION
        - COMMISSION_LEDGER_RECORD
        - COMMISSION_PAYOUT_REQUEST
    AdminActivity:
      type: object
      properties:
        id:
          type: string
        actingCustomerId:
          type: string
        actingCustomerName:
          type: string
        action:
          $ref: '#/components/schemas/AdminActivityAction'
        createdAt:
          type: string
          format: date-time
        role:
          $ref: '#/components/schemas/UserRole'
        type:
          $ref: '#/components/schemas/AffectedObjectType'
        displayName:
          type: string
        affectedObjectId:
          type: string
        affectedObjectFound:
          type: boolean
    CreateActivityDTO:
      type: object
      properties:
        type:
          type: string
        details:
          type: string
      required:
        - type
        - details
    Adapter:
      type: object
      properties:
        name:
          type: string
        enabled:
          type: boolean
        type:
          type: string
        configuration:
          type: object
    CreateAdapterDTO:
      type: object
      properties:
        name:
          type: string
        enabled:
          type: boolean
        type:
          type: string
        configuration:
          type: object
      required:
        - name
        - enabled
        - type
        - configuration
    UpdateAdapterDTO:
      type: object
      properties:
        enabled:
          type: boolean
        type:
          type: string
        configuration:
          type: object
      required:
        - enabled
        - type
        - configuration
    IDownlineStats:
      type: object
      properties:
        registrations:
          type: number
        downloads:
          type: number
        level:
          type: number
    Banner:
      type: object
      properties:
        id:
          type: string
        startDate:
          type: string
          format: date-time
        endDate:
          type: string
          format: date-time
        link:
          type: string
        linkTarget:
          type: string
        fileLink:
          type: string
        filename:
          type: string
    UpdateBonusDTO:
      type: object
      properties:
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
        amount:
          type: number
        type:
          type: string
          enum:
            - SIGNUP
            - DEPOSIT
            - DEPOSIT_PROPORTIONAL
        minimumDepositUSD:
          type: number
        maximumAmountUSD:
          type: number
        addToCredit:
          type: boolean
        methods:
          type: array
          items:
            type: string
      required:
        - start
        - end
        - amount
        - type
        - addToCredit
        - methods
    CreateBonusDTO:
      allOf:
        - $ref: '#/components/schemas/UpdateBonusDTO'
        - type: object
          properties:
            id:
              type: string
          required:
            - id
    Bonus:
      type: object
      properties:
        id:
          type: string
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
        amount:
          type: number
        minimumDepositUSD:
          type: number
          nullable: true
        maximumAmountUSD:
          type: number
          nullable: true
        type:
          type: string
          enum:
            - SIGNUP
            - DEPOSIT
            - DEPOSIT_PROPORTIONAL
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/ITransactionDTO'
    CreateOrUpdateCommissionModelDTO:
      type: object
      properties:
        name:
          type: string
        greyLabelingEnabled:
          type: boolean
        subCommissionModelId:
          type: number
          nullable: true
        commissionModelLevels:
          type: array
          items:
            $ref: '#/components/schemas/CommissionModelLevel'
      required:
        - name
        - greyLabelingEnabled
        - commissionModelLevels
    CommissionModelLevel:
      type: object
      properties:
        modelId:
          type: number
        model:
          $ref: '#/components/schemas/CommissionModel'
        level:
          type: number
        cpaAmount:
          type: number
          nullable: true
        cpaCurrency:
          type: string
          nullable: true
        volumeCommissionAmount:
          type: number
          nullable: true
        volumeCommissionCurrency:
          type: string
          nullable: true
        profitSharePercentage:
          type: number
          nullable: true
        propPurchaseFirstPercentage:
          type: number
          nullable: true
        propPurchaseSubsequentPercentage:
          type: number
          nullable: true
    CommissionLedger:
      type: object
      properties:
        id:
          type: number
        introducerId:
          type: string
        introducer:
          $ref: '#/components/schemas/Customer'
        referralId:
          type: string
        referral:
          $ref: '#/components/schemas/Customer'
        commissionType:
          type: string
          enum:
            - CPA
            - VOLUME
            - PROFIT_SHARE
        actionType:
          type: string
          enum:
            - FTD
            - TRADE
        actionDetails:
          type: string
        commissionAmount:
          type: number
        correctedCommissionAmount:
          type: number
          nullable: true
        currency:
          type: string
        actionTimestamp:
          type: string
          format: date-time
        payoutAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        adminComments:
          type: string
        createdAt:
          type: string
          format: date-time
        adminId:
          type: string
        admin:
          $ref: '#/components/schemas/Customer'
    PayoutRequest:
      type: object
      properties:
        id:
          type: number
        introducerId:
          type: string
        introducer:
          $ref: '#/components/schemas/Customer'
        payoutWalletId:
          type: number
        payoutWallet:
          $ref: '#/components/schemas/Wallet'
        requestedAt:
          type: string
          format: date-time
        approvedAt:
          type: string
          format: date-time
          nullable: true
        rejectedAt:
          type: string
          format: date-time
          nullable: true
        rejectReason:
          type: string
          nullable: true
        updatedAt:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        transactionId:
          type: string
          nullable: true
        transaction:
          $ref: '#/components/schemas/Transaction'
          nullable: true
        adminId:
          type: string
        admin:
          $ref: '#/components/schemas/Customer'
    RejectPayoutRequestDTO:
      type: object
      properties:
        rejectReason:
          type: string
          nullable: true
    UpdateCommissionLedgerDTO:
      type: object
      properties:
        correctedCommissionAmount:
          type: number
        adminComments:
          type: string
    CreateCommentDTO:
      type: object
      properties:
        comment:
          type: string
      required:
        - comment
    Comment:
      type: object
      properties:
        id:
          type: string
        customerId:
          type: string
        userId:
          type: string
        comment:
          type: string
        createdAt:
          type: string
          format: date-time
    Competition:
      type: object
      properties:
        id:
          type: string
        description:
          type: string
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
        prizes:
          type: array
          items:
            type: number
        tcLink:
          type: string
        type:
          type: string
        promoted:
          type: boolean
    Top:
      type: object
      properties:
        rank:
          type: number
        nickname:
          type: string
        points:
          type: number
        own:
          type: boolean
    LeaderboardEntry:
      type: object
      properties:
        fixedProfitLoss:
          type: number
        fixedPoints:
          type: number
        floatingProfitLoss:
          type: number
        floatingPoints:
          type: number
        points:
          type: number
        participationId:
          type: string
        nickname:
          type: string
        mtLogin:
          type: string
        volume:
          type: number
    CreateCompetitionDTO:
      type: object
      properties:
        description:
          type: string
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
        firstPrizeInUSD:
          type: number
        secondPrizeInUSD:
          type: number
          nullable: true
        thirdPrizeInUSD:
          type: number
          nullable: true
        type:
          type: string
          enum:
            - PROFITLOSS
            - PROFIT
        tcLink:
          type: string
          nullable: true
        promoted:
          type: boolean
      required:
        - description
        - start
        - end
        - firstPrizeInUSD
        - type
        - promoted
    UpdateCompetitionDTO:
      type: object
      properties:
        description:
          type: string
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
        firstPrizeInUSD:
          type: number
        secondPrizeInUSD:
          type: number
          nullable: true
        thirdPrizeInUSD:
          type: number
          nullable: true
        tcLink:
          type: string
          nullable: true
        promoted:
          type: boolean
      required:
        - description
        - start
        - end
        - firstPrizeInUSD
        - promoted
    JoinCompetitionDTO:
      type: object
      properties:
        nickname:
          type: string
      required:
        - nickname
    Ranks:
      type: object
      properties:
        ranks:
          type: object
          properties:
            top:
              type: array
              items:
                $ref: '#/components/schemas/Top'
    Conversion:
      type: object
      properties:
        id:
          type: number
        target:
          type: string
        source:
          type: string
        path:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    CreateConversionDTO:
      type: object
      properties:
        target:
          type: string
        source:
          type: string
        path:
          type: string
      required:
        - target
        - source
        - path
    UpdateConversionDTO:
      type: object
      properties:
        path:
          type: string
    StrategyDTO:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    CreateStrategyDTO:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
      required:
        - name
    FollowStrategyDTO:
      type: object
      properties:
        investmentAmount:
          type: number
      required:
        - investmentAmount
    ICustomerDTO:
      type: object
      properties:
        id:
          type: string
        level:
          type: number
        accountId:
          type: string
          nullable: true
        name:
          type: string
        firstname:
          type: string
        lastname:
          type: string
        email:
          type: string
          format: email
        mobilenumber:
          type: string
          nullable: true
        depositTotal:
          type: number
          nullable: true
        totalCoinsEarned:
          type: number
          nullable: true
        country:
          type: string
        countryName:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
        status:
          type: string
          enum:
            - ACTIVE
            - PENDING
            - DISABLED
        appInstalledAt:
          type: string
          format: date-time
          nullable: true
        lastLoginDate:
          type: string
          format: date-time
          nullable: true
        totalLogins:
          type: number
        notes:
          type: string
        roles:
          type: array
          items:
            type: string
        availableContactMethods:
          type: array
          items:
            type: string
        totalReferrals:
          type: number
        documentCount:
          type: number
        kycStatus:
          type: string
          enum:
            - PENDING
            - APPROVED
            - REJECTED
          nullable: true
        kycReviewedById:
          type: string
          nullable: true
        kycReviewedByName:
          type: string
          nullable: true
        kycReviewedAt:
          type: string
          format: date-time
          nullable: true
        affiliateId:
          type: string
          nullable: true
        referrer:
          type: string
          nullable: true
        conversionAgent:
          type: object
          properties:
            id:
              type: string
            name:
              type: string
          nullable: true
        retentionAgent:
          type: object
          properties:
            id:
              type: string
            name:
              type: string
          nullable: true
        salesDesk:
          type: object
          properties:
            id:
              type: string
            name:
              type: string
          nullable: true
        salesStatusName:
          type: string
          nullable: true
        lastTradingActivityDate:
          type: string
          format: date-time
          nullable: true
        totalVolumeTraded:
          type: number
          nullable: true
        tradeVolumeLastWeek:
          type: number
          nullable: true
        tradeVolumeOpen:
          type: number
          nullable: true
        confirmedAt:
          type: string
          format: date-time
          nullable: true
        commissionScheme:
          type: object
          properties:
            id:
              type: string
            name:
              type: string
          nullable: true
        communicationLanguage:
          type: string
        isBookmarked:
          type: boolean
          nullable: true
        affiliateBalance:
          type: string
          nullable: true
        positionsCount:
          type: number
          nullable: true
        hasFTD:
          type: boolean
          nullable: true
        lastActive:
          type: string
          format: date-time
          nullable: true
        riskStatus:
          type: string
          enum:
            - REVIEW
            - NONE
          nullable: true
        source:
          type: string
          nullable: true
        withdrawalTotal:
          type: number
          nullable: true
        lastDepositDate:
          type: string
          format: date-time
          nullable: true
        lastCommentDate:
          type: string
          format: date-time
          nullable: true
        lastContactDate:
          type: string
          format: date-time
          nullable: true
        commissionsGranted:
          type: number
          nullable: true
        commissionsEarned:
          type: number
          nullable: true
        sumSubDetails:
          $ref: '#/components/schemas/SumSubDetails'
        terminationRequestedAt:
          type: string
          format: date-time
          nullable: true
        groups:
          type: array
          items:
            type: number
    SumSubDetails:
      type: object
      properties:
        reviewDate:
          type: string
        reviewAnswer:
          type: string
        applicantId:
          type: string
        clientId:
          type: string
        correlationId:
          type: string
        sumSubUrl:
          type: string
          nullable: true
        reviewStatus:
          type: string
          nullable: true
        reviewResults:
          type: object
          properties:
            moderationComment:
              type: string
              nullable: true
            clientComment:
              type: string
              nullable: true
            rejectLabels:
              type: string
              nullable: true
            reviewRejectType:
              type: string
              nullable: true
    CreateCustomerDTO:
      type: object
      properties:
        fullname:
          type: string
        mobilenumber:
          type: string
        country:
          type: string
        email:
          type: string
        currency:
          type: string
        wants_to_become_leader:
          type: boolean
      required:
        - fullname
        - mobilenumber
        - country
        - email
        - currency
    UpdateCustomerDTO:
      type: object
      properties:
        fullname:
          type: string
        mobilenumber:
          type: string
        country:
          type: string
        email:
          type: string
        currency:
          type: string
        roles:
          type: array
          items:
            type: string
        groups:
          type: array
          items:
            type: string
    BulkUpdateCustomerDTO:
      type: object
      properties:
        customers:
          type: array
          items:
            $ref: '#/components/schemas/UpdateCustomerDTO'
    SendEmailDTO:
      type: object
      properties:
        subject:
          type: string
        body:
          type: string
      required:
        - subject
        - body
    KYCDocument:
      type: object
      properties:
        id:
          type: string
        url:
          type: string
        token:
          type: string
    CreateDowntimeDTO:
      type: object
      properties:
        startDate:
          type: string
          format: date-time
        endDate:
          type: string
          format: date-time
        title:
          type: string
        symbols:
          type: array
          items:
            type: string
      required:
        - startDate
        - endDate
        - title
        - symbols
    CreateEmailTemplateDTO:
      type: object
      properties:
        enabled:
          type: boolean
        title:
          type: string
        subject:
          type: string
        mjml:
          type: string
        txt:
          type: string
        trigger:
          type: string
        conditions:
          type: object
      required:
        - enabled
        - title
        - trigger
        - conditions
    UpdateEmailTemplateDTO:
      type: object
      properties:
        subject:
          type: string
        mjml:
          type: string
        txt:
          type: string
        enabled:
          type: boolean
        trigger:
          type: string
        title:
          type: string
        conditions:
          type: object
    EmailDTO:
      type: object
      properties:
        id:
          type: string
        enabled:
          type: boolean
        title:
          type: string
        subject:
          type: string
        mjml:
          type: string
        txt:
          type: string
        trigger:
          type: string
        conditions:
          type: object
    CreateExchangeRateDTO:
      type: object
      properties:
        fromCurrency:
          type: string
        toCurrency:
          type: string
        source:
          type: string
        rate:
          type: number
      required:
        - fromCurrency
        - toCurrency
        - source
    ExchangeRate:
      type: object
      properties:
        id:
          type: string
        fromCurrency:
          type: string
        toCurrency:
          type: string
        source:
          type: string
        rate:
          type: number
    ForgotPasswordRequest:
      type: object
      properties:
        contact:
          type: string
      required:
        - contact
    Country:
      type: object
      properties:
        isoCode:
          type: string
        name:
          type: string
        allowForRegistration:
          type: boolean
        paymentProviders:
          type: array
          items:
            $ref: '#/components/schemas/PaymentProvider'
    GroupMessageDTO:
      type: object
      properties:
        id:
          type: number
        text:
          type: string
        subject:
          type: string
        createdAt:
          type: string
        updatedAt:
          type: string
      required:
        - id
        - text
        - subject
        - createdAt
        - updatedAt
    CreateGroupMessageDTO:
      type: object
      properties:
        text:
          type: string
        subject:
          type: string
        type:
          type: string
        targetGroupId:
          type: number
      required:
        - text
        - subject
        - type
        - targetGroupId
    GroupWithMarkupsDTO:
      type: object
      properties:
        id:
          type: number
        name:
          type: string
        leverage:
          type: number
        currency:
          type: string
        adapterName:
          type: string
        disableSwapCharges:
          type: boolean
        markups:
          type: array
          items:
            type: object
        commissions:
          type: array
          items:
            type: object
        marginCallLevel:
          type: number
        stopOutLevel:
          type: number
      required:
        - id
        - name
        - leverage
        - currency
        - adapterName
        - disableSwapCharges
    CreateGroupDTO:
      type: object
      properties:
        name:
          type: string
        leverage:
          type: number
        currency:
          type: string
        adapterName:
          type: string
        disableSwapCharges:
          type: boolean
      required:
        - name
        - leverage
        - currency
        - adapterName
        - disableSwapCharges
    UpdateGroupDTO:
      type: object
      properties:
        leverage:
          type: number
        markups:
          type: array
          items:
            type: object
        commissions:
          type: array
          items:
            type: object
        marginCallLevel:
          type: number
        stopOutLevel:
          type: number
        adapterName:
          type: string
        disableSwapCharges:
          type: boolean
      required:
        - leverage
        - markups
        - commissions
        - marginCallLevel
        - stopOutLevel
        - adapterName
        - disableSwapCharges
    TradingTimeUnit:
      type: object
      properties:
        day:
          type: string
        hour:
          type: string
        minute:
          type: string
    InstrumentDTO:
      type: object
      properties:
        profitCalcMode:
          type: string
        marginCalcMode:
          type: string
        stakeMode:
          type: string
        symbol:
          type: string
        marginCurrency:
          type: string
        currency:
          type: string
        category:
          type: string
        decimals:
          type: number
        contractSize:
          type: number
        sizes:
          type: array
          items:
            type: object
            properties:
              left:
                type: number
              right:
                type: string
        tradingHours:
          type: array
          items:
            type: object
            properties:
              startTime:
                $ref: '#/components/schemas/TradingTimeUnit'
              endTime:
                $ref: '#/components/schemas/TradingTimeUnit'
        marginPercentage:
          type: number
        hedgedMarginPercentage:
          type: number
        status:
          type: string
        swapMode:
          type: string
        swapLong:
          type: number
        swapShort:
          type: number
        minOrderSize:
          type: number
        maxOrderSize:
          type: number
        stepOrderSize:
          type: string
        swap3DayWeekday:
          type: number
          nullable: true
        sort:
          type: number
        iconUrl:
          type: string
          nullable: true
    IInstrumentInfoWithIcons:
      type: object
      properties:
        category:
          type: string
        contractSize:
          type: number
        currency:
          type: string
        decimals:
          type: number
        marginCurrency:
          type: string
        maxOrderSize:
          type: number
        minOrderSize:
          type: number
        precision:
          type: number
        sizes:
          type: array
          items:
            type: object
            properties:
              left:
                type: number
              right:
                type: string
        stakeMode:
          type: string
        status:
          type: string
        stepOrderSize:
          type: string
        swap3DayWeekday:
          type: number
          nullable: true
        swapLong:
          type: string
        swapMode:
          type: string
        swapShort:
          type: string
        symbol:
          type: string
        tradingHours:
          type: array
          items:
            type: object
            properties:
              endTime:
                $ref: '#/components/schemas/TradingTimeUnit'
              startTime:
                $ref: '#/components/schemas/TradingTimeUnit'
        iconUrl:
          type: string
          nullable: true
    IInstrumentsInfoWithIcons:
      type: array
      items:
        $ref: '#/components/schemas/IInstrumentInfoWithIcons'
    CreateInstrumentDTO:
      type: object
      properties:
        symbol:
          type: string
        marginCurrency:
          type: string
        currency:
          type: string
        category:
          type: string
          enum:
            - currencies
            - indices
            - commodities
            - cryptos
            - equities
        decimals:
          type: number
        profitCalcMode:
          type: string
          enum:
            - FOREX
            - CFD
        marginCalcMode:
          type: string
          enum:
            - FOREX
            - CFD
        sizes:
          type: array
          items:
            type: object
            properties:
              left:
                type: number
              right:
                type: string
        marginPercentage:
          type: number
        hedgedMarginPercentage:
          type: number
        tradingHours:
          type: array
          items:
            type: object
            properties:
              startTime:
                $ref: '#/components/schemas/TradingTimeUnit'
              endTime:
                $ref: '#/components/schemas/TradingTimeUnit'
        swapMode:
          type: string
          enum:
            - POINTS
            - DISABLED
        swapLong:
          type: number
        swapShort:
          type: number
        swap3DayWeekday:
          type: number
          nullable: true
        stakeMode:
          type: string
        contractSize:
          type: number
        minOrderSize:
          type: string
        maxOrderSize:
          type: string
        status:
          type: string
        sort:
          type: number
        filename:
          type: string
          nullable: true
        file:
          type: string
          nullable: true
      required:
        - symbol
        - marginCurrency
        - currency
        - category
        - decimals
        - profitCalcMode
        - marginCalcMode
        - sizes
        - marginPercentage
        - hedgedMarginPercentage
        - tradingHours
        - swapMode
        - swapLong
        - swapShort
        - stakeMode
        - contractSize
        - minOrderSize
        - maxOrderSize
        - status
    LeadListingDTO:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        salesPerson:
          type: object
          properties:
            id:
              type: string
            name:
              type: string
          nullable: true
        salesStatus:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
        lastModifiedAt:
          type: string
          format: date-time
          nullable: true
        source:
          type: string
        country:
          type: string
          nullable: true
    GetLeadDTO:
      type: object
      properties:
        canBeCalled:
          type: boolean
        name:
          type: string
        email:
          type: string
          nullable: true
        mobilenumber:
          type: string
          nullable: true
        source:
          type: string
        salesStatus:
          type: string
          nullable: true
        lastContactAt:
          type: string
          format: date-time
          nullable: true
        salesPersonId:
          type: string
          nullable: true
        id:
          type: string
        createdAt:
          type: string
          format: date-time
        salesPerson:
          $ref: '#/components/schemas/Customer'
          nullable: true
    UpdateLeadSalesPersonDTO:
      type: object
      properties:
        salesPersonId:
          type: string
    ICreateLeadDTO:
      type: object
      properties:
        name:
          type: string
        email:
          type: string
          format: email
          nullable: true
        mobilenumber:
          type: string
          nullable: true
        source:
          type: string
    ICreatedLeadDTO:
      type: object
      properties:
        name:
          type: string
        email:
          type: string
          format: email
          nullable: true
        mobilenumber:
          type: string
          nullable: true
        source:
          type: string
        salesStatus:
          type: string
          nullable: true
        lastContactAt:
          type: string
          format: date-time
          nullable: true
        salesPersonId:
          type: string
          nullable: true
        id:
          type: string
        createdAt:
          type: string
          format: date-time
    CreateMassBonusDTO:
      type: object
      properties:
        name:
          type: string
        currency:
          type: string
          enum:
            - USD
        addToCredit:
          type: boolean
        amount:
          type: number
        accounts:
          type: string
          description: Wallet usernames separated by comma
    ValidationError:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              msg:
                type: string
              param:
                type: string
              location:
                type: string
    InputValidationError:
      type: object
      properties:
        success:
          type: boolean
        errors:
          type: array
          items:
            properties:
              param:
                type: string
              msg:
                type: string
    Message:
      type: object
      properties:
        id:
          type: string
        senderId:
          type: string
          nullable: true
        recipientId:
          type: string
        groupIdMessage:
          type: string
          nullable: true
        text:
          type: string
        subject:
          type: string
          nullable: true
        readAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        viaPush:
          type: boolean
        actions:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - 'yes'
                  - 'no'
                  - learn-more
              url:
                type: string
    OnboardingStepConfiguration:
      type: object
      properties:
        step:
          type: string
          enum:
            - SignupDemoForm
            - SignupRealForm
            - CompleteAccountBeforeDepositForm
            - CompleteAccountBeforeWithdrawalForm
            - EmailConfirmation
            - KYC
            - PhoneConfirmation
            - DisclaimerBeforeDeposit
        order:
          type: number
        stage:
          type: string
          enum:
            - SignUp
            - BeforeSignIn
            - BeforeDeposit
            - BeforeWithdrawal
            - null
    IOrderWithIcon:
      type: object
      properties:
        id:
          type: number
        type:
          type: string
        positionId:
          type: number
        externalId:
          type: string
        placedAt:
          type: string
          format: date-time
        executedAt:
          type: string
          format: date-time
        averagePrice:
          type: string
        requestedPrice:
          type: string
        quantity:
          type: string
        filledQuantity:
          type: string
        notionalValue:
          type: string
        notionalValueInUsd:
          type: string
        status:
          type: string
        rejectReason:
          type: string
        symbol:
          type: string
    UpdateOrderDTO:
      type: object
      properties:
        limitPrice:
          type: string
          nullable: true
        stopPrice:
          type: string
          nullable: true
        takeProfit:
          type: string
          nullable: true
        stopLoss:
          type: string
          nullable: true
        trailingStopLossPct:
          type: string
          nullable: true
    PaymentProviderDTO:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        enabledCountryCodes:
          type: array
          items:
            type: string
        minimumDepositAmount:
          type: number
          nullable: true
        maximumDepositAmount:
          type: number
          nullable: true
        minimumWithdrawalAmount:
          type: number
          nullable: true
        maximumWithdrawalAmount:
          type: number
          nullable: true
        predefinedDepositAmounts:
          type: array
          items:
            type: number
        configurationKeyValues:
          type: object
          additionalProperties:
            type: string
        configKeys:
          type: object
          additionalProperties:
            type: boolean
    PaymentProvider:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        enabledCountry:
          type: array
          items:
            $ref: '#/components/schemas/Country'
        minimumDepositAmount:
          type: string
          nullable: true
        maximumDepositAmount:
          type: string
          nullable: true
        minimumWithdrawalAmount:
          type: string
          nullable: true
        maximumWithdrawalAmount:
          type: string
          nullable: true
        predefinedDepositAmounts:
          type: array
          items:
            type: number
        config:
          type: object
          properties:
            allowedDepositMethods:
              type: array
              items:
                type: string
              nullable: true
            convertToAccountCurrency:
              type: boolean
              nullable: true
            predefinedDepositAmounts:
              type: array
              items:
                type: number
            baseConfiguration:
              type: object
              additionalProperties:
                type: boolean
        configKeys:
          type: object
          additionalProperties:
            type: boolean
    UpdatePaymentProviderDTO:
      type: object
      properties:
        keyValues:
          type: array
          items:
            type: object
            properties:
              key:
                type: string
              value:
                type: string
        enabledCountryCodes:
          type: array
          items:
            type: string
        minimumDepositAmount:
          type: number
          nullable: true
        maximumDepositAmount:
          type: number
          nullable: true
        minimumWithdrawalAmount:
          type: number
          nullable: true
        maximumWithdrawalAmount:
          type: number
          nullable: true
        predefinedDepositAmounts:
          type: array
          items:
            type: number
    SortPaymentProvidersDTO:
      type: object
      properties:
        id:
          type: string
        sort:
          type: number
    PositionDTO:
      type: object
      properties:
        id:
          type: number
        customerId:
          type: string
        accountId:
          type: number
        size:
          type: number
        side:
          type: string
        openedAt:
          type: string
          format: date
        closedAt:
          type: string
          format: date-time
        closedPL:
          type: number
          nullable: true
        closedPLInAccountCurrency:
          type: number
          nullable: true
        closedReason:
          type: string
          nullable: true
        symbol:
          type: string
        status:
          type: string
        platform:
          type: string
        stopLoss:
          type: number
          nullable: true
        invest:
          type: number
          nullable: true
        closePositionAfterSeconds:
          type: number
          nullable: true
        openingOrderExternalId:
          type: string
          nullable: true
        margin:
          type: string
          nullable: true
        openPrice:
          type: string
          nullable: true
        closePrice:
          type: string
          nullable: true
        profitLoss:
          type: number
          nullable: true
        swap:
          type: number
        takeProfit:
          type: number
          nullable: true
        commission:
          type: number
          nullable: true
        tailingStopLossPct:
          type: string
          nullable: true
    UpdatePositionDTO:
      type: object
      properties:
        stopLoss:
          type: number
          nullable: true
        takeProfit:
          type: number
          nullable: true
        openPrice:
          type: number
          nullable: true
        closePrice:
          type: number
          nullable: true
        commission:
          type: number
          nullable: true
        tailingStopLossPct:
          type: number
          nullable: true
    CreatePositionDTO:
      type: object
      properties:
        size:
          type: number
        side:
          type: string
        symbol:
          type: string
        platform:
          type: string
        stopLoss:
          type: string
          nullable: true
        accountId:
          type: number
        marginRate:
          type: string
          nullable: true
        openPrice:
          type: string
          nullable: true
        takeProfit:
          type: string
          nullable: true
        tailingStopLossPct:
          type: string
          nullable: true
    IOrder:
      type: object
      properties:
        id:
          type: number
        type:
          type: string
        positionId:
          type: number
        externalId:
          type: string
        placedAt:
          type: string
          format: date-time
        executedAt:
          type: string
          format: date-time
        averagePrice:
          type: string
        requestedPrice:
          type: string
        quantity:
          type: string
        filledQuantity:
          type: string
        notionalValue:
          type: string
        notionalValueInUsd:
          type: string
        status:
          type: string
        rejectReason:
          type: string
        symbol:
          type: string
        trailingStopLossPct:
          type: string
    PushNotificationSubscriptionDTO:
      type: object
      properties:
        id:
          type: number
        endpoint:
          type: string
        keys:
          type: object
          properties:
            p256dh:
              type: string
            auth:
              type: string
        expirationTime:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        customerId:
          type: string
        topic:
          type: string
          enum:
            - admin
            - trading
            - trading-pro
    CreateSalesStatusDTO:
      type: object
      properties:
        status:
          type: string
        color:
          type: string
    UpdateSalesStatusDTO:
      type: object
      properties:
        status:
          type: string
          nullable: true
        color:
          type: string
          nullable: true
    SalesStatus:
      type: object
      properties:
        id:
          type: number
        status:
          type: string
        color:
          type: string
    CreateSessionDTO:
      type: object
      properties:
        username:
          type: string
        password:
          type: string
    SessionDTO:
      type: object
      properties:
        token:
          type: string
        refreshToken:
          type: string
          nullable: true
        user:
          $ref: '#/components/schemas/IUserDTO'
        outstandingOnboardingSteps:
          type: array
          items:
            $ref: '#/components/schemas/OnboardingStepConfiguration'
    IUserDTO:
      type: object
      properties:
        name:
          type: string
        firstname:
          type: string
          nullable: true
        lastname:
          type: string
          nullable: true
        email:
          type: string
          format: email
        id:
          type: string
        accountId:
          type: number
        avatarUrl:
          type: string
        mobilenumber:
          type: string
        refKey:
          type: string
        referralURL:
          type: string
        roles:
          type: array
          items:
            type: string
            enum:
              - ADMIN
              - TRADER
              - AFFILIATE
              - LEADER
              - SALES
              - GROUP_ADMIN
        localCurrency:
          type: string
          nullable: true
        confirmedAt:
          type: string
          format: date-time
          nullable: true
        country:
          type: string
          nullable: true
        communicationLanguage:
          type: string
        permissions:
          type: array
          items:
            type: string
        coperatoAgentId:
          type: string
          nullable: true
        terminationRequestedAt:
          type: string
          format: date-time
          nullable: true
    IStatementRecord:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
        currency:
          type: string
        amount:
          type: string
        details:
          type: string
        openPrice:
          type: string
        closePrice:
          type: string
        side:
          type: string
        unixTime:
          type: number
        date:
          type: string
          format: date-time
    UpdatePeriodDTO:
      type: object
      properties:
        value:
          type: string
        defaultValue:
          type: string
    UpdateMaxRiskDTO:
      type: object
      properties:
        value:
          type: string
        defaultValue:
          type: string
    ITransactionDTO:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - CORRECTION
            - BONUS
            - DEPOSIT
            - WITHDRAWAL
            - DEPOSIT_BONUS
            - AFFILIATE_TRANSFER
            - FEE
            - COINS_EXCHANGE
            - WALLET_TRANSFER
            - COMMISSION_PAYOUT
        status:
          type: string
          enum:
            - created
            - pending
            - successful
            - canceled
            - failed
            - error
        method:
          type: string
        provider:
          type: string
        providerRef:
          type: string
        customer:
          $ref: '#/components/schemas/Customer'
        netAmountInUSD:
          type: number
          nullable: true
        creditedAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
        comment:
          type: string
          nullable: true
        amount:
          type: number
        currency:
          type: string
        adminId:
          type: string
          nullable: true
        walletAddress:
          type: string
          nullable: true
        wallet:
          type: number
        ipAddress:
          type: string
          nullable: true
        countryCode:
          type: string
          nullable: true
        reviewerCountryCode:
          type: string
          nullable: true
        withdrawalReview:
          type: object
          properties:
            status:
              type: string
              enum:
                - approved
                - rejected
                - refunded
            reviewerId:
              type: string
            reviewedAt:
              type: string
              format: date-time
            reviewerIp:
              type: string
        conversionFrom:
          type: string
          nullable: true
        conversionFromAmount:
          type: number
          nullable: true
        conversionTo:
          type: string
          nullable: true
        conversionToAmount:
          type: number
          nullable: true
        conversionRate:
          type: number
          nullable: true
        conversionSource:
          type: string
          enum:
            - Manual
            - OpenExchangeRates
            - null
        conversionDate:
          type: string
          format: date-time
          nullable: true
    IGetCoinsConversions:
      type: object
      properties:
        customerName:
          type: string
        customerId:
          type: string
        wallet:
          type: number
        walletId:
          type: number
        createdAt:
          type: string
          format: date-time
        addToCredit:
          type: string
        amount:
          type: string
        coinsExchanged:
          type: number
    IWithdrawalMethodSpec:
      type: object
      properties:
        automatic:
          type: boolean
        id:
          type: string
        name:
          type: string
        icon:
          type: string
          nullable: true
    IDepositMethodSpec:
      type: object
      properties:
        depositCurrency:
          type: string
        id:
          type: string
        name:
          type: string
        icon:
          type: string
          nullable: true
    LeadCommunicationDTO:
      type: object
      properties:
        id:
          type: string
        recordType:
          type: string
          enum:
            - CALL
            - EMAIL
            - MESSAGE
        recordId:
          type: string
        fromCustomer:
          $ref: '#/components/schemas/ICustomerDTO'
          nullable: true
        toLead:
          $ref: '#/components/schemas/Lead'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ICallDetail:
      type: object
      properties:
        duration:
          type: number
        answered:
          type: boolean
        recordingFileLink:
          type: string
    IEmailDetail:
      type: object
      properties:
        subject:
          type: string
        body:
          type: string
    IMessageDetail:
      type: object
      properties:
        text:
          type: string
        viaPush:
          type: boolean
        readAt:
          type: string
          format: date-time
    CustomerCommunicationDTO:
      type: object
      properties:
        id:
          type: string
        detail:
          type: object
          enum:
            - ICallDetail
            - IEmailDetail
            - IMessageDetail
        from:
          type: string
        fromName:
          type: string
        type:
          type: string
          enum:
            - CALL
            - EMAIL
            - MESSAGE
    Participation:
      type: object
      properties:
        nickname:
          type: string
        createdAt:
          type: string
          format: date-time
        rank:
          type: number
        points:
          type: number
    ICurrentCompetition:
      type: object
      properties:
        competition:
          $ref: '#/components/schemas/Competition'
        participation:
          $ref: '#/components/schemas/Participation'
        leaderboard:
          type: array
          items:
            $ref: '#/components/schemas/LeaderboardEntry'
    CustomerFieldConfiguration:
      type: object
      properties:
        field:
          type: string
        step:
          type: string
          nullable: true
        required:
          type: boolean
        editable:
          type: boolean
    IPaymentMethodSpec:
      type: array
      items:
        oneOf:
          - $ref: '#/components/schemas/IDepositMethodSpec'
          - $ref: '#/components/schemas/IWithdrawalMethodSpec'
    IDemoTopUpRequest:
      type: object
      properties:
        walletId:
          type: number
        amount:
          type: string
        currency:
          type: string
    IDemoTopUpResponse:
      type: object
      properties:
        success:
          type: boolean
        newBalance:
          type: number
    ITransactionFilters:
      type: object
      properties:
        createdAtRange:
          type: object
          properties:
            startDate:
              type: string
            endDate:
              type: string
          nullable: true
        amountFrom:
          type: string
          nullable: true
        amountTo:
          type: string
          nullable: true
        providers:
          type: array
          items:
            type: string
        statuses:
          type: array
          items:
            type: string
            enum:
              - created
              - pending
              - successful
              - canceled
              - failed
              - error
          nullable: true
        wallet:
          type: number
          nullable: true
    IPositionFilters:
      type: object
      properties:
        symbols:
          type: array
          items:
            type: string
          nullable: true
        statuses:
          type: array
          items:
            type: string
          nullable: true
        types:
          type: array
          items:
            type: string
          nullable: true
        openedAt:
          type: object
          properties:
            startDate:
              type: string
              format: date-time
            endDate:
              type: string
              format: date-time
          nullable: true
        accountId:
          type: number
    Transaction:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - CORRECTION
            - BONUS
            - DEPOSIT
            - WITHDRAWAL
            - DEPOSIT_BONUS
            - AFFILIATE_TRANSFER
            - FEE
            - COINS_EXCHANGE
            - WALLET_TRANSFER
            - COMMISSION_PAYOUT
        status:
          type: string
          enum:
            - created
            - pending
            - successful
            - canceled
            - failed
            - error
        method:
          type: string
          nullable: true
        provider:
          type: string
          nullable: true
        providerRef:
          type: string
          nullable: true
        bonus:
          $ref: '#/components/schemas/Bonus'
        bonusId:
          type: string
        customer:
          $ref: '#/components/schemas/Customer'
        netAmountInUSD:
          type: number
          nullable: true
        creditedAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        comment:
          type: string
          nullable: true
        amount:
          type: number
        currency:
          type: string
        adminId:
          type: string
          nullable: true
        admin:
          $ref: '#/components/schemas/Customer'
        walletAddress:
          type: string
          nullable: true
        walletId:
          type: number
        wallet:
          $ref: '#/components/schemas/Wallet'
        clientIpAddress:
          type: string
          nullable: true
        addToCredit:
          type: boolean
        mobilenumber:
          type: string
          nullable: true
        discountCodeId:
          type: string
          nullable: true
        countryCode:
          type: string
          nullable: true
        reviewerCountryCode:
          type: string
          nullable: true
        withdrawalReview:
          type: object
          properties:
            status:
              type: string
              enum:
                - approved
                - rejected
                - refunded
            reviewerId:
              type: string
            reviewedAt:
              type: string
              format: date-time
            reviewerIp:
              type: string
        conversionFrom:
          type: string
          nullable: true
        conversionFromAmount:
          type: number
          nullable: true
        conversionTo:
          type: string
          nullable: true
        conversionToAmount:
          type: number
          nullable: true
        conversionRate:
          type: number
          nullable: true
        conversionSource:
          type: string
          enum:
            - Manual
            - OpenExchangeRates
            - null
        conversionDate:
          type: string
          format: date-time
          nullable: true
        pspExtra:
          type: object
          properties:
            additionalProperties:
              type: string
        counterpartReference:
          type: object
          properties:
            entity:
              type: string
              nullable: true
            id:
              type: string
              nullable: true
    Wallet:
      type: object
      properties:
        id:
          type: number
        customerId:
          type: string
        customer:
          $ref: '#/components/schemas/Customer'
        platform:
          type: string
          enum:
            - NEO
            - PRO
        status:
          type: string
          enum:
            - ACTIVE
            - DISABLED
        currency:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/Transaction'
        groupId:
          type: number
        group:
          $ref: '#/components/schemas/Group'
        leverage:
          type: number
        isDemo:
          type: boolean
        instrumentWatchlist:
          type: array
          items:
            $ref: '#/components/schemas/InstrumentWatchlist'
    InstrumentWatchlist:
      type: object
      properties:
        id:
          type: number
        symbol:
          type: string
        wallet:
          $ref: '#/components/schemas/Wallet'
        walletId:
          type: number
    Group:
      type: object
      properties:
        id:
          type: number
        name:
          type: string
        createdAt:
          type: string
          format: date-time
        depositCurrency:
          type: string
        leverage:
          type: number
        subscriptions:
          type: array
          items:
            $ref: '#/components/schemas/Wallet'
        groupAdmins:
          type: array
          items:
            $ref: '#/components/schemas/GroupAdmin'
    GroupAdmin:
      type: object
      properties:
        id:
          type: number
        customerId:
          type: string
        customer:
          $ref: '#/components/schemas/Customer'
        groupId:
          type: number
        group:
          $ref: '#/components/schemas/Group'
    Customer:
      type: object
      properties:
        id:
          type: string
        firstname:
          type: string
        lastname:
          type: string
        email:
          type: string
          format: email
        mobilenumber:
          type: string
          nullable: true
        country:
          type: string
        introducerId:
          type: string
          nullable: true
        introducer:
          $ref: '#/components/schemas/Customer'
          nullable: true
        conversionAgentId:
          type: string
          nullable: true
        conversionAgent:
          $ref: '#/components/schemas/Customer'
          nullable: true
        retentionAgentId:
          type: string
          nullable: true
        retentionAgent:
          $ref: '#/components/schemas/Customer'
          nullable: true
        conversionSalesTo:
          type: array
          items:
            $ref: '#/components/schemas/Customer'
        retentionSalesTo:
          type: array
          items:
            $ref: '#/components/schemas/Customer'
        salesDeskId:
          type: string
          nullable: true
        salesDesk:
          $ref: '#/components/schemas/SalesDesk'
          nullable: true
        status:
          type: string
          enum:
            - PENDING
            - ACTIVE
            - DISABLED
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        refKey:
          type: string
        refreshToken:
          type: string
          nullable: true
        refreshTokenExpiresAt:
          type: string
          format: date-time
          nullable: true
        notes:
          type: string
        roles:
          type: array
          items:
            type: string
            enum:
              - ADMIN
              - TRADER
              - AFFILIATE
              - LEADER
              - SALES
              - GROUP_ADMIN
        marketingExtra:
          type: object
          properties:
            appInstalledAt:
              type: string
              format: date-time
              nullable: true
            wantsToBecomeLeader:
              type: boolean
              nullable: true
        kycReviewedAt:
          type: string
          format: date-time
          nullable: true
        sumsubDetails:
          type: object
          properties:
            additionalProperties:
              type: string
        commissionSchemeId:
          type: string
        kycStatus:
          type: string
          enum:
            - PENDING
            - APPROVED
            - REJECTED
          nullable: true
        lastTradingActivityDate:
          type: string
          format: date-time
          nullable: true
        confirmToken:
          type: string
          nullable: true
        confirmedAt:
          type: string
          format: date-time
          nullable: true
        communicationLanguage:
          type: string
          default: en
        profilePicture:
          type: string
          nullable: true
        source:
          type: string
          nullable: true
        hasFTD:
          type: boolean
          default: false
        riskStatus:
          type: string
          enum:
            - NONE
            - REVIEW
          nullable: true
        externalId:
          type: string
          nullable: true
        terminationRequestedAt:
          type: string
          format: date-time
          nullable: true
    SalesDesk:
      type: object
      properties:
        salesPeople:
          type: array
          items:
            $ref: '#/components/schemas/Customer'
        id:
          type: string
        name:
          type: string
    CommissionModel:
      type: object
      properties:
        id:
          type: number
        name:
          type: string
        subCommissionModelId:
          type: number
          nullable: true
        subCommissionModel:
          $ref: '#/components/schemas/CommissionModel'
          nullable: true
        greyLabelingEnabled:
          type: boolean
        commissionModelLevels:
          type: array
          items:
            $ref: '#/components/schemas/CommissionModelLevel'
        default:
          type: boolean
    AnalyticsDownlineStat:
      type: object
      properties:
        downloads:
          type: string
        level:
          type: number
        pushNotifications:
          type: string
        registrations:
          type: string
        totalDeposits:
          type: string
    Lead:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        email:
          type: string
          format: email
          nullable: true
        mobilenumber:
          type: string
          nullable: true
        source:
          type: string
        salesPersonId:
          type: string
          nullable: true
        salesPerson:
          $ref: '#/components/schemas/Customer'
          nullable: true
        salesStatusId:
          type: number
          nullable: true
        salesStatus:
          $ref: '#/components/schemas/SalesStatus'
          nullable: true
        createdAt:
          type: string
          format: date-time
        lastContactAt:
          type: string
          format: date-time
          nullable: true
        lastModifiedAt:
          type: string
          format: date-time
          nullable: true
        country:
          type: string
          nullable: true
        comments:
          type: array
          items:
            type: object
            properties:
              id:
                type: number
              comment:
                type: string
              createdAt:
                type: string
                format: date-time
              commentingCustomerId:
                type: string
              commentingCustomer:
                $ref: '#/components/schemas/Customer'
              commentedLeadId:
                type: string
              commentedLead:
                $ref: '#/components/schemas/Lead'
        communicationsReceived:
          type: array
          items:
            type: object
            $ref: '#/components/schemas/LeadCommunicationDTO'
        signupCode:
          type: object
          properties:
            id:
              type: string
            salesPersonId:
              type: string
              nullable: true
            salesPerson:
              $ref: '#/components/schemas/Customer'
              nullable: true
            leadId:
              type: string
              nullable: true
            lead:
              $ref: '#/components/schemas/Lead'
              nullable: true
            code:
              type: string
            isUsed:
              type: boolean
    CreateUserDTO:
      type: object
      properties:
        firstname:
          type: string
        lastname:
          type: string
        email:
          type: string
          format: email
        mobilenumber:
          type: string
        country:
          type: string
        communicationLanguage:
          type: string
        wtreferrer:
          type: string
          nullable: true
        wants_to_become_leader:
          type: boolean
          nullable: true
        skipOnboardingSteps:
          type: array
          items:
            type: string
            enum:
              - SignupDemoForm
              - SignupRealForm
              - CompleteAccountBeforeDepositForm
              - CompleteAccountBeforeWithdrawalForm
              - EmailConfirmation
              - KYC
              - PhoneConfirmation
              - DisclaimerBeforeDeposit
          nullable: true
        source:
          type: string
          nullable: true
    UpdateUserDTO:
      type: object
      properties:
        firstname:
          type: string
          nullable: true
        lastname:
          type: string
          nullable: true
        email:
          type: string
          format: email
          nullable: true
        mobilenumber:
          type: string
        country:
          type: string
        communicationLanguage:
          type: string
        newPassword:
          type: string
          nullable: true
        currentPassword:
          type: string
          nullable: true
    ISessionDTO:
      type: object
      properties:
        token:
          type: string
        refreshToken:
          type: string
          nullable: true
        user:
          $ref: '#/components/schemas/IUserDTO'
        outstandingOnboardingSteps:
          type: array
          items:
            $ref: '#/components/schemas/OnboardingStepConfiguration'
    IBasicWalletWithBalanceDTO:
      allOf:
        - $ref: '#/components/schemas/Wallet'
        - type: object
          properties:
            balance:
              type: string
            credit:
              type: string
            equity:
              type: string
    IWalletWithBalanceDTO:
      allOf:
        - $ref: '#/components/schemas/Wallet'
        - type: object
          properties:
            balance:
              type: string
            credit:
              type: string
            equity:
              type: string
            margin:
              type: string
            marginFree:
              type: string
    IWalletWithTransactionsDTO:
      type: object
      properties:
        wallet:
          $ref: '#/components/schemas/IBasicWalletWithBalanceDTO'
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/ITransactionDTO'
      required:
        - wallet
        - transactions
    CreateCustomerTransactionDTO:
      type: object
      properties:
        type:
          type: string
          enum:
            - DEPOSIT
            - WITHDRAWAL
            - BONUS
            - CORRECTION
        currency:
          type: string
          enum:
            - USD
        method:
          type: string
        comment:
          type: string
        addToCredit:
          type: boolean
        amount:
          type: number
    CreateWalletDTO:
      type: object
      properties:
        customerId:
          type: string
        groupId:
          type: number
        platform:
          type: string
          enum:
            - NEO
            - PRO
        leverage:
          type: number
        isDemo:
          type: boolean
    IWalletBalanceResponse:
      type: object
      properties:
        balance:
          type: string
        credit:
          type: string
        equity:
          type: string
        currency:
          type: string
    IBasicWalletDTO:
      type: object
      properties:
        id:
          type: number
        currency:
          type: string
        platform:
          type: string
          enum:
            - NEO
            - PRO
        type:
          type: string
          enum:
            - REAL
            - DEMO
        status:
          type: string
          enum:
            - ACTIVE
            - DISABLED
        primary:
          type: boolean
          nullable: true
        isDemo:
          type: boolean
    UserCreateWalletDTO:
      type: object
      properties:
        leverage:
          type: string
        currency:
          type: string
        isDemo:
          type: boolean
    CreateWithdrawalDTO:
      type: object
      properties:
        provider:
          type: string
        currency:
          type: string
          enum:
            - USD
        amount:
          type: number
        walletAddress:
          type: string
    TransferMoneyDTO:
      type: object
      properties:
        method:
          type: string
          enum:
            - bitstamp
            - trustology
        address:
          type: string
        amount:
          type: number
    WalletTransferDTO:
      type: object
      properties:
        sourceWalletId:
          type: number
        targetWalletId:
          type: number
        amount:
          type: number
    IAdminWalletWithPerformance:
      type: object
      properties:
        wallet:
          $ref: '#/components/schemas/IWalletWithBalanceDTO'
        performance:
          type: object
          properties:
            day:
              type: string
            balance:
              type: string
            credit:
              type: string
    IReferredCustomerDTO:
      type: object
      properties:
        id:
          type: string
        level:
          type: number
        accountId:
          type: number
        firstname:
          type: string
          nullable: true
        lastname:
          type: string
          nullable: true
        name:
          type: string
          nullable: true
        email:
          type: string
          format: email
          nullable: true
        mobilenumber:
          type: string
          nullable: true
        depositTotal:
          type: string
        percent:
          type: number
        totalCoinsEarned:
          type: number
        country:
          type: string
        countryName:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        status:
          type: string
          enum:
            - PENDING
            - ACTIVE
            - DISABLED
        appInstalledAt:
          type: string
          format: date-time
          nullable: true
        totalCommission:
          type: number
        availableContactMethods:
          type: array
          items:
            type: string
        lastLoginDate:
          type: string
          format: date-time
          nullable: true
        totalLogins:
          type: number
        notes:
          type: string
          nullable: true
        directAffiliate:
          type: object
          properties:
            id:
              type: string
            name:
              type: string
          nullable: true
        totalReferrals:
          type: number
        hasFTD:
          type: boolean
        externalId:
          type: string
          nullable: true
        salesStatus:
          type: string
          nullable: true
        source:
          type: string
          nullable: true
    IReferredCustomerWithBookmarkDTO:
      allOf:
        - $ref: '#/components/schemas/IReferredCustomerDTO'
        - type: object
          properties:
            bookmarked:
              type: boolean
    ReportEntry:
      type: object
      properties:
        data: {}
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
        currency:
          type: string
        count:
          type: number
    AdminActivitiesFilters:
      type: object
      properties:
        actions:
          type: array
          items: null
          $ref: '#/components/schemas/AdminActivityAction'
        createdAt:
          type: object
          properties:
            startDate:
              type: string
              format: date-time
            endDate:
              type: string
              format: date-time
        actedAs:
          $ref: '#/components/schemas/UserRole'
        types:
          type: array
          items:
            $ref: '#/components/schemas/AffectedObjectType'
    ILoyaltyLevelDTO:
      type: object
      properties:
        currentLevel:
          type: number
        currentLevelName:
          type: string
        totalCoinsMonth:
          type: number
        awardedAt:
          type: string
          format: date-time
        validUntil:
          type: string
          format: date-time
        coinsRequiredToRetain:
          type: number
        coinsUntilNextLevel:
          type: number
          nullable: true
        currentLevelRealMoney:
          type: number
    ISessionUserDTO:
      allOf:
        - $ref: '#/components/schemas/IUserDTO'
        - type: object
          properties:
            loyaltyLevel:
              $ref: '#/components/schemas/ILoyaltyLevelDTO'
    IWalletDTO:
      type: object
      properties:
        id:
          type: number
        customer:
          $ref: '#/components/schemas/Customer'
        platform:
          type: string
          enum:
            - NEO
            - PRO
        status:
          type: string
          enum:
            - ACTIVE
            - DISABLED
        currency:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        group:
          $ref: '#/components/schemas/Group'
        leverage:
          type: number
        isDemo:
          type: boolean
    UpdateWalletDTO:
      type: object
      properties:
        groupId:
          type: number
        leverage:
          type: number
    UpdateSalesDeskDTO:
      type: object
      properties:
        name:
          type: string
    CreateSalesDeskDTO:
      type: object
      properties:
        name:
          type: string
    AffiliateCreateCustomerDTO:
      type: object
      properties:
        externalId:
          type: string
          nullable: true
          description: >-
            Optional - Unique identifier in your system to track and query the
            customer
        firstname:
          type: string
        lastname:
          type: string
        mobilenumber:
          type: string
        email:
          type: string
          format: email
        wtreferrer:
          type: string
          nullable: true
        country:
          type: string
        password:
          type: string
          nullable: true
          description: Optional - will be auto-generated if not provided
        communicationLanguage:
          type: string
        skipOnboardingSteps:
          type: array
          items:
            type: string
            enum:
              - SignupDemoForm
              - SignupRealForm
              - CompleteAccountBeforeDepositForm
              - CompleteAccountBeforeWithdrawalForm
              - EmailConfirmation
              - KYC
              - PhoneConfirmation
              - DisclaimerBeforeDeposit
        source:
          type: string
    BulkUpdateDTO:
      allOf:
        - $ref: '#/components/schemas/FetchLeadFilters'
      type: object
      properties:
        selectedStatus:
          type: number
          nullable: true
        selectedSalesPerson:
          type: string
          nullable: true
        search:
          type: string
          nullable: true
    FetchLeadFilters:
      type: object
      properties:
        statuses:
          type: array
          items:
            type: string
          description: List of statuses
        salesPeople:
          type: array
          items:
            type: string
          description: List of sales people
        sources:
          type: array
          items:
            type: string
          description: List of sources
        onlyAssignedToMe:
          type: boolean
          description: Filter for assignments to the user
        country:
          type: string
          pattern: ^[A-Z]{2}$
          description: Country code (ISO 3166-1 alpha-2)
        modifiedBefore:
          type: string
          description: Filter for modifications before a specific date
        modifiedAfter:
          type: string
          description: Filter for modifications after a specific date
    RemoteStartFunnelDTO:
      type: object
      properties:
        email:
          type: string
        firstName:
          type: string
        lastName:
          type: string
        phone:
          type: string
          description: >-
            Phone number in international format as number string with prefix
            (E.G. +49123456789)
        countryIso:
          type: string
          description: Country ISO CODE (E.G. CY)
        utmSource:
          type: string
          description: >-
            UTM source for tracking purposes. It will also be set as customer's
            source if it is passed to the remote-start endpoint during
            customer's initial creation. All subsequent calls to the API
            (purchases of new funnels) will not update customer source, but only
            track UTM source on each transaction.
        utmMedium:
          type: string
        utmContent:
          type: string
        utmCampaign:
          type: string
        utmTerm:
          type: string
        trackingCampaignId:
          type: string
        wtreferrer:
          type: string
          description: >-
            Referral code from our system which can be used for automatic
            assignment of introducer and sales agents(More info in docs under
            sales feature).
        transactionDetails:
          type: object
          properties:
            price:
              type: number
            transactionId:
              type: string
