version: 2
models:
  - name: silver__locked_liquidity_actions
    description: Records of all LP token locking transactions that have occurred on Osmosis, dating back to the genesis block. These actions include lock, unlock, unpool, and all superfluid actions.
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - TX_ID
            - MSG_GROUP
            - LOCK_ID
            - LOCKER_ADDRESS
    columns:
      - name: BLOCK_ID
        description: "{{ doc('block_id') }}"
        tests:
          - not_null
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - NUMBER    
                - FLOAT  
      - name: BLOCK_TIMESTAMP
        description: "{{ doc('block_timestamp') }}"
        tests:
          - not_null
          - dbt_expectations.expect_row_values_to_have_recent_data:
              datepart: day
              interval: 2
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - TIMESTAMP_NTZ
      - name: TX_ID
        description: "{{ doc('tx_id') }}"
        tests: 
          - not_null
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - STRING
                - VARCHAR
      - name: TX_SUCCEEDED
        tests:
          - not_null
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - BOOLEAN
      - name: MSG_GROUP
        description: "{{ doc('msg_group') }}"
        tests: 
          - not_null
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - NUMBER
                - FLOAT
      - name: MSG_TYPE
        description: "{{ doc('msg_type') }}"
        tests: 
          - not_null
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - STRING
                - VARCHAR
      - name: MSG_ACTION
        description: "{{ doc('action') }}"
        tests: 
          - not_null
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - STRING
                - VARCHAR
      - name: MSG_ACTION_DESCRIPTION
        description: "{{ doc('msg_action_description') }}"
        tests: 
          - not_null
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - STRING
                - VARCHAR
      - name: LOCKER_ADDRESS
        description: "{{ doc('locker_address') }}"
        tests: 
          - not_null
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - STRING
                - VARCHAR
          - dbt_expectations.expect_column_values_to_match_regex:
              regex: osmo1[0-9a-z]{38,38}
      - name: LOCK_ID
        description: "{{ doc('lock_id') }}"
        tests:
          - not_null:
              where: MSG_ACTION_DESCRIPTION <> 'unpool'
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - NUMBER
                - FLOAT
      - name: AMOUNT
        description: "{{ doc('amount') }}"
        tests: 
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - NUMBER
                - FLOAT
      - name: CURRENCY
        description: "{{ doc('currency') }}"
        tests: 
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - STRING
                - VARCHAR
      - name: POOL_ID
        description: "{{ doc('pool_id') }}"
        tests: 
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - NUMBER
                - FLOAT
      - name: LOCK_DURATION
        description: "{{ doc('lock_duration') }}" 
        tests: 
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - STRING
                - VARCHAR   
      - name: UNLOCK_TIME
        description: "{{ doc('unlock_time') }}"  
        tests: 
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - STRING
                - VARCHAR  
      - name: IS_SUPERFLUID
        description: "{{ doc('is_superfluid') }}"  
        tests: 
          - not_null
      - name: UNPOOL_NEW_LOCK_IDS
        description: "{{ doc('unpool_new_lock_ids') }}" 
        tests: 
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - STRING
                - VARCHAR 
      - name: _INSERTED_TIMESTAMP
        description: "{{ doc('inserted_timestamp') }}"
        tests:
          - not_null
