use super::marketplace::NodeType;
use crate::candid::{self, Decode, Error, Limits, Reader, Schema};
use candidate_types::Principal;
use serde::{Deserialize, Serialize};
projection! {
AvailableNode {
22_399 => dc: Option<String> [strict_optional],
287_472_983 => node_type: NodeType [required],
385_029_432 => node_id: Principal [required],
590_999_857 => provider: Principal [required],
1_148_394_404 => operator: Principal [required],
3_027_975_590 => sev_enabled: bool [required],
}
}
projection! {
AvailableNodesPage {
1_224_901_875 => next: Option<Principal> [strict_optional],
1_679_652_694 => registry_version: u64 [required],
2_680_076_337 => nodes: Vec<AvailableNode> [required],
}
}
projection! {
enum EngineError {
36_184_925 => Internal(String),
266_990_956 => ControllerError(String),
1_759_258_444 => InvalidTransition(String),
1_843_796_157 => SlugConflict(String),
1_851_232_335 => NotFound,
2_471_582_292 => Unauthorized,
2_488_679_284 => AlreadyExists,
3_243_640_289 => NotVetted,
3_929_426_986 => BadRequest(String),
}
}
projection! {
enum AvailableNodesPageResult {
#[serde(rename = "ok")]
24_860 => Ok(Option<AvailableNodesPage>),
#[serde(rename = "err")]
5_048_165 => Err(EngineError),
}
}
pub fn decode_list_available_nodes_page_response(
bytes: &[u8],
limits: Limits,
) -> Result<AvailableNodesPageResult, Error> {
candid::decode(bytes, limits)
}