version: 2
models:
  - name: core__fact_token_daily_balances
    description: "{{ doc('fact_token_daily_balances') }}"
    recent_date_filter: &recent_date_filter
      config:
        where: modified_timestamp >= current_date - 7
    columns:
      - name: BALANCE_DATE
        description: "{{ doc('balance_date') }}"
        tests:
          - dbt_expectations.expect_column_to_exist
          - not_null: *recent_date_filter
      - name: ACCOUNT
        description: "{{ doc('balances_account') }}"
        tests:
          - dbt_expectations.expect_column_to_exist
          - not_null: *recent_date_filter
      - name: MINT
        description: "{{ doc('mint') }}"
        tests:
          - dbt_expectations.expect_column_to_exist
          - not_null: *recent_date_filter
      - name: AMOUNT
        description: "{{ doc('balances_post_amount') }}"
        tests:
          - dbt_expectations.expect_column_to_exist
          - not_null: *recent_date_filter
      - name: OWNER
        description: "{{ doc('token_balances_block_owner') }}"
        tests:
          - dbt_expectations.expect_column_to_exist
      - name: LAST_BALANCE_CHANGE
        description: "{{ doc('last_balance_change') }}"
        tests:
          - dbt_expectations.expect_column_to_exist
          - not_null: *recent_date_filter
      - name: BALANCE_CHANGED_ON_DATE
        description: "{{ doc('balance_changed_on_date') }}"
        tests:
          - dbt_expectations.expect_column_to_exist
          - not_null: *recent_date_filter
          - accepted_values:
              values: [true, false]
      - name: TOKEN_DAILY_BALANCES_ID
        description: '{{ doc("pk") }}'
        tests:
          - dbt_expectations.expect_column_to_exist
          - not_null: *recent_date_filter
          - unique: *recent_date_filter    
      - name: INSERTED_TIMESTAMP
        description: '{{ doc("inserted_timestamp") }}'
        tests:
          - dbt_expectations.expect_column_to_exist
          - not_null: *recent_date_filter    
      - name: MODIFIED_TIMESTAMP
        description: '{{ doc("modified_timestamp") }}' 
        tests:
          - dbt_expectations.expect_column_to_exist
          - not_null
