version: 2
models:
  - name: silver__msg_attributes
    description: Records of all message attributes associated to messages that have occurred on Osmosis, dating back to the genesis block. 
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - TX_ID
            - MSG_INDEX
            - ATTRIBUTE_INDEX
    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: 1
          - 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('silver_msg_group') }}"
        tests: 
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - NUMBER
                - FLOAT
      - name: MSG_SUB_GROUP
        description: "{{ doc('msg_sub_group') }}"
        tests: 
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - NUMBER
                - FLOAT
      - name: MSG_INDEX
        description: "{{ doc('msg_index') }}"
        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: _INSERTED_TIMESTAMP
        description: "{{ doc('inserted_timestamp') }}"
        tests:
          - not_null
      - name: ATTRIBUTE_KEY
        description: "They key from the key-value pair from the message attribute"
        tests: 
          - not_null
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - STRING
                - VARCHAR
      - name: ATTRIBUTE_VALUE
        description: "They value from the key-value pair from the message attribute"
        tests: 
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - STRING
                - VARCHAR
      
