version: 2
models:
  - name: TIKTOK_ADS__AD_DBT
    description: Staging model to store historical TikTok Ads Ad's data.
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - SOURCE_SCHEMA
              - ID
    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: CAMPAIGN_ID
        description: Tiktok Campaign ID
        tests:
          - not_null
      - name: CAMPAIGN_NAME
        description: Tiktok Campaign Name
        tests:
          - not_null
      - name: CAMPAIGN_GLOBAL_PARTICIPANT_ID
        description: Tiktok Campaign Global Participant ID
      - name: OBJECTIVE
        description: Tiktok Campaign Objective
        tests:
          - not_null
      - name: AD_SET_ID
        description: Tiktok Campaign Ad Set ID
        tests:
          - not_null
      - name: AD_SET_NAME
        description: Tiktok Campaign Ad Set Name
        tests:
          - not_null
      - name: AD_SET_START_AT
        description: Tiktok Campaign Ad Set Start timestamp
        tests:
          - not_null
      - name: AD_SET_END_AT
        description: Tiktok Campaign Ad Set End timestamp
        tests:
          - not_null
      - 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
        tests:
          - not_null
      - name: REPORTING_URL
        description: TikTok Reporting URL (format TBD)
        tests:
          - not_null
      - name: LOCATION
        description: list of countries the Ad is running in
        tests:
          - not_null
      - name: TIKTOK_POST_ID
        description: TikTok public post id, in case an organic post is used for an ad.
      - name: VIDEO_PREVIEW_URL
        description: TikTok Video preview URL
      - name: CLICKS
        description: number of Tiktok Ad's clicks
        tests:
          - not_null
      - name: IMPRESSIONS
        description: number of Tiktok Ad's impressions
        tests:
          - not_null
      - name: REACH
        description: number of Tiktok Ad's fans reached
        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: SPEND
        description: money spend for the given for that date
        tests:
          - not_null
      - name: SPEND_USD
        description: money spend for the given for that date in USD
        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: RESULT
        description: Result metric.
        tests:
          - not_null
      - name: COMPLETE_PAYMENT
        description: Complete Payment metric.
        tests:
          - not_null
      - name: PURCHASES
        description: Purchase metric.
        tests:
          - not_null
      - name: CHECKOUT
        description: Checkout metric.
        tests:
          - not_null
      - name: AVERAGE_VIDEO_PLAY
        description: Average video play metric.
      - name: AVERAGE_VIDEO_PLAY_PER_USER
        description: Average video play per user metric.
      - name: SYNCED_AT
        description: last time Tiktok Ad's information was synced
        tests:
          - not_null
      - name: MIN_REPORT_DATE
        description: The earliest report date for this entity
        tests:
          - not_null
      - name: MAX_REPORT_DATE
        description: The latest report date for this entity
        tests:
          - not_null
      - name: ACTION_TYPE
        description: Type of the action used to calculate the rate of the given ad
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: [ 'VIEWS', 'CLICKS', 'FOLLOWS', 'REACH', 'ORDERS_PLACED' ]
      - name: ACTIONS
        description: How many actions of the action_type happened for the ad
        tests:
          - not_null
      - name: RATE_TYPE
        description: What is the rate type we calculate for given ad
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: ['VTR', 'CTR', 'FR', 'FREQUENCY']
      - name: RATE
        description: Numeric value of the rate_type
        tests:
          - not_null
      - name: CTR
        description: Click Through Rate
      - name: FREQUENCY
        description: Impressions / Reach
        tests:
          - not_null
      - name: COST_PER_ACTION
        description: Cost Per Action
        tests:
          - not_null
      - name: COST_PER_ACTION_USD
        description: Cost Per Action in USD
        tests:
          - not_null
      - name: COST_PER_IMPRESSION
        description: Cost Per Impression
        tests:
          - not_null
      - name: COST_PER_IMPRESSION_USD
        description: Cost Per Impression in USD
        tests:
          - not_null
  - name: TIKTOK_ADS__AD_COUNTRY_DBT
    description: Staging model to store historical TikTok Ads Ad's data.
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - SOURCE_SCHEMA
              - ID
              - COUNTRY_CODE
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: ID
        description: Tiktok Ad id
        tests:
          - not_null
      - name: COUNTRY_CODE
        description: Tiktok Ad Country (ISO2 or UNKNOWN)
        tests:
          - not_null
      - name: NAME
        description: Tiktok Ad Name
        tests:
          - not_null
      - name: ACCOUNT_ID
        description: Tiktok Advertiser ID
        tests:
          - not_null
      - name: CAMPAIGN_ID
        description: Tiktok Campaign ID
        tests:
          - not_null
      - name: CAMPAIGN_NAME
        description: Tiktok Campaign Name
        tests:
          - not_null
      - name: CAMPAIGN_GLOBAL_PARTICIPANT_ID
        description: Tiktok Campaign Global Participant ID
      - name: OBJECTIVE
        description: Tiktok Campaign Objective
        tests:
          - not_null
      - name: AD_SET_ID
        description: Tiktok Campaign Ad Set ID
        tests:
          - not_null
      - name: AD_SET_NAME
        description: Tiktok Campaign Ad Set Name
        tests:
          - not_null
      - name: AD_SET_START_AT
        description: Tiktok Campaign Ad Set Start timestamp
        tests:
          - not_null
      - name: AD_SET_END_AT
        description: Tiktok Campaign Ad Set End timestamp
        tests:
          - not_null
      - 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
        tests:
          - not_null
      - name: CLICKS
        description: number of Tiktok Ad's clicks
        tests:
          - not_null
      - name: IMPRESSIONS
        description: number of Tiktok Ad's impressions
        tests:
          - not_null
      - name: REACH
        description: number of Tiktok Ad's fans reached
        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: ON_WEB_ORDER
        description: Place holder as data is not available for country specific report.
      - name: SPEND
        description: money spend for the given for that date
        tests:
          - not_null
      - name: SPEND_USD
        description: money spend for the given for that date in USD
        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: RESULT
        description: Result metric.
        tests:
          - not_null
      - name: COMPLETE_PAYMENT
        description: Complete Payment metric.
        tests:
          - not_null
      - name: PURCHASES
        description: Purchase metric.
        tests:
          - not_null
      - name: CHECKOUT
        description: Checkout metric.
        tests:
          - not_null
      - name: AVERAGE_VIDEO_PLAY
        description: Average video play metric.
      - name: SYNCED_AT
        description: last time Tiktok Ad's information was synced
        tests:
          - not_null
      - name: MIN_REPORT_DATE
        description: The earliest report date for this entity
        tests:
          - not_null
      - name: MAX_REPORT_DATE
        description: The latest report date for this entity
        tests:
          - not_null
      - name: ACTION_TYPE
        description: Type of the action used to calculate the rate of the given ad
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: [ 'VIEWS', 'CLICKS', 'FOLLOWS', 'REACH', 'ORDERS_PLACED' ]
      - name: ACTIONS
        description: How many actions of the action_type happened for the ad
        tests:
          - not_null
      - name: RATE_TYPE
        description: What is the rate type we calculate for given ad
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: ['VTR', 'CTR', 'FR', 'FREQUENCY']
      - name: RATE
        description: Numeric value of the rate_type
        tests:
          - not_null
      - name: CTR
        description: Click Through Rate
      - name: FREQUENCY
        description: Impressions / Reach
        tests:
          - not_null
      - name: COST_PER_ACTION
        description: Cost Per Action
        tests:
          - not_null
      - name: COST_PER_ACTION_USD
        description: Cost Per Action in USD
        tests:
          - not_null
      - name: COST_PER_IMPRESSION
        description: Cost Per Impression
        tests:
          - not_null
      - name: COST_PER_IMPRESSION_USD
        description: Cost Per Impression in USD
        tests:
          - not_null
  - name: TIKTOK_ADS__AD_SET_DBT
    description: Staging model to store historical TikTok Ads Ad set's (ADGROUP) 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
        tests:
          - not_null
      - name: CAMPAIGN_NAME
        description: Tiktok Campaign Name
        tests:
          - not_null
      - name: CAMPAIGN_GLOBAL_PARTICIPANT_ID
        description: Tiktok Campaign Global Participant ID
      - name: CAMPAIGN_OBJECTIVE
        description: Tiktok Campaign Objective
        tests:
          - not_null
      - name: START_AT
        description: Tiktok Campaign Ad Set Start timestamp
        tests:
          - not_null
      - name: END_AT
        description: Tiktok Campaign Ad Set End timestamp
        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
        tests:
          - not_null
      - name: DAILY_BUDGET
        description: Ad Set Daily Budget
        tests:
          - not_null:
              arguments:
                where: "DAILY_BUDGET > 0"
      - name: LIFETIME_BUDGET
        description: Ad Set Lifetime Budget
        tests:
          - not_null:
              arguments:
                where: "LIFETIME_BUDGET > 0"
      - name: CAMPAIGN_DAILY_BUDGET
        description: Campaign Daily Budget
        tests:
          - not_null:
              arguments:
                where: "CAMPAIGN_DAILY_BUDGET > 0"
      - name: CAMPAIGN_LIFETIME_BUDGET
        description: Campaign Lifetime Budget
        tests:
          - not_null:
              arguments:
                where: "CAMPAIGN_LIFETIME_BUDGET > 0"
      - name: DAILY_BUDGET_USD
        description: Ad Set Daily Budget in USD
        tests:
          - not_null:
              arguments:
                where: "DAILY_BUDGET is not null"
          - is_null:
              arguments:
                where: "DAILY_BUDGET is null"
      - name: LIFETIME_BUDGET_USD
        description: Ad Set Lifetime Budget in USD
        tests:
          - not_null:
              arguments:
                where: "LIFETIME_BUDGET is not null"
          - is_null:
              arguments:
                where: "LIFETIME_BUDGET is null"
      - name: CAMPAIGN_DAILY_BUDGET_USD
        description: Campaign Daily Budget in USD
        tests:
          - not_null:
              arguments:
                where: "CAMPAIGN_DAILY_BUDGET is not null"
          - is_null:
              arguments:
                where: "CAMPAIGN_DAILY_BUDGET is null"
      - name: CAMPAIGN_LIFETIME_BUDGET_USD
        description: Campaign Lifetime Budget in USD
        tests:
          - not_null:
              arguments:
                where: "CAMPAIGN_LIFETIME_BUDGET is not null"
          - is_null:
              arguments:
                where: "CAMPAIGN_LIFETIME_BUDGET is null"
      - name: CLICKS
        description: number of Tiktok Ad Set clicks
        tests:
          - not_null
      - name: IMPRESSIONS
        description: number of Tiktok Ad Set impressions
        tests:
          - not_null
      - name: REACH
        description: number of Tiktok Ad Set fans reached
        tests:
          - not_null
      - name: FOLLOWS
        description: number of Tiktok Ad Set generated follows
        tests:
          - not_null
      - name: VIDEO_WATCHED_6_S
        description: number of Tiktok Ad Set times video watched for 6s+
        tests:
          - not_null
      - name: ENGAGED_VIEW
        description: 6-second views (focused view)
        tests:
          - not_null
      - name: SPEND
        description: money spend for the given for that date
        tests:
          - not_null
      - name: SPEND_USD
        description: money spend for the given for that date in USD
        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: RESULT
        description: Result metric.
        tests:
          - not_null
      - name: COMPLETE_PAYMENT
        description: Complete Payment metric.
        tests:
          - not_null
      - name: PURCHASES
        description: Purchase metric.
        tests:
          - not_null
      - name: CHECKOUT
        description: Checkout metric.
        tests:
          - not_null
      - name: SYNCED_AT
        description: last time Tiktok Ad's information was synced
        tests:
          - not_null
      - name: MIN_REPORT_DATE
        description: The earliest report date for this entity
        tests:
          - not_null
      - name: MAX_REPORT_DATE
        description: The latest report date for this entity
        tests:
          - not_null
      - name: ACTION_TYPE
        description: Type of the action used to calculate the rate of the given ad set
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: [ 'VIEWS', 'CLICKS', 'FOLLOWS', 'REACH', 'ORDERS_PLACED' ]
      - name: ACTIONS
        description: How many actions of the action_type happened for the ad set
        tests:
          - not_null
      - name: RATE_TYPE
        description: What is the rate type we calculate for given ad set
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: ['VTR', 'CTR', 'FR', 'FREQUENCY']
      - name: RATE
        description: Numeric value of the rate_type
        tests:
          - not_null
      - name: CTR
        description: Click Through Rate
      - name: FREQUENCY
        description: Impressions / Reach
        tests:
          - not_null
      - name: COST_PER_ACTION
        description: Cost Per Action
        tests:
          - not_null
      - name: COST_PER_ACTION_USD
        description: Cost Per Action in USD
        tests:
          - not_null
      - name: COST_PER_IMPRESSION
        description: Cost Per Impression
        tests:
          - not_null
      - name: COST_PER_IMPRESSION_USD
        description: Cost Per Impression in USD
        tests:
          - not_null
  - name: TIKTOK_ADS__AD_SET_COUNTRY_DBT
    description: Staging model to store historical TikTok Ads Ad set's (ADGROUP) data.
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: ID
        description: Tiktok Ad set id
        tests:
          - not_null
      - name: COUNTRY_CODE
        description: Tiktok Ad Country (ISO2 or UNKNOWN)
        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
        tests:
          - not_null
      - name: CAMPAIGN_NAME
        description: Tiktok Campaign Name
        tests:
          - not_null
      - name: CAMPAIGN_GLOBAL_PARTICIPANT_ID
        description: Tiktok Campaign Global Participant ID
      - name: CAMPAIGN_OBJECTIVE
        description: Tiktok Campaign Objective
        tests:
          - not_null
      - name: START_AT
        description: Tiktok Campaign Ad Set Start timestamp
        tests:
          - not_null
      - name: END_AT
        description: Tiktok Campaign Ad Set End timestamp
        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
        tests:
          - not_null
      - name: DAILY_BUDGET
        description: Ad Set Daily Budget
        tests:
          - not_null:
              arguments:
                where: "DAILY_BUDGET > 0"
      - name: LIFETIME_BUDGET
        description: Ad Set Lifetime Budget
        tests:
          - not_null:
              arguments:
                where: "LIFETIME_BUDGET > 0"
      - name: CAMPAIGN_DAILY_BUDGET
        description: Campaign Daily Budget
        tests:
          - not_null:
              arguments:
                where: "CAMPAIGN_DAILY_BUDGET > 0"
      - name: CAMPAIGN_LIFETIME_BUDGET
        description: Campaign Daily Budget
        tests:
          - not_null:
              arguments:
                where: "CAMPAIGN_LIFETIME_BUDGET > 0"
      - name: DAILY_BUDGET_USD
        description: Ad Set Daily Budget in USD
        tests:
          - not_null:
              arguments:
                where: "DAILY_BUDGET is not null"
          - is_null:
              arguments:
                where: "DAILY_BUDGET is null"
      - name: LIFETIME_BUDGET_USD
        description: Ad Set Lifetime Budget in USD
        tests:
          - not_null:
              arguments:
                where: "LIFETIME_BUDGET is not null"
          - is_null:
              arguments:
                where: "LIFETIME_BUDGET is null"
      - name: CAMPAIGN_DAILY_BUDGET_USD
        description: Campaign Daily Budget in USD
        tests:
          - not_null:
              arguments:
                where: "CAMPAIGN_DAILY_BUDGET is not null"
          - is_null:
              arguments:
                where: "CAMPAIGN_DAILY_BUDGET is null"
      - name: CAMPAIGN_LIFETIME_BUDGET_USD
        description: Campaign Lifetime Budget in USD
        tests:
          - not_null:
              arguments:
                where: "CAMPAIGN_LIFETIME_BUDGET is not null"
          - is_null:
              arguments:
                where: "CAMPAIGN_LIFETIME_BUDGET is null"
      - name: CLICKS
        description: number of Tiktok Ad Set clicks
        tests:
          - not_null
      - name: IMPRESSIONS
        description: number of Tiktok Ad Set impressions
        tests:
          - not_null
      - name: REACH
        description: number of Tiktok Ad Set fans reached
        tests:
          - not_null
      - name: CONVERSION
        description: number of Tiktok Ad Set conversions
        tests:
          - not_null
      - name: FOLLOWS
        description: number of Tiktok Ad Set generated follows
        tests:
          - not_null
      - name: VIDEO_WATCHED_6_S
        description: number of Tiktok Ad Set 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: Place holder as data is not available for country specific report.
      - name: SPEND
        description: money spend for the given for that date
        tests:
          - not_null
      - name: SPEND_USD
        description: money spend for the given for that date in USD
        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: RESULT
        description: Result metric.
        tests:
          - not_null
      - name: COMPLETE_PAYMENT
        description: Complete Payment metric.
        tests:
          - not_null
      - name: PURCHASES
        description: Purchase metric.
        tests:
          - not_null
      - name: CHECKOUT
        description: Checkout metric.
        tests:
          - not_null
      - name: SYNCED_AT
        description: last time Tiktok Ad's information was synced
        tests:
          - not_null
      - name: MIN_REPORT_DATE
        description: The earliest report date for this entity
        tests:
          - not_null
      - name: MAX_REPORT_DATE
        description: The latest report date for this entity
        tests:
          - not_null
      - name: ACTION_TYPE
        description: Type of the action used to calculate the rate of the given ad set
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: [ 'VIEWS', 'CLICKS', 'FOLLOWS', 'REACH', 'ORDERS_PLACED' ]
      - name: ACTIONS
        description: How many actions of the action_type happened for the ad set
        tests:
          - not_null
      - name: RATE_TYPE
        description: What is the rate type we calculate for given ad set
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: ['VTR', 'CTR', 'FR', 'FREQUENCY']
      - name: RATE
        description: Numeric value of the rate_type
        tests:
          - not_null
      - name: CTR
        description: Click Through Rate
      - name: FREQUENCY
        description: Impressions / Reach
        tests:
          - not_null
      - name: COST_PER_ACTION
        description: Cost Per Action
        tests:
          - not_null
      - name: COST_PER_ACTION_USD
        description: Cost Per Action in USD
        tests:
          - not_null
      - name: COST_PER_IMPRESSION
        description: Cost Per Impression
        tests:
          - not_null
      - name: COST_PER_IMPRESSION_USD
        description: Cost Per Impression in USD
        tests:
          - not_null
  - name: TIKTOK_ADS__CAMPAIGN_DBT
    description: Staging model to store historical TikTok Ads Campaign data.
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: ID
        description: Tiktok Campaign id
        tests:
          - not_null
      - name: NAME
        description: Tiktok Campaign Name
        tests:
          - not_null
      - name: ACCOUNT_ID
        description: Tiktok Advertiser ID
        tests:
          - not_null
      - name: CAMPAIGN_GLOBAL_PARTICIPANT_ID
        description: Tiktok Campaign Global Participant ID
      - name: OBJECTIVE
        description: Tiktok Campaign Objective
        tests:
          - not_null
      - name: START_AT
        description: Tiktok Campaign Campaign Start timestamp
        tests:
          - not_null
      - name: END_AT
        description: Tiktok Campaign Campaign End timestamp
        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: DAILY_BUDGET
        description: Campaign Daily Budget
        tests:
          - not_null:
              arguments:
                where: "DAILY_BUDGET > 0"
      - name: LIFETIME_BUDGET
        description: Campaign Lifetime Budget
        tests:
          - not_null:
              arguments:
                where: "LIFETIME_BUDGET > 0"
      - name: AD_SET_DAILY_BUDGET
        description: Ad Set Daily Budget
        tests:
          - not_null:
              arguments:
                where: "AD_SET_DAILY_BUDGET > 0"
      - name: AD_SET_LIFETIME_BUDGET
        description: Ad Set Daily Budget
        tests:
          - not_null:
              arguments:
                where: "AD_SET_LIFETIME_BUDGET > 0"
      - name: DAILY_BUDGET_USD
        description: Campaign Daily Budget in USD
        tests:
          - not_null:
              arguments:
                where: "DAILY_BUDGET is not null"
          - is_null:
              arguments:
                where: "DAILY_BUDGET is null"
      - name: LIFETIME_BUDGET_USD
        description: Campaign Lifetime Budget in USD
        tests:
          - not_null:
              arguments:
                where: "LIFETIME_BUDGET is not null"
          - is_null:
              arguments:
                where: "LIFETIME_BUDGET is null"
      - name: AD_SET_DAILY_BUDGET_USD
        description: Ad Set Daily Budget in USD
        tests:
          - not_null:
              arguments:
                where: "AD_SET_DAILY_BUDGET is not null"
          - is_null:
              arguments:
                where: "AD_SET_DAILY_BUDGET is null"
      - name: AD_SET_LIFETIME_BUDGET_USD
        description: Ad Set Lifetime Budget in USD
        tests:
          - not_null:
              arguments:
                where: "AD_SET_LIFETIME_BUDGET is not null"
          - is_null:
              arguments:
                where: "AD_SET_LIFETIME_BUDGET is null"
      - name: CLICKS
        description: number of Tiktok Campaign clicks
        tests:
          - not_null
      - name: IMPRESSIONS
        description: number of Tiktok Campaign impressions
        tests:
          - not_null
      - name: REACH
        description: number of Tiktok Campaign fans reached
        tests:
          - not_null
      - name: FOLLOWS
        description: number of Tiktok Campaign generated follows
        tests:
          - not_null
      - name: VIDEO_WATCHED_6_S
        description: number of Tiktok Campaign times video watched for 6s+
        tests:
          - not_null
      - name: ENGAGED_VIEW
        description: 6-second views (focused view)
        tests:
          - not_null
      - name: SPEND
        description: money spend for the given for that date
        tests:
          - not_null
      - name: SPEND_USD
        description: money spend for the given for that date in USD
        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: RESULT
        description: Result metric.
        tests:
          - not_null
      - name: COMPLETE_PAYMENT
        description: Complete Payment metric.
        tests:
          - not_null
      - name: PURCHASES
        description: Purchase metric.
        tests:
          - not_null
      - name: CHECKOUT
        description: Checkout metric.
        tests:
          - not_null
      - name: SYNCED_AT
        description: last time Tiktok Ad's information was synced
        tests:
          - not_null
      - name: MIN_REPORT_DATE
        description: The earliest report date for this entity
        tests:
          - not_null
      - name: MAX_REPORT_DATE
        description: The latest report date for this entity
        tests:
          - not_null
      - name: ACTION_TYPE
        description: Type of the action used to calculate the rate of the given Campaign
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: [ 'VIEWS', 'CLICKS', 'FOLLOWS', 'REACH', 'ORDERS_PLACED' ]
      - name: ACTIONS
        description: How many actions of the action_type happened for the Campaign
        tests:
          - not_null
      - name: RATE_TYPE
        description: What is the rate type we calculate for given Campaign
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: ['VTR', 'CTR', 'FR', 'FREQUENCY']
      - name: RATE
        description: Numeric value of the rate_type
        tests:
          - not_null
      - name: CTR
        description: Click Through Rate
      - name: FREQUENCY
        description: Impressions / Reach
        tests:
          - not_null
      - name: COST_PER_ACTION
        description: Cost Per Action
        tests:
          - not_null
      - name: COST_PER_ACTION_USD
        description: Cost Per Action in USD
        tests:
          - not_null
      - name: COST_PER_IMPRESSION
        description: Cost Per Impression
        tests:
          - not_null
      - name: COST_PER_IMPRESSION_USD
        description: Cost Per Impression in USD
        tests:
          - not_null
  - name: TIKTOK_ADS__CAMPAIGN_COUNTRY_DBT
    description: Staging model to store historical TikTok Ads Campaign data.
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: ID
        description: Tiktok Campaign id
        tests:
          - not_null
      - name: COUNTRY_CODE
        description: Tiktok Ad Country (ISO2 or UNKNOWN)
        tests:
          - not_null
      - name: NAME
        description: Tiktok Campaign Name
        tests:
          - not_null
      - name: ACCOUNT_ID
        description: Tiktok Advertiser ID
        tests:
          - not_null
      - name: CAMPAIGN_GLOBAL_PARTICIPANT_ID
        description: Tiktok Campaign Global Participant ID
      - name: OBJECTIVE
        description: Tiktok Campaign Objective
        tests:
          - not_null
      - name: START_AT
        description: Tiktok Campaign Campaign Start timestamp
        tests:
          - not_null
      - name: END_AT
        description: Tiktok Campaign Campaign End timestamp
        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: DAILY_BUDGET
        description: Campaign Daily Budget
        tests:
          - not_null:
              arguments:
                where: "DAILY_BUDGET > 0"
      - name: LIFETIME_BUDGET
        description: Campaign Lifetime Budget
        tests:
          - not_null:
              arguments:
                where: "LIFETIME_BUDGET > 0"
      - name: AD_SET_DAILY_BUDGET
        description: Ad Set Daily Budget
        tests:
          - not_null:
              arguments:
                where: "AD_SET_DAILY_BUDGET > 0"
      - name: AD_SET_LIFETIME_BUDGET
        description: Ad Set Daily Budget
        tests:
          - not_null:
              arguments:
                where: "AD_SET_LIFETIME_BUDGET > 0"
      - name: DAILY_BUDGET_USD
        description: Campaign Daily Budget in USD
        tests:
          - not_null:
              arguments:
                where: "DAILY_BUDGET is not null"
          - is_null:
              arguments:
                where: "DAILY_BUDGET is null"
      - name: LIFETIME_BUDGET_USD
        description: Campaign Lifetime Budget in USD
        tests:
          - not_null:
              arguments:
                where: "LIFETIME_BUDGET is not null"
          - is_null:
              arguments:
                where: "LIFETIME_BUDGET is null"
      - name: AD_SET_DAILY_BUDGET_USD
        description: Ad Set Daily Budget in USD
        tests:
          - not_null:
              arguments:
                where: "AD_SET_DAILY_BUDGET is not null"
          - is_null:
              arguments:
                where: "AD_SET_DAILY_BUDGET is null"
      - name: AD_SET_LIFETIME_BUDGET_USD
        description: Ad Set Lifetime Budget in USD
        tests:
          - not_null:
              arguments:
                where: "AD_SET_LIFETIME_BUDGET is not null"
          - is_null:
              arguments:
                where: "AD_SET_LIFETIME_BUDGET is null"
      - name: CLICKS
        description: number of Tiktok Campaign clicks
        tests:
          - not_null
      - name: IMPRESSIONS
        description: number of Tiktok Campaign impressions
        tests:
          - not_null
      - name: REACH
        description: number of Tiktok Campaign fans reached
        tests:
          - not_null
      - name: CONVERSION
        description: number of Tiktok Campaign conversions
        tests:
          - not_null
      - name: FOLLOWS
        description: number of Tiktok Campaign generated follows
        tests:
          - not_null
      - name: VIDEO_WATCHED_6_S
        description: number of Tiktok Campaign 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: Place holder as data is not available for country specific report.
      - name: SPEND
        description: money spend for the given for that date
        tests:
          - not_null
      - name: SPEND_USD
        description: money spend for the given for that date in USD
        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: RESULT
        description: Result metric.
        tests:
          - not_null
      - name: COMPLETE_PAYMENT
        description: Complete Payment metric.
        tests:
          - not_null
      - name: PURCHASES
        description: Purchase metric.
        tests:
          - not_null
      - name: CHECKOUT
        description: Checkout metric.
        tests:
          - not_null
      - name: SYNCED_AT
        description: last time Tiktok Ad's information was synced
        tests:
          - not_null
      - name: MIN_REPORT_DATE
        description: The earliest report date for this entity
        tests:
          - not_null
      - name: MAX_REPORT_DATE
        description: The latest report date for this entity
        tests:
          - not_null
      - name: ACTION_TYPE
        description: Type of the action used to calculate the rate of the given Campaign
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: [ 'VIEWS', 'CLICKS', 'FOLLOWS', 'REACH', 'ORDERS_PLACED' ]
      - name: ACTIONS
        description: How many actions of the action_type happened for the Campaign
        tests:
          - not_null
      - name: RATE_TYPE
        description: What is the rate type we calculate for given Campaign
        tests:
          - not_null
          - accepted_values:
              arguments:
                values: [ 'VTR', 'CTR', 'FR', 'FREQUENCY' ]
      - name: RATE
        description: Numeric value of the rate_type
        tests:
          - not_null
      - name: CTR
        description: Click Through Rate
      - name: FREQUENCY
        description: Impressions / Reach
        tests:
          - not_null
      - name: COST_PER_ACTION
        description: Cost Per Action
        tests:
          - not_null
      - name: COST_PER_ACTION_USD
        description: Cost Per Action in USD
        tests:
          - not_null
      - name: COST_PER_IMPRESSION
        description: Cost Per Impression
        tests:
          - not_null
      - name: COST_PER_IMPRESSION_USD
        description: Cost Per Impression in USD
        tests:
          - not_null
  - name: TIKTOK_ADS__ACCOUNT_DBT
    description: Staging model to store historical TikTok Ads 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 Company Name
        tests:
          - not_null
      - name: CURRENCY
        description: Tiktok Advertiser Currency
        tests:
          - not_null
      - name: TO_USD_CONVERSION_RATE
        description: To usd conversion rate for calculating spend
        tests:
          - not_null
      - name: CAMPAIGNS_COUNT
        description: Number of Tiktok campaigns under given advertiser
        tests:
          - not_null
      - name: SYNCED_AT
        description: last time Tiktok Advertiser information was synced
        tests:
          - not_null
  - name: TIKTOK_ADS__CAMPAIGN_BENCHMARK_BY_ACCOUNT_DBT
    description: Benchmark values of TikTok Campaign performance by Account and Objective
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - VENDOR_ID
              - SUBACCOUNT_ID
              - PLATFORM
              - OBJECTIVE
    columns:
      - name: VENDOR_ID
        description: Vendor ID
        tests:
          - not_null
      - name: SUBACCOUNT_ID
        description: Subaccount ID
        tests:
          - not_null
      - name: PLATFORM
        description: Platform
        tests:
          - not_null
      - name: OBJECTIVE
        description: Campaign Objective
        tests:
          - not_null
      - name: AVG_RATE
        description: Average rate for all Campaigns given an objective (weighted by Actions)
        tests:
          - not_null
  - name: TIKTOK_ADS__CAMPAIGN_BENCHMARK_BY_ACCOUNT_COUNTRY_DBT
    description: Benchmark values of TikTok Campaign performance by Account, Objective and Country
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - VENDOR_ID
              - SUBACCOUNT_ID
              - COUNTRY_CODE
              - PLATFORM
              - OBJECTIVE
    columns:
      - name: VENDOR_ID
        description: Vendor ID
        tests:
          - not_null
      - name: SUBACCOUNT_ID
        description: Subaccount ID
        tests:
          - not_null
      - name: COUNTRY_CODE
        description: Ad Country (ISO2)
        tests:
          - not_null
          - dbt_expectations.expect_column_values_to_not_be_in_set:
              arguments:
                value_set:
                  - 'UNKNOWN'
      - name: PLATFORM
        description: Platform
        tests:
          - not_null
      - name: OBJECTIVE
        description: Campaign Objective
        tests:
          - not_null
      - name: AVG_RATE
        description: Average rate for all Campaigns given an objective (weighted by Actions)
        tests:
          - not_null
  - name: TIKTOK_ADS__CAMPAIGN_BENCHMARK_BY_ACCOUNT_ARTIST_DBT
    description: Benchmark values of TikTok Campaign performance by Account, Global Participant and Objective
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - VENDOR_ID
              - SUBACCOUNT_ID
              - GLOBAL_PARTICIPANT_ID
              - PLATFORM
              - OBJECTIVE
    columns:
      - name: VENDOR_ID
        description: Vendor ID
        tests:
          - not_null
      - name: SUBACCOUNT_ID
        description: Subaccount ID
        tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_ID
        description: Global Participant ID
        tests:
          - not_null
      - name: PLATFORM
        description: Platform
        tests:
          - not_null
      - name: OBJECTIVE
        description: Campaign Objective
        tests:
          - not_null
      - name: AVG_RATE
        description: Average rate for all Campaigns given an objective (weighted by Actions)
        tests:
          - not_null
  - name: TIKTOK_ADS__CAMPAIGN_BENCHMARK_BY_ACCOUNT_ARTIST_COUNTRY_DBT
    description: Benchmark values of TikTok Campaign performance by Account, Global Participant, Objective and Country
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - VENDOR_ID
              - SUBACCOUNT_ID
              - GLOBAL_PARTICIPANT_ID
              - COUNTRY_CODE
              - PLATFORM
              - OBJECTIVE
    columns:
      - name: VENDOR_ID
        description: Vendor ID
        tests:
          - not_null
      - name: SUBACCOUNT_ID
        description: Subaccount ID
        tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_ID
        description: Global Participant ID
        tests:
          - not_null
      - name: COUNTRY_CODE
        description: Ad Country (ISO2)
        tests:
          - not_null
          - dbt_expectations.expect_column_values_to_not_be_in_set:
              arguments:
                value_set:
                  - 'UNKNOWN'
      - name: PLATFORM
        description: Platform
        tests:
          - not_null
      - name: OBJECTIVE
        description: Campaign Objective
        tests:
          - not_null
      - name: AVG_RATE
        description: Average rate for all Campaigns given an objective (weighted by Actions)
        tests:
          - not_null
