title: Customer Tier Achievement
type: object
x-tags:
  - Models
description: A durable record of first tier attainment, its immutable configured gifts and their final outcomes.
required:
  - uuid
  - customer_tier_uuid
  - trigger_order_uuid
  - source
  - tier_name
  - currency_code
  - spending_requirement
  - qualifying_spend_at_achievement
  - benefits
  - benefit_outcomes
  - achieved_at
  - benefits_awarded_at
properties:
  uuid:
    type: string
    format: uuid
    readOnly: true
    description: The unique identifier of this tier achievement.
  customer_tier_uuid:
    type: string
    format: uuid
    readOnly: true
    description: The UUID of the attained customer tier.
  trigger_order_uuid:
    type:
      - string
      - 'null'
    format: uuid
    readOnly: true
    description: The order that triggered this achievement, or `null` for an existing, default, or manual assignment.
  source:
    type: string
    enum:
      - existing_assignment
      - default_assignment
      - manual_assignment
      - automatic_order
    readOnly: true
    description: How this achievement was recorded.
  tier_name:
    type: string
    minLength: 1
    maxLength: 255
    readOnly: true
    description: The tier name captured when it was attained.
  currency_code:
    type: string
    minLength: 3
    maxLength: 3
    readOnly: true
    description: The ISO 4217 alpha-3 currency code used by all monetary fields in this achievement.
  spending_requirement:
    oneOf:
      - type: 'null'
      - allOf:
          - $ref: ./Money.yaml
          - type: object
            properties:
              amount:
                minimum: 1
                maximum: 4294967295
    readOnly: true
    description: The tier's spending requirement captured when it was attained.
  qualifying_spend_at_achievement:
    allOf:
      - $ref: ./Money.yaml
      - type: object
        properties:
          amount:
            minimum: 0
    readOnly: true
    description: The customer's lifetime qualifying spend when the tier was attained.
  benefits:
    type: array
    minItems: 0
    readOnly: true
    description: The configured gifts captured when the tier was attained, including gifts that were skipped.
    items:
      allOf:
        - $ref: ./CustomerTierBenefit.yaml
        - required:
            - loyalty_program_uuid
            - monetary_amount
            - quantity
  benefit_outcomes:
    type:
      - array
      - 'null'
    readOnly: true
    description: |-
      Final outcomes in benefits order, linked by zero-based benefit_index. Null means outcomes were not recorded
      (including existing historical achievements); an empty list means processing completed with no gifts.
      Successful outcomes identify the actual balance/batch and ledger movement. Skips create neither a movement nor
      pending fulfilment. Unexpected persistence failures roll back the whole assignment/purchase instead of becoming skips.
    items:
      $ref: ./CustomerTierBenefitOutcome.yaml
  achieved_at:
    type: string
    format: date-time
    readOnly: true
    description: The UTC date-time at which the tier was attained.
  benefits_awarded_at:
    type:
      - string
      - 'null'
    format: date-time
    readOnly: true
    description: The UTC date-time when benefit processing finished, or `null` while it is incomplete. Business skips are final and do not prevent
      the upgrade or remaining gifts. This timestamp does not imply every configured gift was awarded.
