title: Quantity Configuration Input
x-tags:
  - Models
description: "Select exactly one earning mode. Money uses the unit program currency. Supplying configuration replaces
  all terms and lists: omitted exchange_options, earning_bonuses and redemption_options become empty. Omitting the whole
  configuration on edit retains it. Purchases use frozen first-evaluation terms, including zero awards."

oneOf:
  - title: Product quantity
    type: object
    required:
      - earning_mode
      - products
    properties:
      earning_mode:
        type: string
        enum:
          - product_quantity
      products:
        type: array
        minItems: 1
        items:
          $ref: ./LoyaltyProduct.yaml
      minimum_eligible_spend:
        type: "null"
      spend_interval:
        type: "null"
      validity_period_in_days: &a1
        type:
          - integer
          - "null"
        minimum: 1
        maximum: 3650
        description: Validity for unit credits from processing time, including earning, manual additions and tier gifts.
          A credit never shortens an existing positive pool's validity. Keep the later of the current expiry and the new
          expiry; an existing no-expiry pool remains unlimited. Null or omitted validity removes a finite expiry. Empty
          or expired pools use the configured validity for the new credit. Purchase base and bonus units renew together.
      earning_bonuses: &quantityEarningBonuses
        type: array
        maxItems: 50
        description: Optional purchase bonuses, using whole-order eligible spend after discounts. Product-mode programs with any
          spend bonuses also require eligible_amount on applicable captures. The greatest qualifying bonus allowed for
          the resulting tier is added once only after a positive base unit award. An empty list disables purchase
          bonuses.
        items:
          $ref: ./QuantityEarningBonusInput.yaml
      exchange_options: &a2
        type: array
        default: []
        description: Zero or more voucher rewards. An empty list is permitted. Supplying configuration replaces this complete
          list; retain each existing option UUID to preserve its identity. New options may omit UUID and receive a
          generated identity. Destination availability and lifetime issuance limits are enforced when exchanging,
          independently of configuration validity.
        items:
          type: object
          required:
            - quantity_cost
            - voucher_program_uuid
          properties:
            uuid:
              type:
                - string
                - "null"
              format: uuid
              description: Stable option identity within this program. Retained when supplied; generated when omitted or null. Option
                UUIDs must be unique within the program.
            quantity_cost:
              type: integer
              minimum: 1
              maximum: 2147483647
            voucher_program_uuid:
              type: string
              format: uuid
              description: Existing voucher program belonging to the same merchant and using the same currency. Archived or currently
                unavailable destinations may be configured.
      redemption_options:
        type: array
        default: []
        description: Direct order discounts sharing the unit pool with voucher exchanges. Retain option UUIDs through edits.
          Pool expiry supplies validity; there are no separate option dates or issuance limits. An empty list disables
          direct redemption without removing exchanges.
        items:
          $ref: ./QuantityRedemptionOptionInput.yaml
  - title: Order
    type: object
    required:
      - earning_mode
    properties:
      earning_mode:
        type: string
        enum:
          - order
      products:
        type:
          - array
          - "null"
        maxItems: 0
        description: Omit or supply null when products do not apply. An empty input array is also accepted and normalized to
          null in the saved configuration.
      minimum_eligible_spend:
        oneOf:
          - type: "null"
          - $ref: ./PositiveMoney.yaml
        description: Optional positive minimum eligible spend for one unit per qualifying completed order. Null means no
          monetary minimum.
      spend_interval:
        type: "null"
      validity_period_in_days: *a1
      earning_bonuses: *quantityEarningBonuses
      exchange_options: *a2
      redemption_options:
        type: array
        default: []
        description: Direct order discounts sharing the unit pool with voucher exchanges. Retain option UUIDs through edits.
          Pool expiry supplies validity; there are no separate option dates or issuance limits. An empty list disables
          direct redemption without removing exchanges.
        items:
          $ref: ./QuantityRedemptionOptionInput.yaml
  - title: Spend interval
    type: object
    required:
      - earning_mode
      - spend_interval
    properties:
      earning_mode:
        type: string
        enum:
          - spend_interval
      products:
        type:
          - array
          - "null"
        maxItems: 0
        description: Omit or supply null when products do not apply. An empty input array is also accepted and normalized to
          null in the saved configuration.
      minimum_eligible_spend:
        type: "null"
      spend_interval:
        $ref: ./PositiveMoney.yaml
        description: Positive eligible monetary spend required for each unit. No remainder carries between orders.
      validity_period_in_days: *a1
      earning_bonuses: *quantityEarningBonuses
      exchange_options: *a2
      redemption_options:
        type: array
        default: []
        description: Direct order discounts sharing the unit pool with voucher exchanges. Retain option UUIDs through edits.
          Pool expiry supplies validity; there are no separate option dates or issuance limits. An empty list disables
          direct redemption without removing exchanges.
        items:
          $ref: ./QuantityRedemptionOptionInput.yaml
