version: 2
models:
  - name: silver__swaps_intermediate_raydium
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - BLOCK_ID
            - TX_ID
            - SWAP_INDEX
          where: block_timestamp::date > current_date - 30
      - compare_model_subset:
          name: silver__swaps_intermediate_raydium_business_logic_test
          compare_model: ref('testing__swaps_intermediate_raydium')
          compare_columns: 
            - tx_id
            - succeeded
            - swapper
            - from_mint
            - round(from_amt,8)
            - to_mint
            - round(to_amt,8)
            - swap_index
          model_condition: "where tx_id in ('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')"
      - tx_excluded:
          name: silver__swaps_intermediate_raydium_tx_excluded_test
          excluded_tx_ids:
            - 48XpWuQQKmoGGoGgrNE73fVJVz2PwcqeoRPiWunb8jHaxXgqDDZ4JiUPQWkjdCTYy98grJit8MX9y2eNHoaKsjqm
            - 3XHSw61M1zr1ogrzrZ6wc6wgjp3sZFDustxcJAfuFd4GcNKRvbdmpWFYnqga3qje6seDCnSHqNEmQ2iP4BVftgMk
    columns:
      - name: BLOCK_TIMESTAMP
        description: "{{ doc('block_timestamp') }}"
        tests:
          - not_null
          - dbt_expectations.expect_row_values_to_have_recent_data:
              datepart: day
              interval: 2
      - name: BLOCK_ID
        description: "{{ doc('block_id') }}"
        tests:
          - not_null
      - name: TX_ID
        description: "{{ doc('tx_id') }}"
        tests:
          - not_null
      - name: SUCCEEDED
        description: "{{ doc('tx_succeeded') }}"
        tests: 
          - not_null
      - name: PROGRAM_ID
        description: "{{ doc('program_id') }}"
        tests: 
          - not_null
      - name: SWAPPER
        description: "{{ doc('swaps_swapper') }}"
        tests: 
          - not_null:
              where: succeeded = TRUE
      - name: FROM_AMT
        description:  "{{ doc('swaps_from_amt') }}"
      - name: FROM_MINT
        description:  "{{ doc('swaps_from_mint') }}"
      - name: TO_AMT
        description:  "{{ doc('swaps_to_amt') }}"
      - name: TO_MINT
        description:  "{{ doc('swaps_to_mint') }}"
      - name: SWAP_INDEX
        description: "{{ doc('swaps_swap_index') }}"
        tests: 
          - not_null: 
              where: succeeded = TRUE
      - name: _LOG_ID
        description: "Combination of TX_ID and event index"
      - name: _INSERTED_TIMESTAMP
        description: "{{ doc('_inserted_timestamp') }}"
        tests: 
          - not_null