1use std::marker::PhantomData;
2
3use cosmwasm_schema::{cw_serde, QueryResponses};
4
5use crate::Order;
6
7#[cw_serde]
8pub struct DomainRouteSet<T> {
9 pub domain: u32,
10 pub route: Option<T>,
11}
12
13#[cw_serde]
14pub enum RouterMsg<T> {
15 SetRoute { set: DomainRouteSet<T> },
16 SetRoutes { set: Vec<DomainRouteSet<T>> },
17}
18
19#[cw_serde]
20#[derive(QueryResponses)]
21pub enum RouterQuery<T> {
22 #[returns(DomainsResponse)]
23 Domains {},
24
25 #[returns(RouteResponse<T>)]
26 GetRoute { domain: u32 },
27
28 #[returns(RoutesResponse<T>)]
29 ListRoutes {
30 offset: Option<u32>,
31 limit: Option<u32>,
32 order: Option<Order>,
33 },
34
35 #[serde(skip)]
36 #[returns(cosmwasm_std::Empty)]
37 Placeholder(PhantomData<T>),
38}
39
40#[cw_serde]
41pub struct DomainsResponse {
42 pub domains: Vec<u32>,
43}
44
45#[cw_serde]
46pub struct RouteResponse<T> {
47 pub route: DomainRouteSet<T>,
48}
49
50#[cw_serde]
51pub struct RoutesResponse<T> {
52 pub routes: Vec<DomainRouteSet<T>>,
53}