version: 2
models:
  - name: silver__daily_balances
    description: A table that contains a daily balance entry for both staked and liquid balance of wallets on the Osmosis chain. 
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - DATE
            - ADDRESS
            - BALANCE_TYPE
            - CURRENCY
      - compare_model_subset:
          name: silver__daily_balances_business_logic_test
          compare_model: ref('testing__daily_balances')
          compare_columns: 
            - date
            - balance_type
            - address
            - currency
            - balance
          model_condition: "where date = '2022-07-17' 
                and ADDRESS IN ('osmo195khh6nr3zsvaxkm53wavkxv46uucdlatdux5m','osmo1ka4zctlzr2uee5s29y9qn2rcer3hcaunxvcptc','osmo1fjh798fyn9vqldc8ru09c99r89v5mt3czu4jfp')
                and balance <> 0"
    columns:
      - name: DATE
        description: The day the balance was recorded on. 
        tests: 
          - not_null
      - name: BALANCE_TYPE
        description: Either "staked" or "liquid" corresponding to how the currency is in the wallet. 
        tests: 
          - not_null
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - STRING
                - VARCHAR
          - dbt_expectations.expect_column_values_to_be_in_set:
              value_set: ['staked', 'liquid', 'locked liquidity', 'superfluid staked', 'pool']
      - name: ADDRESS
        description: "{{ doc('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: BALANCE 
        description: The amount of the currency the wallet held at the given time
        tests: 
          - not_null
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - NUMBER
                - FLOAT
      - name: CURRENCY
        description: "{{ doc('currency') }}"
        tests: 
          - not_null
          - dbt_expectations.expect_column_values_to_be_in_type_list:
              column_type_list:
                - STRING
                - VARCHAR
      - name: DECIMAL 
        description: "{{ doc('decimal') }}"
      