version: 2
models:
  - name: silver__stake_pool_actions_jito
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - stake_pool_actions_jito_id
      - compare_model_subset:
          name: silver__stake_pool_actions_jito_business_logic_test
          compare_model: ref('testing__stake_pool_actions_jito')
          compare_columns: 
            - tx_id
            - index
            - inner_index
            - action
            - stake_pool
            - stake_pool_withdraw_authority
            - stake_pool_deposit_authority
            - address
            - reserve_stake_address
            - amount
          model_condition: "where tx_id in ('fn3s4BFL4tYwCWm7qVpeiMaoufr2yW3BdvS7w75RCY6mKhamEwJKtq6LcJdvJqbNro4EnyKW52uBmkNwmCsFkft',
            '2ZUtEGM3QUcQCR11nh8VVCRTEpXtgfrsbDMz7eymk4WShUDeRPrFE7Ja39ZkjioacJ7x6wJ2fbfmJybVM89pgEVJ',
            '3N3iRkkzC5NydgGLHHLxUH1krUjYpp7mDhQnMnuiHNk33r728MjYDm5SZCdhJAUuVcq7gpNxTrefYKwHVpfGGB9B',
            'TuJHZeAy2czF3LJyNtgcHyr6ngcX692cnQzNj2wvV38JJr3mGJ3N6tBq27w4S94pKNj9tNnCbtvTModwf9MpNgj',
            '2onuSzNrK1oNKTbS2AED5F4PTRdk1qLgPhAHYjUv1AMzWYTLDdRR43jgreb8ZQjeRDBYy4HmctJEfpxMxgHiPPCw',
            'L7RwAzBZ1Dd7NbiKGbj7xf9mfFtkDoEgbbKN3HyyfKj3gLhHYWuxHSazvxePJG6aXqw5Ard1MBZpk8ZPeLC4EuX')"
    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: INDEX
        description: Location of the stake pool action within a transaction
        tests: 
          - not_null 
      - name: INNER_INDEX
        description: Location of the stake pool action within the inner instructions of a transaction
        tests: 
          - not_null 
      - name: SUCCEEDED
        description: "{{ doc('tx_succeeded') }}"
        tests: 
          - not_null
      - name: ACTION
        description: "{{ doc('stake_pool_action') }}"
        tests: 
          - not_null 
      - name: STAKE_POOL
        description: "{{ doc('stake_pool') }}"
        tests: 
          - not_null
      - name: STAKE_POOL_WITHDRAW_AUTHORITY
        description: "{{ doc('stake_pool_withdraw_authority') }}"
        tests: 
          - not_null
      - name: STAKE_POOL_DEPOSIT_AUTHORITY
        description: "{{ doc('stake_pool_deposit_authority') }}"
      - name: ADDRESS
        description: "{{ doc('stake_pool_address') }}"
        tests: 
          - not_null
      - name: RESERVE_STAKE_ADDRESS
        description: "{{ doc('stake_pool_reserve_stake_address') }}"
        tests: 
          - not_null:
              where: action <> 'withdraw_stake'
      - name: AMOUNT
        description: "{{ doc('stake_pool_amount') }}"
        tests: 
          - not_null:
              where: succeeded = true
      - name: _INSERTED_TIMESTAMP
        description: "{{ doc('_inserted_timestamp') }}"
        tests: 
          - not_null