version: 2
models:
  - name: silver__swaps_intermediate_bonkswap
    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_bonkswap_business_logic_test
          compare_model: ref('testing__swaps_intermediate_bonkswap')
          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 ('6nfq85sETizzDw4uuZ7X1S36uNcWUKdvvmtSGJFf7rvM5r8d9XLqFyyE7LLS6uyCkg2ksmgsHcS3umHYMymyeXB',
          'mQxJQ3oPFRsmncvRWwU4ecR4TpsLBF4jdk6HwkHP69kwsPCvFxQxGUiMinGs4iEC5rz7p5ShTnqJ7SeFD6h9v8Z',
          '4n9zk2i8qsQVjzgYGPuqJbrUjX92JToVEcTiAnhfExp5VDGs7Lz56ZGySgaxTDMVNQMhXYtMj9E7YcbzJjqBcdyv',
          '3ATCz7Vf2sMNKsqnMDs7hsQdTPzJA2ediwP3RTdcLCGPV1tgGNsaHn2MrEtHvo57zuQhsA1XFz1NBjU8iyPW8C2Z',
          '5KzijZM4SmdFBjRx5qQSusr8f17M9mDwyDm1vdhdoa6VF2TmFGNJfLCHCzJRp3aHkheJaDojNF28qx2qWTg1FAKR',
          '2HemzKoadNauTGqGmjsxnTN1mYm7vfRTjyeM38DYGM7qdGvmMfkFL5VQkHnTJ8giuUD1EV9w9NPQRvRSjSAFZ12A',
          '5ghJVhQyZuQoXLTjznjhmJ3EiGSDtdy1PT6xk7iw5GhukX7F4CmsYtPmh6C5Si8cY31Wuwo1dkX7iCzWgXuvNVgc',
          '6HuXhDg9cc5nkbWmTQYjj7hpAxrJwMW3ZQT21jNgTouabAm3CxBtAdAf9Q21Ffov9kQnADjEmxYLaSZrDFjcbDx',
          'fgmeRM6JRo9jZk53h4ECQpe5pt2joQK9PpBetFt9pSHpGNBrNjqDhW7Hihivb4n4d6VX2Gkpy3Dzk6wkCTvRjt1')"  
    recent_date_filter: &recent_date_filter
      config:
        where: _inserted_timestamp >= current_date - 7
    columns:
      - name: BLOCK_TIMESTAMP
        description: "{{ doc('block_timestamp') }}"
        tests:
          - not_null: *recent_date_filter
          - dbt_expectations.expect_row_values_to_have_recent_data:
              datepart: day
              interval: 2
      - 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: INDEX
        description: "{{ doc('index') }}"
        tests: 
          - not_null: *recent_date_filter
      - name: INNER_INDEX
        description: "{{ doc('inner_index') }}"
      - name: SUCCEEDED
        description: "{{ doc('tx_succeeded') }}"
        tests: 
          - not_null: *recent_date_filter
      - 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 AND _inserted_timestamp >= current_date - 7
      - 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