use crate::nns::{NnsInventoryCacheRequest, NnsInventoryListRequest};
use crate::subnet_catalog::SubnetKind;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct NnsNodeListRequest {
pub inventory: NnsInventoryListRequest,
pub filters: NnsNodeListFilters,
}
impl NnsNodeListRequest {
#[must_use]
pub fn new(
cache: NnsInventoryCacheRequest,
source_endpoint: impl Into<String>,
now_unix_secs: u64,
) -> Self {
Self {
inventory: NnsInventoryListRequest::new(cache, source_endpoint, now_unix_secs),
filters: NnsNodeListFilters::default(),
}
}
}
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct NnsNodeListFilters {
pub subnet: Option<String>,
pub subnet_kind: Option<SubnetKind>,
pub data_center: Option<String>,
pub node_provider: Option<String>,
pub node_operator: Option<String>,
}
impl NnsNodeListFilters {
#[must_use]
pub const fn is_empty(&self) -> bool {
self.subnet.is_none()
&& self.subnet_kind.is_none()
&& self.data_center.is_none()
&& self.node_provider.is_none()
&& self.node_operator.is_none()
}
}