version: 2
models:
  - name: silver__liquidity_pool_actions_meteora
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - BLOCK_ID
            - TX_ID
            - INDEX
            - INNER_INDEX
          where: block_timestamp::date > current_date - 30
      - compare_model_subset:
          name: silver__liquidity_pool_actions_meteora_business_logic_test
          compare_model: ref('testing__liquidity_pool_actions_meteora')
          compare_columns: 
            - tx_id
            - index
            - inner_index
            - program_id
            - action
            - mint
            - round(amount,8)
            - liquidity_provider
            - liquidity_pool_address
          model_condition: "where tx_id in ('HQVXg5FRV93oJeGuqkXVe4KnoJvRW3bJA7fJwjw1obJLgWWFHr8mtEhnYnW6NaNthrM7vbvsSgwX5uvs3us79J3',
          '5cuJ3DsDjCZtmADeusavqh1qsG52BBDthg82cJpaQkJRgHE1wCSYahuusCD6EoxNKPxd98847B5mo7g1X95Unfa3',
          '3RTWUqPBYKzPS2QW6rxCsvXvFYCgmTbMhEbCTHn479RwMUHskdEzPuY4Sknu2qHNb27ek6BFU7XDkMQ2yJsgvkpT',
          '4TYQhGdkBVnE2nF8RcSvWNwQKEPaACw9suBQP6Jjb5oEdJjxt75KaQeXaEMynoHGHQsWuWNZhtfHD3m4Y8t3x8d8',
          'CsVci6T9dkkKD1nZN1gJiw7Wc47wSoV6DsCyD5K2uUXNPnV1e5R7vssG3czmmXfNoYuk2S5AqiVQRALZjMZVcyF')"
    recent_date_filter: &recent_date_filter
      config:
        where: _inserted_timestamp >= current_date - 7
    columns:
      - name: BLOCK_TIMESTAMP
        description: "{{ doc('block_timestamp') }}"
        tests:
          - dbt_expectations.expect_row_values_to_have_recent_data:
              datepart: day
              interval: 2
          - not_null: *recent_date_filter
      - 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('index') }}"
        tests:
          - not_null: *recent_date_filter
      - name: INNER_INDEX
        description: "Position of event within inner instructions"
        tests:
          - not_null: *recent_date_filter
      - name: PROGRAM_ID
        description: "{{ doc('program_id') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: ACTION
        description: "{{ doc('action') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: MINT
        description: "{{ doc('mint') }}"
        tests: 
          - not_null:
              where: block_id > 69393037 AND _inserted_timestamp >= current_date - 7
      - name: AMOUNT
        description: "{{ doc('amount') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: LIQUIDITY_PROVIDER
        description: "{{ doc('liquidity_provider') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: LIQUIDITY_POOL_ADDRESS
        description: "{{ doc('liquidity_pool_address') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: _INSERTED_TIMESTAMP
        description: "{{ doc('_inserted_timestamp') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: LIQUIDITY_POOL_ACTIONS_METEORA_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_liquidity_pool_actions_meteora__invocation_id
              <<: *recent_date_filter
              

