version: 2
models:
  - name: silver__burn_actions
    description: table holding token burn events
    recent_date_filter: &recent_date_filter
      config:
        where: _inserted_timestamp >= current_date - 7
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - TX_ID
            - INDEX
            - INNER_INDEX
            - EVENT_TYPE
            - MINT
          where: block_timestamp::date > current_date - 7
      - compare_model_subset:
          name: silver__burn_actions_logic_test
          compare_model: ref('testing__burn_actions')
          compare_columns: 
            - TX_ID
            - EVENT_TYPE
            - MINT
            - BURN_AUTHORITY
            - BURN_AMOUNT
          model_condition: "where tx_id in ('4KrSQZq32joS7Cs4CXRq3yqpq94sBkvMZDYJA1uUSyzDH26qDnUdfxhPy4Skb8d1HBQvanuhkwMSiAWRS5ueStf5',
          '5Gw9kgQi1Qh2fs1QCz9gt3ZTvL6bYqJ2pmbEgWP6cC5mYfPpSkppvZBBuxfMqWt7HQBw26dJGQjWzMQEyyhXBEHj',
          '4q64pGRsu79AyCjF8Ty2hkJfPinxm7JJhqWrefw8WLpkvW8n5Eg4EXxpgmDZGPEjoCXsCYGz5EphjQ4bmmbjMf8M',
          '5MBgE9rq527vcZK5fHzYE3XD5qQnzTmHZ1R4FnLCQGi3VK9LvroFNnKGpF7tpDtbYGZTUibJQbQXA1PquBq8rDHT',
          '4oEuNB3GMvPPrhQDVmF52dkh2kHXdEpZC29xYN1H24Cq8apHEUk92VHQsLzCNhcEude8VJ2Z9tAWa8pXr9tBP27H')"
    columns:
      - name: BLOCK_TIMESTAMP
        description: "{{ doc('block_timestamp') }}"
        tests:
          - not_null:
              where: block_id > 39824213 and _inserted_timestamp >= current_date - 7
          - dbt_expectations.expect_row_values_to_have_recent_data:
              datepart: day
              interval: 3
      - 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: SUCCEEDED
        description: "{{ doc('tx_succeeded') }}"
        tests:
          - not_null: *recent_date_filter
      - name: INDEX
        description: "{{ doc('event_index') }}"
        tests:
          - not_null: *recent_date_filter
      - name: INNER_INDEX
        description: Location of the inner instruction within an instruction
      - name: EVENT_TYPE 
        description: "{{ doc('event_type') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: MINT
        description: "{{ doc('mint') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: TOKEN_ACCOUNT
        description: The account address where tokens are burned from
      - name: BURN_AMOUNT
        description: Number of tokens burned
        tests: 
          - not_null: *recent_date_filter
      - name: BURN_AUTHORITY
        description: Account address authorizing burn
        tests: 
          - not_null: *recent_date_filter
      - name: SIGNERS
        description: Account address authorizing burn
      - name: _INSERTED_TIMESTAMP
        description: "{{ doc('_inserted_timestamp') }}"
        tests: 
          - not_null