version: 2
models:
  - name: silver__swaps_intermediate_raydium_stable
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - TX_ID
            - SWAP_INDEX
            - PROGRAM_ID
          where: block_timestamp::date > current_date - 30
      - compare_model_subset:
          name: silver__swaps_intermediate_raydium_stable_business_logic_test
          compare_model: ref('testing__swaps_intermediate_raydium_stable')
          compare_columns: 
            - tx_id
            - swapper
            - round(from_amt,8)
            - from_mint
            - round(to_amt,8)
            - to_mint
            - swap_index
          model_condition: "where tx_id in ('4hCaNMB42Gg1YedK91GzZKpJS25sGpgB2sri8vatLn6S4WUU3MKCANTXepsBPjPewzjhefeTUFKG36BTr8y7hweh',
          '31JsUv3c9J5FMFJgxrBTeXghAVK3qnAKEjCBrZTXXjXvgxh6LUCc1yRuoNDXXDyywxwvcKxKGMaQh3GCsGLnAFAo'
          )" 
    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: "{{ doc('inner_index') }}"
      - name: PROGRAM_ID
        description: "{{ doc('program_id') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: SWAPPER
        description: "{{ doc('swaps_swapper') }}"
        tests: 
          - not_null:
              where: succeeded = TRUE
      - name: FROM_AMT
        description:  "{{ doc('swaps_from_amt') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: FROM_MINT
        description:  "{{ doc('swaps_from_mint') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: TO_AMT
        description:  "{{ doc('swaps_to_amt') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: TO_MINT
        description:  "{{ doc('swaps_to_mint') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: SWAP_INDEX
        description: "{{ doc('swaps_swap_index') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: _INSERTED_TIMESTAMP
        description: "{{ doc('_inserted_timestamp') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: SWAPS_INTERMEDIATE_RAYDIUM_stable_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_swaps_intermediate_raydium_stable__invocation_id
              <<: *recent_date_filter