version: 2
models:
  - name: FANS_BY_ARTIST_ACCOUNT_DBT
    description: '{{ doc("FANS_BY_ARTIST_ACCOUNT_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - VENDOR_ID
            - SUBACCOUNT_ID
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: VENDOR_ID
        description: Vendor ID from Orchard
        data_tests:
          - not_null
      - name: SUBACCOUNT_ID
        description: Subaccount ID from Orchard
        data_tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: CHARTMETRIC_ID
        description: Chartmetric ID of global participant
      - name: GLOBAL_PARTICIPANT_NAME
        description: Global Participant name
        data_tests:
          - not_null
      - name: FANS_COUNT
        description: Count of unique fans
        data_tests:
          - not_null
      - name: FANS_COUNT_7_DAYS_AGO
        description: Fans count 7 days ago
        data_tests:
          - not_null
      - name: FANS_COUNT_28_DAYS_AGO
        description: Fans count 28 days ago
        data_tests:
          - not_null
      - name: FANS_COUNT_6_MONTH_AGO
        description: Fans count 6 month ago
        data_tests:
          - not_null
      - name: FANS_COUNT_1_YEAR_AGO
        description: Fans count 1 year (365 days) ago
        data_tests:
          - not_null
      - name: ENGAGEMENT_RATIO
        description: Fan engagement ratio
        data_tests:
          - not_null
      - name: ENGAGEMENT_BENCHMARK
        description: Fan engagement benchmark as 10% of total lean forward streamers
        data_tests:
          - not_null
      - name: EMAIL_CONSENT_FANS_COUNT
        description: Nr of fans with email consent
        data_tests:
          - not_null
          - dbt_utils.expression_is_true:
              expression: '<= FANS_COUNT'
      - name: AD_CONSENT_FANS_COUNT
        description: Nr of fans with ad consent
        data_tests:
          - not_null
          - dbt_utils.expression_is_true:
              expression: '<= FANS_COUNT'
      - name: SMS_CONSENT_FANS_COUNT
        description: Nr of fans with sms consent
        data_tests:
          - not_null
          - dbt_utils.expression_is_true:
              expression: '<= FANS_COUNT'
  - name: FANS_BY_ARTIST_ACCOUNT_DATE_DBT
    description: '{{ doc("FANS_BY_ARTIST_ACCOUNT_DATE_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - VENDOR_ID
            - SUBACCOUNT_ID
            - FIRST_EVENT_DATE
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: VENDOR_ID
        description: Vendor ID from Orchard
        data_tests:
          - not_null
      - name: SUBACCOUNT_ID
        description: Subaccount ID from Orchard
        data_tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: FIRST_EVENT_DATE
        description: Date when fan activity took place
        data_tests:
          - not_null
      - name: FANS_COUNT
        description: Count of unique fans
        data_tests:
          - not_null
      - name: EMAIL_ELIGIBLE_FANS_COUNT
        description: Count of fans with email marketing consent
        data_tests:
          - not_null
  - name: GLOBAL_FANS_BY_ARTIST_DATE_DBT
    description: '{{ doc("GLOBAL_FANS_BY_ARTIST_DATE_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - FIRST_EVENT_DATE
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: FIRST_EVENT_DATE
        description: Date when fan activity took place
        data_tests:
          - not_null
      - name: FANS_COUNT
        description: Count of unique fans
        data_tests:
          - not_null
      - name: EMAIL_ELIGIBLE_FANS_COUNT
        description: Count of fans with email marketing consent
        data_tests:
          - not_null
  - name: GLOBAL_FANS_BY_ARTIST_DBT
    description: '{{ doc("GLOBAL_FANS_BY_ARTIST_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: GLOBAL_PARTICIPANT_ID
        description: Global participant ID from Orchard
        data_tests:
          - not_null
      - name: CHARTMETRIC_ID
        description: Chartmetric ID of global participant
      - name: GLOBAL_PARTICIPANT_NAME
        description: Global Participant name
        data_tests:
          - not_null
      - name: FANS_COUNT
        description: Count of unique fans
        data_tests:
          - not_null
      - name: FANS_COUNT_7_DAYS_AGO
        description: Fans count 7 days ago
        data_tests:
          - not_null
      - name: FANS_COUNT_28_DAYS_AGO
        description: Fans count 28 days ago
        data_tests:
          - not_null
      - name: FANS_COUNT_6_MONTH_AGO
        description: Fans count 6 month ago
        data_tests:
          - not_null
      - name: FANS_COUNT_1_YEAR_AGO
        description: Fans count 1 year (365 days) ago
        data_tests:
          - not_null
      - name: ENGAGEMENT_RATIO
        description: Fan engagement ratio
        data_tests:
          - not_null
      - name: ENGAGEMENT_BENCHMARK
        description: Fan engagement benchmark as 10% of total lean forward streamers
        data_tests:
          - not_null
      - name: EMAIL_CONSENT_FANS_COUNT
        description: Nr of fans with email consent
        data_tests:
          - not_null
          - dbt_utils.expression_is_true:
              expression: '<= FANS_COUNT'
      - name: AD_CONSENT_FANS_COUNT
        description: Nr of fans with ad consent
        data_tests:
          - not_null
          - dbt_utils.expression_is_true:
              expression: '<= FANS_COUNT'
      - name: SMS_CONSENT_FANS_COUNT
        description: Nr of fans with sms consent
        data_tests:
          - not_null
          - dbt_utils.expression_is_true:
              expression: '<= FANS_COUNT'
