version: 2

models:

  - name: STREAMS_BY_PLAYLIST_COUNTRY_FEED_DISTRIBUTOR_DAILY_RECENT_DBT
    description:
      A table containing number of streams and metadata on a playlist / country level.
    tests:
      - unique:
          column_name: "concat(playlist_id, '-', country_code, '-', feed_id, '-', distributor, '-', download_activity_date)"
    columns:
      - name: distributor
        tests:
          - not_null
      - name: playlist_id
        tests:
          - not_null
      - name: country_code
        tests:
          - not_null
      - name: feed_id
        tests:
          - not_null
      - name: download_activity_date
        tests:
          - not_null
      - name: store_playlist_id
        tests:
          - not_null
      - name: store_id
        tests:
          - not_null
      - name: streams
        tests:
          - not_null

  - name: STREAMS_BY_PLAYLIST_COUNTRY_FEED_DISTRIBUTOR_DAILY_HISTORY_DBT
    config:
      tags: history
    description:
      A table containing number of streams and metadata on a playlist / country level.
    tests:
      - unique:
          column_name: "concat(playlist_id, '-', country_code, '-', feed_id, '-', distributor, '-', download_activity_date)"
    columns:
      - name: distributor
        tests:
          - not_null
      - name: playlist_id
        tests:
          - not_null
      - name: country_code
        tests:
          - not_null
      - name: feed_id
        tests:
          - not_null
      - name: download_activity_date
        tests:
          - not_null
      - name: store_playlist_id
        tests:
          - not_null
      - name: store_id
        tests:
          - not_null
      - name: streams
        tests:
          - not_null

  - name: STREAMS_BY_PLAYLIST_COUNTRY_FEED_ROLLUP_DBT
    description:
      A table containing number of streams for multiple time periods on a playlist / country level.
    tests:
      - unique:
          column_name: "concat(store_playlist_id, '-', country_code, '-', feed_id)"
    columns:
      - name: store_playlist_id
        tests:
          - not_null
      - name: playlist_id
        tests:
          - not_null
      - name: country_code
        tests:
          - not_null
      - name: feed_id
        tests:
          - not_null
      - name: store_id
        tests:
          - not_null
      - name: streams_all_time
        tests:
          - not_null
      - name: streams_365_days
        tests:
          - not_null
      - name: streams_183_days
        tests:
          - not_null
      - name: streams_28_days
        tests:
          - not_null
      - name: streams_7_days
        tests:
          - not_null
      - name: streams_1_day
        tests:
          - not_null

  - name: STREAMS_BY_PLAYLIST_FEED_ROLLUP_DBT
    description:
      A table containing number of streams for multiple time periods on a playlist level.
    tests:
      - unique:
          column_name: "concat(store_playlist_id, '-', feed_id)"
    columns:
      - name: store_playlist_id
        tests:
          - not_null
      - name: playlist_id
        tests:
          - not_null
      - name: feed_id
        tests:
          - not_null
      - name: store_id
        tests:
          - not_null
      - name: streams_all_time
        tests:
          - not_null
      - name: streams_365_days
        tests:
          - not_null
      - name: streams_183_days
        tests:
          - not_null
      - name: streams_28_days
        tests:
          - not_null
      - name: streams_7_days
        tests:
          - not_null
      - name: streams_1_day
        tests:
          - not_null

  - name: STREAMS_BY_PLAYLIST_COUNTRY_FEED_ROLLUP_PRODUCT_TRANSFER_DBT
    config:
      tags: ['product_transfer']
    description:
      A table containing number of streams for multiple time periods on a playlist / country level, restricted to streams attributed to the current product owner (PRODUCT_OWNERSHIP_ACCESS.is_current = TRUE). Pre-transfer streams of transferred products are excluded.
    tests:
      - unique:
          column_name: "concat(store_playlist_id, '-', country_code, '-', feed_id)"
    columns:
      - name: store_playlist_id
        tests:
          - not_null
      - name: playlist_id
        tests:
          - not_null
      - name: country_code
        tests:
          - not_null
      - name: feed_id
        tests:
          - not_null
      - name: store_id
        tests:
          - not_null
      - name: streams_all_time
        tests:
          - not_null
      - name: streams_365_days
        tests:
          - not_null
      - name: streams_183_days
        tests:
          - not_null
      - name: streams_28_days
        tests:
          - not_null
      - name: streams_7_days
        tests:
          - not_null
      - name: streams_1_day
        tests:
          - not_null

  - name: STREAMS_BY_PLAYLIST_FEED_ROLLUP_PRODUCT_TRANSFER_DBT
    config:
      tags: ['product_transfer']
    description:
      A table containing number of streams for multiple time periods on a playlist level, restricted to streams attributed to the current product owner (PRODUCT_OWNERSHIP_ACCESS.is_current = TRUE). Pre-transfer streams of transferred products are excluded.
    tests:
      - unique:
          column_name: "concat(store_playlist_id, '-', feed_id)"
    columns:
      - name: store_playlist_id
        tests:
          - not_null
      - name: playlist_id
        tests:
          - not_null
      - name: feed_id
        tests:
          - not_null
      - name: store_id
        tests:
          - not_null
      - name: streams_all_time
        tests:
          - not_null
      - name: streams_365_days
        tests:
          - not_null
      - name: streams_183_days
        tests:
          - not_null
      - name: streams_28_days
        tests:
          - not_null
      - name: streams_7_days
        tests:
          - not_null
      - name: streams_1_day
        tests:
          - not_null
