use super::NnsTopologyAssessmentStatus;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct NnsTopologyGapsReport {
pub schema_version: u32,
pub network: String,
pub source_endpoint: String,
pub status: NnsTopologyAssessmentStatus,
pub gaps: Vec<NnsTopologyGapRow>,
}
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct NnsTopologyGapRow {
pub subject_kind: NnsTopologyGapSubjectKind,
pub subject: String,
pub missing_relation: NnsTopologyGapRelationKind,
pub referenced_id: String,
}
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum NnsTopologyGapSubjectKind {
Node,
NodeOperator,
}
impl NnsTopologyGapSubjectKind {
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::Node => "node",
Self::NodeOperator => "node_operator",
}
}
}
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum NnsTopologyGapRelationKind {
NodeProvider,
NodeOperator,
DataCenter,
}
impl NnsTopologyGapRelationKind {
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::NodeProvider => "node_provider",
Self::NodeOperator => "node_operator",
Self::DataCenter => "data_center",
}
}
}
#[cfg(test)]
mod tests;