version: 2
models:
  - name: STG_TIKTOK_ADS__AD_HISTORY_DBT
    description: Staging model to store historical TikTok Ads Ad's data.
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: ID
        description: Tiktok Ad id
        tests:
          - not_null
      - name: NAME
        description: Tiktok Ad Name
        tests:
          - not_null
      - name: ACCOUNT_ID
        description: Tiktok Advertiser ID
        tests:
          - not_null
      - name: AD_SET_ID
        description: Tiktok Campaign Ad Set ID where this ad was used in
        tests:
          - not_null
      - name: CAMPAIGN_ID
        description: Tiktok Campaign ID where this ad was used in
        tests:
          - not_null
      - name: CREATIVE_ID
        description: Tiktok Ad's Creative ID
      - name: STATUS
        description: Tiktok Ad's status
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: ['ENABLE', 'DISABLE', 'FROZEN']
      - name: SECONDARY_STATUS
        description: Tiktok Ad's secondary status
      - name: VIDEO_ID
        description: TikTok Video ID (internal). It is NULL when an organic post is used for an ad instead.
      - name: TIKTOK_ITEM_ID
        description: TikTok public post id, in case an organic post is used for an ad.
      - name: UPDATED_AT
        description: Timestamp of the last ad's data was updated by Tiktok
        tests:
          - not_null
      - name: IS_MOST_RECENT_RECORD
        description: Whether the row is the most recent record for a given source schema and ad.
        tests:
          - not_null
  - name: STG_TIKTOK_ADS__AD_SET_HISTORY_DBT
    description: Staging model to store historical TikTok Ads Ad Set's data.
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: ID
        description: Tiktok Ad set id
        tests:
          - not_null
      - name: NAME
        description: Tiktok Ad set Name
        tests:
          - not_null
      - name: ACCOUNT_ID
        description: Tiktok Advertiser ID
        tests:
          - not_null
      - name: CAMPAIGN_ID
        description: Tiktok Campaign ID where this ad was used in
        tests:
          - not_null
      - name: STATUS
        description: Tiktok Ad Set status
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: ['ENABLE', 'DISABLE', 'FROZEN']
      - name: SECONDARY_STATUS
        description: Tiktok Ad Set secondary status
      - name: START_AT
        description: Timestamp when this ad set was scheduled to start
        tests:
          - not_null
      - name: END_AT
        description: Timestamp when this ad set was scheduled to end
        tests:
          - not_null
      - name: OPTIMIZATION_GOAL
        description: Tiktok ad set's optimization goal
      - name: BUDGET
        description: Tiktok ad set's budget
        tests:
          - not_null
      - name: BUDGET_MODE
        description: The way Tiktok ad set's budget was used
        tests:
          - not_null
      - name: UPDATED_AT
        description: Timestamp of the last ad's data was updated by Tiktok
        tests:
          - not_null
      - name: IS_MOST_RECENT_RECORD
        description: Whether the row is the most recent record for a given source schema and ad.
        tests:
          - not_null
  - name: STG_TIKTOK_ADS__CAMPAIGN_HISTORY_DBT
    description: Staging model to store historical TikTok Ads Campaign's data.
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: ID
        description: Tiktok Ad campaign id
        tests:
          - not_null
      - name: NAME
        description: Tiktok Ad campaign Name
        tests:
          - not_null
      - name: ACCOUNT_ID
        description: Tiktok Advertiser ID
        tests:
          - not_null
      - name: STATUS
        description: Tiktok Campaign status
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: ['ENABLE', 'DISABLE']
      - name: SECONDARY_STATUS
        description: Tiktok Campaign secondary status
        tests:
          - not_null
      - name: OBJECTIVE
        description: Tiktok Campaign's objective
        tests:
          - not_null
      - name: BUDGET
        description: Tiktok Campaign's budget
        tests:
          - not_null
      - name: BUDGET_MODE
        description: Tiktok Campaign's budget mode
        tests:
          - not_null
      - name: CREATED_AT
        description: Timestamp of the campaign creation
        tests:
          - not_null
      - name: UPDATED_AT
        description: Timestamp of the last campaign's data was updated by Tiktok
        tests:
          - not_null
      - name: IS_MOST_RECENT_RECORD
        description: Whether the row is the most recent record for a given source schema and ad.
        tests:
          - not_null
  - name: STG_TIKTOK_ADS__ACCOUNT_HISTORY_DBT
    description: Staging model to store historical TikTok Ads Advertiser's account data
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: ID
        description: Tiktok Advertiser ID
        tests:
          - not_null
      - name: NAME
        description: Tiktok Advertiser name
        tests:
          - not_null
      - name: COMPANY
        description: Tiktok Advertiser Company name
        tests:
          - not_null
      - name: CURRENCY
        description: Tiktok Advertiser main currency
        tests:
          - not_null
      - name: IS_MOST_RECENT_RECORD
        description: Whether the row is the most recent record for a given source schema and ad.
        tests:
          - not_null
  - name: STG_TIKTOK_ADS__AD_DBT
    description: Staging model to store daily historical TikTok Ads Ad performance data .
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: ID
        description: Tiktok Ad id
        tests:
          - not_null
      - name: REPORT_DATE
        description: Date when performance was evaluated
        tests:
          - not_null
      - name: IMPRESSIONS
        description: number of Tiktok Ad's impressions
        tests:
          - not_null
      - name: CLICKS
        description: number of Tiktok Ad's clicks
        tests:
          - not_null
      - name: FOLLOWS
        description: number of Tiktok Ad's generated follows
        tests:
          - not_null
      - name: VIDEO_WATCHED_6_S
        description: number of Tiktok Ad's times video watched for 6s+
        tests:
          - not_null
      - name: ENGAGED_VIEW
        description: 6-second views (focused view)
        tests:
          - not_null
      - name: ON_WEB_ORDER
        description: number of place an order events
        tests:
          - not_null
      - name: REACH
        description: number of Tiktok Ad's fans reached
        tests:
          - not_null
      - name: SPEND
        description: money spend for the given for that date
        tests:
          - not_null
      - name: LIKES
        description: Likes metric.
      - name: SHARES
        description: TikTok Ads Shares
      - name: COMMENTS
        description: TikTok Ads Comments
      - name: PROFILE_VISITS
        description: TikTok Ads Profile Visits
      - name: CLICKS_ON_MUSIC
        description: TikTok Ads Music Clicks
      - name: SYNCED_AT
        description: last time Tiktok Ad's information was synced
        tests:
          - not_null
      - name: IS_MOST_RECENT_RECORD
        description: Whether the row is the most recent record for a given source schema and ad.
        tests:
          - not_null
  - name: STG_TIKTOK_ADS__AD_COUNTRY_DBT
    description: Staging model to store daily historical TikTok Ads Ad performance data .
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - SOURCE_SCHEMA
              - ID
              - REPORT_DATE
              - COUNTRY_CODE
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: ID
        description: Tiktok Ad id
        tests:
          - not_null
      - name: REPORT_DATE
        description: Date when performance was evaluated
        tests:
          - not_null
      - name: COUNTRY_CODE
        description: Tiktok Ad Country (ISO2 or UNKNOWN)
        tests:
          - not_null
      - name: IMPRESSIONS
        description: number of Tiktok Ad's impressions
        tests:
          - not_null
      - name: CLICKS
        description: number of Tiktok Ad's clicks
        tests:
          - not_null
      - name: CONVERSION
        description: number of Tiktok Ad's conversions
        tests:
          - not_null
      - name: FOLLOWS
        description: number of Tiktok Ad's generated follows
        tests:
          - not_null
      - name: VIDEO_WATCHED_6_S
        description: number of Tiktok Ad's times video watched for 6s+
        tests:
          - not_null
      - name: ENGAGED_VIEW
        description: 6-second views (focused view)
        tests:
          - not_null
      - name: REACH
        description: number of Tiktok Ad's fans reached
        tests:
          - not_null
      - name: SPEND
        description: money spend for the given for that date
        tests:
          - not_null
      - name: LIKES
        description: Likes metric.
        tests:
          - not_null
      - name: SHARES
        description: TikTok Ads Shares
      - name: COMMENTS
        description: TikTok Ads Comments
      - name: PROFILE_VISITS
        description: TikTok Ads Profile Visits
      - name: CLICKS_ON_MUSIC
        description: TikTok Ads Music Clicks
      - name: SYNCED_AT
        description: last time Tiktok Ad's information was synced
        tests:
          - not_null
      - name: IS_MOST_RECENT_RECORD
        description: Whether the row is the most recent record for a given source schema and ad.
        tests:
          - not_null
