version: 2
models:
  - name: silver__swaps_intermediate_dooar
    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_dooar_business_logic_test
          compare_model: ref('testing__swaps_intermediate_dooar')
          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 ('31at6mYffEH2eFEFQxFt5vqsJpNpZx8Uofn1R53ABLaLyqAsgrUDQDqxiWSJ5k7JEZk8NF9V4kzT87PTctBHy28G',
          '4n6VDefX6cPhJ3pdTpUSqo7FxSDeqeymz7abto5V7KJppBZfhH7KDvZ4m8FCEdkeckkajbjW1KbMq6zqpzYptQk5',
          '4KvNEeQpzCx9QmsoGt8QNjtBDomYBnGMSNn1GeyWn6qQn2tsavPGEH26jbfoHHHUcesVbogJfXr9ghD6hv9rz6hD',
          '3dKk8sbjZ2yocabr8qUaLHsa7bkd4qxnW8gjsqwhTprVfMrPGeCFqmwu2vYFytaE1NViqtiY4ALZjR2we3xnsmP')"  
    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') }}"
        tests: 
          - not_null
      - name: FROM_MINT
        description:  "{{ doc('swaps_from_mint') }}"
        tests: 
          - not_null
      - name: TO_AMT
        description:  "{{ doc('swaps_to_amt') }}"
        tests: 
          - not_null
      - name: TO_MINT
        description:  "{{ doc('swaps_to_mint') }}"
        tests: 
          - not_null
      - name: SWAP_INDEX
        description: "{{ doc('swaps_swap_index') }}"
        tests: 
          - not_null
      - name: _INSERTED_TIMESTAMP
        description: "{{ doc('_inserted_timestamp') }}"
        tests: 
          - not_null