use crate::query_leverage::{
  AvailableBorrowParams, BorrowAPYParams, BorrowLimitParams, BorrowedParams, BorrowedValueParams,
  CollateralParams, CollateralValueParams, ExchangeRateParams, LeverageParametersParams,
  LiquidationTargetsParams, LiquidationThresholdParams, MarketSummaryParams,
  RegisteredTokensParams, ReserveAmountParams, SuppliedParams, SuppliedValueParams,
  SupplyAPYParams, TotalBorrowedParams, TotalCollateralParams, TotalSuppliedParams,
  TotalSuppliedValueParams, UmeeQueryLeverage, ASSIGNED_QUERY_AVAILABLE_BORROW,
  ASSIGNED_QUERY_BORROWED, ASSIGNED_QUERY_BORROWED_VALUE, ASSIGNED_QUERY_BORROW_APY,
  ASSIGNED_QUERY_BORROW_LIMIT, ASSIGNED_QUERY_COLLATERAL, ASSIGNED_QUERY_COLLATERAL_VALUE,
  ASSIGNED_QUERY_EXCHANGE_RATE, ASSIGNED_QUERY_LEVERAGE_PARAMS, ASSIGNED_QUERY_LIQUIDATION_TARGETS,
  ASSIGNED_QUERY_LIQUIDATION_THRESHOLD, ASSIGNED_QUERY_MARKET_SUMMARY,
  ASSIGNED_QUERY_REGISTERED_TOKENS, ASSIGNED_QUERY_RESERVE_AMOUNT, ASSIGNED_QUERY_SUPPLIED,
  ASSIGNED_QUERY_SUPPLIED_VALUE, ASSIGNED_QUERY_SUPPLY_APY, ASSIGNED_QUERY_TOTAL_BORROWED,
  ASSIGNED_QUERY_TOTAL_COLLATERAL, ASSIGNED_QUERY_TOTAL_SUPPLIED,
  ASSIGNED_QUERY_TOTAL_SUPPLIED_VALUE,
};
use crate::query_oracle::{
  ActiveExchangeRatesParams, AggregatePrevoteParams, AggregatePrevotesParams, AggregateVoteParams,
  AggregateVotesParams, ExchangeRatesParams, FeederDelegationParams, MissCounterParams,
  OracleParametersParams, UmeeQueryOracle, ASSIGNED_QUERY_ACTIVE_EXCHANGE_RATES,
  ASSIGNED_QUERY_AGGREGATE_PREVOTE, ASSIGNED_QUERY_AGGREGATE_PREVOTES,
  ASSIGNED_QUERY_AGGREGATE_VOTE, ASSIGNED_QUERY_AGGREGATE_VOTES, ASSIGNED_QUERY_EXCHANGE_RATES,
  ASSIGNED_QUERY_FEEDER_DELEGATION, ASSIGNED_QUERY_MISS_COUNTER, ASSIGNED_QUERY_ORACLE_PARAMS,
};
use cosmwasm_std::CustomQuery;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

// Define the implementation necessary for cosmwasm "custom" queries
impl CustomQuery for StructUmeeQuery {}
impl CustomQuery for UmeeQuery {}

// UmeeQuery combines all the native modules from umee as enum
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
#[serde(rename_all = "snake_case")]
pub enum UmeeQuery {
  // Leverage wraps all the query enums from the leverage module
  Leverage(UmeeQueryLeverage),
  // Oracle wraps all the query enums from the oracle module
  Oracle(UmeeQueryOracle),
}

// StructUmeeQuery expected structure to query umee native modules
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
#[serde(rename_all = "snake_case")]
pub struct StructUmeeQuery {
  assigned_query: u16,
  borrowed: Option<BorrowedParams>,
  exchange_rates: Option<ExchangeRatesParams>,
  registered_tokens: Option<RegisteredTokensParams>,
  leverage_parameters: Option<LeverageParametersParams>,
  borrowed_value: Option<BorrowedValueParams>,
  supplied: Option<SuppliedParams>,
  supplied_value: Option<SuppliedValueParams>,
  available_borrow: Option<AvailableBorrowParams>,
  borrow_apy: Option<BorrowAPYParams>,
  supply_apy: Option<SupplyAPYParams>,
  total_supplied_value: Option<TotalSuppliedValueParams>,
  total_supplied: Option<TotalSuppliedParams>,
  reserve_amount: Option<ReserveAmountParams>,
  collateral: Option<CollateralParams>,
  collateral_value: Option<CollateralValueParams>,
  exchange_rate: Option<ExchangeRateParams>,
  borrow_limit: Option<BorrowLimitParams>,
  liquidation_threshold: Option<LiquidationThresholdParams>,
  liquidation_targets: Option<LiquidationTargetsParams>,
  market_summary: Option<MarketSummaryParams>,
  total_collateral: Option<TotalCollateralParams>,
  total_borrowed: Option<TotalBorrowedParams>,
  active_exchange_rates: Option<ActiveExchangeRatesParams>,
  feeder_delegation: Option<FeederDelegationParams>,
  miss_counter: Option<MissCounterParams>,
  aggregate_prevote: Option<AggregatePrevoteParams>,
  aggregate_prevotes: Option<AggregatePrevotesParams>,
  aggregate_vote: Option<AggregateVoteParams>,
  aggregate_votes: Option<AggregateVotesParams>,
  oracle_params: Option<OracleParametersParams>,
}

// Defines all the implementation related to the StructUmeeQuery
// like creating new query structs, it is needed because
// the fields inside the struct are private, to avoid missmatching
// the query property with the assigned_query field
impl StructUmeeQuery {
  // creates a new borrowed query.
  pub fn borrowed(borrowed_params: BorrowedParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_BORROWED,
      borrowed: Some(borrowed_params),
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a new exchange_rates query.
  pub fn exchange_rates(exchange_rates_params: ExchangeRatesParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_EXCHANGE_RATES,
      borrowed: None,
      exchange_rates: Some(exchange_rates_params),
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a new registered_tokens query.
  pub fn registered_tokens(registered_tokens_params: RegisteredTokensParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_REGISTERED_TOKENS,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: Some(registered_tokens_params),
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a new leverage_parameters query.
  pub fn leverage_parameters(
    leverage_parameters_params: LeverageParametersParams,
  ) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_LEVERAGE_PARAMS,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: Some(leverage_parameters_params),
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a new borrowed_value query.
  pub fn borrowed_value(borrowed_value_params: BorrowedValueParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_BORROWED_VALUE,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: Some(borrowed_value_params),
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a new supplied query.
  pub fn supplied(supplied_params: SuppliedParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_SUPPLIED,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: Some(supplied_params),
      available_borrow: None,
      supplied_value: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a new supplied value query.
  pub fn supplied_value(supplied_value_params: SuppliedValueParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_SUPPLIED_VALUE,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: Some(supplied_value_params),
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a new available borrow query.
  pub fn available_borrow(available_borrow_params: AvailableBorrowParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_AVAILABLE_BORROW,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: Some(available_borrow_params),
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a new borrow apy query.
  pub fn borrow_apy(borrow_apy_params: BorrowAPYParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_BORROW_APY,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: Some(borrow_apy_params),
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a new supply apy query.
  pub fn supply_apy(supply_apy_params: SupplyAPYParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_SUPPLY_APY,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: Some(supply_apy_params),
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a new market size query.
  pub fn total_supplied_value(
    total_supplied_value_params: TotalSuppliedValueParams,
  ) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_TOTAL_SUPPLIED_VALUE,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: Some(total_supplied_value_params),
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a new token market size query.
  pub fn total_supplied(total_supplied_params: TotalSuppliedParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_TOTAL_SUPPLIED,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: Some(total_supplied_params),
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a reserve amount query.
  pub fn reserve_amount(reserve_amount_params: ReserveAmountParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_RESERVE_AMOUNT,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: Some(reserve_amount_params),
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a collateral query.
  pub fn collateral(collateral_params: CollateralParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_COLLATERAL,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: Some(collateral_params),
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a collateral value query.
  pub fn collateral_value(collateral_value_params: CollateralValueParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_COLLATERAL_VALUE,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: Some(collateral_value_params),
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a exchange rate query.
  pub fn exchange_rate(exchange_rate_params: ExchangeRateParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_EXCHANGE_RATE,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: Some(exchange_rate_params),
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a borrow limit query.
  pub fn borrow_limit(borrow_limit_params: BorrowLimitParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_BORROW_LIMIT,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: Some(borrow_limit_params),
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a liquidation threshold query.
  pub fn liquidation_threshold(
    liquidation_threshold_params: LiquidationThresholdParams,
  ) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_LIQUIDATION_THRESHOLD,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: Some(liquidation_threshold_params),
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a liquidation targets query.
  pub fn liquidation_targets(
    liquidation_targets_params: LiquidationTargetsParams,
  ) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_LIQUIDATION_TARGETS,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: Some(liquidation_targets_params),
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a market summary query.
  pub fn market_summary(market_summary_params: MarketSummaryParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_MARKET_SUMMARY,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: Some(market_summary_params),
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a total collateral query.
  pub fn total_collateral(total_collateral_params: TotalCollateralParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_TOTAL_COLLATERAL,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: Some(total_collateral_params),
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a total borrowed query.
  pub fn total_borrowed(total_borrowed_params: TotalBorrowedParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_TOTAL_BORROWED,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: Some(total_borrowed_params),
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a active exchange rates query.
  pub fn active_exchange_rates(
    active_exchange_rates_params: ActiveExchangeRatesParams,
  ) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_ACTIVE_EXCHANGE_RATES,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: Some(active_exchange_rates_params),
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a feeder delegation query.
  pub fn feeder_delegation(feeder_delegation_params: FeederDelegationParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_FEEDER_DELEGATION,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: Some(feeder_delegation_params),
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a miss counter query.
  pub fn miss_counter(miss_counter_params: MissCounterParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_MISS_COUNTER,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: Some(miss_counter_params),
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a aggregate prevote query.
  pub fn aggregate_prevote(aggregate_prevote_params: AggregatePrevoteParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_AGGREGATE_PREVOTE,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: Some(aggregate_prevote_params),
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a aggregate prevotes query.
  pub fn aggregate_prevotes(aggregate_prevotes_params: AggregatePrevotesParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_AGGREGATE_PREVOTES,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: Some(aggregate_prevotes_params),
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a aggregate vote query.
  pub fn aggregate_vote(aggregate_vote_params: AggregateVoteParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_AGGREGATE_VOTE,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: Some(aggregate_vote_params),
      aggregate_votes: None,
      oracle_params: None,
    }
  }
  // creates a aggregate votes query.
  pub fn aggregate_votes(aggregate_votes_params: AggregateVotesParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_AGGREGATE_VOTES,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: Some(aggregate_votes_params),
      oracle_params: None,
    }
  }
  // creates a new oracle parameters query.
  pub fn oracle_parameters(oracle_parameters_params: OracleParametersParams) -> StructUmeeQuery {
    StructUmeeQuery {
      assigned_query: ASSIGNED_QUERY_ORACLE_PARAMS,
      borrowed: None,
      exchange_rates: None,
      registered_tokens: None,
      leverage_parameters: None,
      borrowed_value: None,
      supplied: None,
      supplied_value: None,
      available_borrow: None,
      borrow_apy: None,
      supply_apy: None,
      total_supplied_value: None,
      total_supplied: None,
      reserve_amount: None,
      collateral: None,
      collateral_value: None,
      exchange_rate: None,
      borrow_limit: None,
      liquidation_threshold: None,
      liquidation_targets: None,
      market_summary: None,
      total_collateral: None,
      total_borrowed: None,
      active_exchange_rates: None,
      feeder_delegation: None,
      miss_counter: None,
      aggregate_prevote: None,
      aggregate_prevotes: None,
      aggregate_vote: None,
      aggregate_votes: None,
      oracle_params: Some(oracle_parameters_params),
    }
  }
}
