version: 2

models:
  - name: V_FS_FANS_BY_ARTIST_DBT
    description: |
      Fan counts per artist (global participant).
      Each row represents one artist with total, email-consented, and
      ad-consented fan counts.
      Access is restricted by row-level security — only artists assigned to vendors the
      current user is authorised to view are returned.
    config:
      persist_docs:
        relation: true
        columns: true
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - VENDOR_ID
    columns:
      - name: GLOBAL_PARTICIPANT_ID
        description: Unique identifier of the artist (global participant).
        tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_NAME
        description: Display name of the artist (global participant).
      - name: FANS_COUNT
        description: Total number of fans for this artist.
        tests:
          - not_null
      - name: EMAIL_CONSENT_FANS_COUNT
        description: Number of fans who have given email marketing consent for this artist.
        tests:
          - not_null
      - name: AD_CONSENT_FANS_COUNT
        description: Number of fans who have given advertising consent for this artist.
        tests:
          - not_null
      - name: VENDOR_ID
        description: Foreign key to the vendor (label or business unit) that has access to this artist (Rep Owner or IRL Rep)
        tests:
          - not_null
      - name: VENDOR_NAME
        description: Display name of the vendor (label or business unit) that has access to this artist (Rep Owner or IRL Rep)

  - name: V_FS_FANS_BY_ARTIST_COUNTRY_DBT
    description: |
      Fan counts per artist (global participant) and country.
      Each row represents one artist–country combination with total, email-consented,
      and ad-consented fan counts.
      Access is restricted by row-level security — only artists assigned to vendors the
      current user is authorised to view are returned.
    config:
      persist_docs:
        relation: true
        columns: true
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - COUNTRY_ISO2
            - VENDOR_ID
    columns:
      - name: GLOBAL_PARTICIPANT_ID
        description: Unique identifier of the artist (global participant).
        tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_NAME
        description: Display name of the artist (global participant).
      - name: COUNTRY_ISO2
        description: Two-letter ISO 3166-1 alpha-2 country code identifying the fans' country.
        tests:
          - not_null
      - name: FANS_COUNT
        description: Total number of fans for this artist–country combination.
        tests:
          - not_null
      - name: EMAIL_CONSENT_FANS_COUNT
        description: Number of fans in this country who have given email marketing consent for this artist.
        tests:
          - not_null
      - name: AD_CONSENT_FANS_COUNT
        description: Number of fans in this country who have given advertising consent for this artist.
        tests:
          - not_null
      - name: VENDOR_ID
        description: Foreign key to the vendor (label or business unit) that has access to this artist (Rep Owner or IRL Rep).
        tests:
          - not_null
      - name: VENDOR_NAME
        description: Display name of the vendor (label or business unit) that has access to this artist (Rep Owner or IRL Rep).

  - name: V_FS_FANS_BY_ARTIST_DATE_DBT
    description: |
      Cumulative fan counts per artist (global participant), broken down by date.
      Each row represents the running total of fans for one artist on a given date.
      Access is restricted by row-level security — only artists assigned to vendors the
      current user is authorised to view are returned.
    config:
      persist_docs:
        relation: true
        columns: true
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - DATE
            - VENDOR_ID
    columns:
      - name: GLOBAL_PARTICIPANT_ID
        description: Unique identifier of the artist (global participant).
        tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_NAME
        description: Display name of the artist (global participant).
      - name: DATE
        description: Date on which the cumulative fan count is recorded (derived from first fan acquisition event date).
        tests:
          - not_null
      - name: FANS_COUNT
        description: Running total number of fans for this artist as of this date. Only dates on which new fans were acquired are present in this table.
        tests:
          - not_null
      - name: EMAIL_ELIGIBLE_FANS_COUNT
        description: Running total number of fans with email marketing consent for this artist as of this date.
        tests:
          - not_null
      - name: VENDOR_ID
        description: Foreign key to the vendor (label or business unit) that has access to this artist (Rep Owner or IRL Rep).
        tests:
          - not_null
      - name: VENDOR_NAME
        description: Display name of the vendor (label or business unit) that has access to this artist (Rep Owner or IRL Rep).

  - name: V_FS_FANS_BY_ARTIST_COUNTRY_DATE_DBT
    description: |
      Cumulative fan counts per artist (global participant) and country, broken down by date.
      Each row represents the running total of fans for one artist–country combination on a given date.
      Access is restricted by row-level security — only artists assigned to vendors the
      current user is authorised to view are returned.
    config:
      persist_docs:
        relation: true
        columns: true
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - GLOBAL_PARTICIPANT_ID
            - DATE
            - COUNTRY_ISO2
            - VENDOR_ID
    columns:
      - name: GLOBAL_PARTICIPANT_ID
        description: Unique identifier of the artist (global participant).
        tests:
          - not_null
      - name: GLOBAL_PARTICIPANT_NAME
        description: Display name of the artist (global participant).
      - name: DATE
        description: Date on which the cumulative fan count is recorded (derived from first fan acquisition event date).
        tests:
          - not_null
      - name: COUNTRY_ISO2
        description: Two-letter ISO 3166-1 alpha-2 country code identifying the fans' country.
        tests:
          - not_null
      - name: FANS_COUNT
        description: Running total number of fans for this artist–country combination as of this date. Only dates on which new fans were acquired are present in this table.
        tests:
          - not_null
      - name: EMAIL_ELIGIBLE_FANS_COUNT
        description: Running total number of fans with email marketing consent for this artist–country combination as of this date.
        tests:
          - not_null
      - name: VENDOR_ID
        description: Foreign key to the vendor (label or business unit) that has access to this artist (Rep Owner or IRL Rep).
        tests:
          - not_null
      - name: VENDOR_NAME
        description: Display name of the vendor (label or business unit) that has access to this artist (Rep Owner or IRL Rep).

