title: Marketing Campaign
type: object
required:
  - uuid
  - name
  - state
  - template_submission_uuid
  - audience
  - destination
  - scheduled_at
  - scheduled_timezone
  - launched_at
  - hold_reason
  - recipient_count
  - created_at
properties:
  uuid: &a1
    type: string
    format: uuid
  name:
    type: string
    minLength: 1
    maxLength: 255
    example: Weekend offers
  state:
    $ref: ./MarketingCampaignState.yaml
  template_submission_uuid:
    type: &a2
      - string
      - "null"
    format: uuid
    description: The pinned submission UUID. Null if the original submission is unavailable.
  audience:
    type: object
    required:
      - type
      - tier_uuids
    properties:
      type:
        type: string
        enum:
          - all_eligible
          - selected_tiers
      tier_uuids:
        type: array
        items: *a1
        uniqueItems: true
        description: Complete list of active loyalty tier UUIDs owned by the merchant. UUID comparison ignores case.
  destination:
    type: object
    required:
      - type
      - web_url
      - message_automation_uuid
    properties:
      type:
        type: string
        enum:
          - web_url
          - message_automation
      web_url:
        type:
          - string
          - "null"
        format: uri
        pattern: "^[Hh][Tt][Tt][Pp][Ss]://"
        maxLength: 2048
        example: https://example.com/offers
      message_automation_uuid:
        type: *a2
        format: uuid
  scheduled_at:
    type: &a3
      - string
      - "null"
    format: date-time
    description: The scheduled start in UTC.
  scheduled_timezone:
    type:
      - string
      - "null"
    example: Asia/Singapore
    description: The merchant timezone recorded when scheduling.
  launched_at:
    type: *a3
    format: date-time
  hold_reason:
    type:
      - string
      - "null"
    description: The current reason the campaign is waiting or held.
  recipient_count:
    type: integer
    minimum: 0
    description: The fixed audience count after launch.
  created_at:
    type: string
    format: date-time
x-tags:
  - Models
