version: 2
models:
  - name: silver__decoded_metadata
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - MINT
          where: block_timestamp::date > current_date - 30
    recent_date_filter: &recent_date_filter
      config:
        where: _inserted_timestamp >= current_date - 7
    columns:
      - name: BLOCK_TIMESTAMP
        description: "{{ doc('block_timestamp') }}"
        tests:
          - not_null: *recent_date_filter
          - dbt_expectations.expect_row_values_to_have_recent_data:
              datepart: day
              interval: 2
      - name: BLOCK_ID
        description: "{{ doc('block_id') }}"
        tests:
          - not_null: *recent_date_filter
      - name: TX_ID
        description: "{{ doc('tx_id') }}"
        tests:
          - not_null: *recent_date_filter
      - name: MINT
        description: "{{ doc('mint') }}"
        tests:
          - not_null: *recent_date_filter
      - name: DECIMAL
        description: "{{ doc('decimal') }}"
        tests:
          - not_null: *recent_date_filter
      - name: TOKEN_NAME
        description: "Name of the token"
      - name: SYMBOL
        description: "Symbol of the token"
      - name: _INSERTED_TIMESTAMP
        description: "{{ doc('_inserted_timestamp') }}"
        tests: 
          - not_null
      - name: DECODED_METADATA_ID
        description: '{{ doc("pk") }}' 
        tests: 
          - unique: *recent_date_filter  
      - name: INSERTED_TIMESTAMP
        description: '{{ doc("inserted_timestamp") }}'  
        tests: 
          - not_null: *recent_date_filter 
      - name: MODIFIED_TIMESTAMP
        description: '{{ doc("modified_timestamp") }}' 
        tests: 
          - not_null: *recent_date_filter
      - name: _INVOCATION_ID
        description: '{{ doc("_invocation_id") }}' 
        tests: 
          - not_null: 
              name: test_silver__not_null_decoded_metadata__invocation_id
              <<: *recent_date_filter
   