version: 2
models:
  - name: silver__snapshot_vote_accounts
    tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - EPOCH_RECORDED
            - VOTE_PUBKEY
      - dbt_utils.expression_is_true:
          expression: "last_timestamp < _inserted_timestamp + INTERVAL '1 HOUR'"
    columns:
      - name: epoch_recorded
        description: "The epoch when data was recorded"
        tests:
          - not_null
      - name: authorized_voter
        description: "Account responsible for signing vote transactions"
        tests:
          - not_null:
              where: authorized_withdrawer <> '11111111111111111111111111111111'
      - name: last_epoch_active
        description: "last epoch when vote account was active"
      - name: authorized_withdrawer
        description: "Account responsible for signing stake withdrawal transactions"
        tests:
          - not_null
      - name: commission
        description: "% of rewards payout to the vote account"
        tests:
          - not_null
      - name: epoch_credits
        description: "Credits earned by the end of epochs, containing epoch/credits/previous credits"
        tests:
          - not_null
      - name: last_timestamp_slot
        description: "Last slot voted on"
        tests:
          - not_null
      - name: last_timestamp
        description: "The timestamp when last slot was voted on"
        tests:
          - not_null
      - name: node_pubkey
        description: "pubkey for the Solana validator node"
        tests:
          - not_null
      - name: prior_voters
        description: "Prior voters for the vote account"
      - name: root_slot
        description: "latest slot confirmed"
      - name: votes
        description: "Votes during epoch"
        tests:
          - not_null
      - name: account_sol
        description: "SOL assigned to this account"
        tests:
          - not_null
      - name: owner
        description: "Program account that owns the vote account"
        tests:
          - not_null
      - name: rent_epoch
        description: "Epoch at which this account will next owe rent"
        tests:
          - not_null
      - name: vote_pubkey
        description: "Public key for the vote account"
        tests:
          - not_null
      - name: _inserted_timestamp
        description: "{{ doc('_inserted_timestamp') }}"
        tests:
          - not_null
      - name: INSERTED_TIMESTAMP
        description: '{{ doc("inserted_timestamp") }}'   
        tests: 
          - dbt_expectations.expect_row_values_to_have_recent_data:
              datepart: hour
              interval: 12
