version: 2
models:
  - name: STG_FACEBOOK_ADS__ACCOUNT_HISTORY_DBT
    description: Staging model to store historical Facebook Ads Ad Account data.
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: ID
        description: Facebook Ads Ad Account ID
        tests:
          - not_null
      - name: NAME
        description: Ad Account Name
      - name: BUSINESS_ACCOUNT_ID
        description: Business Manager Business Id
      - name: BUSINESS_ACCOUNT_NAME
        description: Business Manager Business Name
      - name: CURRENCY
        description: Account Currency
      - name: SYNCED_AT
        description: Timestamp of the last data sync by Fivetran
        tests:
          - not_null
      - name: IS_MOST_RECENT_RECORD
        description: Whether the row is the most recent record for a given source schema and ad account.
        tests:
          - not_null

  - name: STG_FACEBOOK_ADS__AD_DBT
    description: Staging model to store daily historical Facebook Ads Ad performance data .
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - SOURCE_SCHEMA
              - AD_ID
              - REPORT_DATE
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: AD_ID
        description: Meta Ad id
        tests:
          - not_null
      - name: REPORT_DATE
        description: Date when performance was evaluated
        tests:
          - not_null
      - name: _FIVETRAN_ID
        description: Hashed combination of breakdown columns to help join secondary tables
        tests:
          - not_null

      - name: AD_NAME
        description: Facebook Ad's name
        tests:
          - not_null
      - name: AD_SET_NAME
        description: Facebook Ad's ad set name
        tests:
          - not_null
      - name: ACCOUNT_ID
        description: Facebook Ad's account id
        tests:
          - not_null
      - name: IMPRESSIONS
        description: Impressions the ad brought
        tests:
          - not_null
      - name: CLICKS
        description: Clicks the ad brought
        tests:
          - not_null
      - name: SPEND
        description: How much money was spend on the ad
        tests:
          - not_null
      - name: FREQUENCY
        description: Facebook Ad's Frequency
        tests:
          - not_null
      - name: ESTIMATED_AD_RECALLERS
        description: Facebook Ad's Estimated Ad Recallers
        tests:
          - not_null
      - name: SYNCED_AT
        description: last time Facebook Ad's information was synced
        tests:
          - not_null

  - name: STG_FACEBOOK_ADS__AD_COUNTRY_DBT
    description: Staging model to store daily historical Facebook Ads Ad performance data .
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - SOURCE_SCHEMA
              - AD_ID
              - REPORT_DATE
              - COUNTRY_CODE
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: AD_ID
        description: Meta Ad id
        tests:
          - not_null
      - name: REPORT_DATE
        description: Date when performance was evaluated
        tests:
          - not_null
      - name: COUNTRY_CODE
        description: Meta Ad Country (ISO2 or UNKNOWN)
        tests:
          - not_null
      - name: _FIVETRAN_ID
        description: Hashed combination of breakdown columns to help join secondary tables
        tests:
          - not_null

      - name: AD_NAME
        description: Facebook Ad's name
        tests:
          - not_null
      - name: AD_SET_NAME
        description: Facebook Ad's ad set name
        tests:
          - not_null
      - name: ACCOUNT_ID
        description: Facebook Ad's account id
        tests:
          - not_null
      - name: IMPRESSIONS
        description: Impressions the ad brought
        tests:
          - not_null
      - name: CLICKS
        description: Clicks the ad brought
        tests:
          - not_null
      - name: SPEND
        description: How much money was spend on the ad
        tests:
          - not_null
      - name: FREQUENCY
        description: Facebook Ad's Frequency
        tests:
          - not_null
      - name: ESTIMATED_AD_RECALLERS
        description: Facebook Ad's Estimated Ad Recallers
        tests:
          - not_null

      - name: SYNCED_AT
        description: last time Facebook Ad's information was synced
        tests:
          - not_null

  - name: STG_FACEBOOK_ADS__AD_ACTIONS_DBT
    description: Staging model to store daily historical Facebook Ads happened actions data.
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - SOURCE_SCHEMA
              - AD_ID
              - REPORT_DATE
              - _FIVETRAN_ID
              - ACTION_TYPE
              - ACTION_VIDEO_TYPE
    columns:
      - name: SOURCE_SCHEMA
        description: Fivetran Schema
        tests:
          - not_null
      - name: AD_ID
        description: Ad ID
        tests:
          - not_null
      - name: _FIVETRAN_ID
        description: Hashed combination of breakdown columns to help join secondary tables
        tests:
          - not_null
      - name: REPORT_DATE
        description: Date Day
        tests:
          - not_null
      - name: INDEX
        description: Index.
        tests:
          - not_null
      - name: ACTION_TYPE
        description: Action type name.
        tests:
          - not_null
      - name: ACTION_VIDEO_TYPE
        description: Action video type name.
      - name: VALUE
        description: The number of ACTION_TYPE actions happened.
      - name: SYNCED_AT
        description: Timestamp of the last data sync by Fivetran
        tests:
          - not_null
      - name: IS_MOST_RECENT_RECORD
        description: Whether the row is the most recent record for a given source schema and ad account.
        tests:
          - not_null
  - name: STG_FACEBOOK_ADS__AD_ACTIONS_COUNTRY_DBT
    description: Staging model to store daily historical Facebook Ads happened actions data.
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - SOURCE_SCHEMA
              - AD_ID
              - REPORT_DATE
              - _FIVETRAN_ID
              - ACTION_TYPE
              - ACTION_VIDEO_TYPE
    columns:
      - name: SOURCE_SCHEMA
        description: Fivetran Schema
        tests:
          - not_null
      - name: AD_ID
        description: Ad ID
        tests:
          - not_null
      - name: _FIVETRAN_ID
        description: Hashed combination of breakdown columns to help join secondary tables
        tests:
          - not_null
      - name: REPORT_DATE
        description: Date Day
        tests:
          - not_null
      - name: INDEX
        description: Index.
        tests:
          - not_null
      - name: ACTION_TYPE
        description: Action type name.
        tests:
          - not_null
      - name: ACTION_VIDEO_TYPE
        description: Action video type name.
      - name: VALUE
        description: The number of ACTION_TYPE actions happened.
        tests:
          - not_null

  - name: STG_FACEBOOK_ADS__AD_VIDEO_P_25_WATCHED_ACTIONS_DBT
    description: Staging model to store daily historical Facebook Ads happened actions data.
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - SOURCE_SCHEMA
              - AD_ID
              - REPORT_DATE
              - _FIVETRAN_ID
              - ACTION_TYPE
              - ACTION_VIDEO_TYPE
    columns:
      - name: SOURCE_SCHEMA
        description: Fivetran Schema
        tests:
          - not_null
      - name: AD_ID
        description: Ad ID
        tests:
          - not_null
      - name: _FIVETRAN_ID
        description: Hashed combination of breakdown columns to help join secondary tables
        tests:
          - not_null
      - name: REPORT_DATE
        description: Date Day
        tests:
          - not_null
      - name: INDEX
        description: Index.
        tests:
          - not_null
      - name: ACTION_TYPE
        description: Action type name.
        tests:
          - not_null
      - name: ACTION_VIDEO_TYPE
        description: Action video type name.
      - name: VALUE
        description: The number of ACTION_TYPE actions happened.
        tests:
          - not_null

  - name: STG_FACEBOOK_ADS__AD_VIDEO_P_25_WATCHED_ACTIONS_COUNTRY_DBT
    description: Staging model to store daily historical Facebook Ads happened actions data.
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - SOURCE_SCHEMA
              - AD_ID
              - REPORT_DATE
              - _FIVETRAN_ID
              - ACTION_TYPE
              - ACTION_VIDEO_TYPE
    columns:
      - name: SOURCE_SCHEMA
        description: Fivetran Schema
        tests:
          - not_null
      - name: AD_ID
        description: Ad ID
        tests:
          - not_null
      - name: _FIVETRAN_ID
        description: Hashed combination of breakdown columns to help join secondary tables
        tests:
          - not_null
      - name: REPORT_DATE
        description: Date Day
        tests:
          - not_null
      - name: INDEX
        description: Index.
        tests:
          - not_null
      - name: ACTION_TYPE
        description: Action type name.
        tests:
          - not_null
      - name: ACTION_VIDEO_TYPE
        description: Action video type name.
      - name: VALUE
        description: The number of ACTION_TYPE actions happened.
        tests:
          - not_null

  - name: STG_FACEBOOK_ADS__AD_VIDEO_THRUPLAY_WATCHED_ACTIONS_DBT
    description: Staging model to store daily historical Facebook Ads happened actions data.
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - SOURCE_SCHEMA
              - AD_ID
              - REPORT_DATE
              - _FIVETRAN_ID
              - ACTION_TYPE
              - ACTION_VIDEO_TYPE
    columns:
      - name: SOURCE_SCHEMA
        description: Fivetran Schema
        tests:
          - not_null
      - name: AD_ID
        description: Ad ID
        tests:
          - not_null
      - name: _FIVETRAN_ID
        description: Hashed combination of breakdown columns to help join secondary tables
        tests:
          - not_null
      - name: REPORT_DATE
        description: Date Day
        tests:
          - not_null
      - name: INDEX
        description: Index.
        tests:
          - not_null
      - name: ACTION_TYPE
        description: Action type name.
        tests:
          - not_null
      - name: ACTION_VIDEO_TYPE
        description: Action video type name.
      - name: VALUE
        description: The number of ACTION_TYPE actions happened.
        tests:
          - not_null

  - name: STG_FACEBOOK_ADS__AD_VIDEO_THRUPLAY_WATCHED_ACTIONS_COUNTRY_DBT
    description: Staging model to store daily historical Facebook Ads happened actions data.
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - SOURCE_SCHEMA
              - AD_ID
              - REPORT_DATE
              - _FIVETRAN_ID
              - ACTION_TYPE
              - ACTION_VIDEO_TYPE
    columns:
      - name: SOURCE_SCHEMA
        description: Fivetran Schema
        tests:
          - not_null
      - name: AD_ID
        description: Ad ID
        tests:
          - not_null
      - name: _FIVETRAN_ID
        description: Hashed combination of breakdown columns to help join secondary tables
        tests:
          - not_null
      - name: REPORT_DATE
        description: Date Day
        tests:
          - not_null
      - name: INDEX
        description: Index.
        tests:
          - not_null
      - name: ACTION_TYPE
        description: Action type name.
        tests:
          - not_null
      - name: ACTION_VIDEO_TYPE
        description: Action video type name.
      - name: VALUE
        description: The number of ACTION_TYPE actions happened.
        tests:
          - not_null

  - name: STG_FACEBOOK_ADS__AD_SET_HISTORY_DBT
    description: Staging model to store daily historical Facebook Ads Ad_set performance data .
    tests:
      - dbt_utils.unique_combination_of_columns:
          arguments:
            combination_of_columns:
              - SOURCE_SCHEMA
              - ID
              - UPDATED_AT
    columns:
      - name: SOURCE_SCHEMA
        description: Source Fivetran schema.
        tests:
          - not_null
      - name: ID
        description: Ad Set id
        tests:
          - not_null
      - name: NAME
        description: Ad Set Name
        tests:
          - not_null
      - name: ACCOUNT_ID
        description: Ad Set Account Id
        tests:
          - not_null
      - name: CAMPAIGN_ID
        description: Ad Set Campaign Id
        tests:
          - not_null
      - name: START_AT
        description: Ad Set Start datetime
      - name: END_AT
        description: Ad Set End datetime
      - name: BID_STRATEGY
        description: Ad Set Start Bid Strategy
      - name: DAILY_BUDGET
        description: Ad Set Daily Budget
      - name: BUDGET_REMAINING
        description: Ad Set Budget Remaining
      - name: LIFETIME_BUDGET
        description: Ad Set Lifetime Budget
      - name: STATUS
        description: Ad Set Status
        tests:
          - not_null
      - name: EFFECTIVE_STATUS
        description: Ad Set Effective Status
        tests:
          - not_null
      - name: TARGETING_GEO_LOCATIONS_COUNTRIES
        description: Ad Set Countries
      - name: TARGETING_PUBLISHER_PLATFORMS
        description: Ad Set Patforms
      - name: UPDATED_AT
        description: Ad Set Updated At
        tests:
          - not_null
      - name: IS_MOST_RECENT_RECORD
        description: Ad Set Most Recent Record Indicator
        tests:
          - not_null
