Skip to main content

ic_query/subnet_catalog/model/classification/
source.rs

1//! Module: subnet_catalog::model::classification::source
2//!
3//! Defines provenance labels for catalog classification values.
4
5use serde::{Deserialize, Serialize};
6
7///
8/// ClassificationSource
9///
10/// Provenance for one classification value in a subnet catalog record.
11///
12
13#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
14#[serde(rename_all = "snake_case")]
15pub enum ClassificationSource {
16    /// Value came directly from registry data.
17    Registry,
18    /// Value came from curated project metadata.
19    Curated,
20    /// Value was computed from other catalog data.
21    Computed,
22    /// Value source is unknown.
23    Unknown,
24}
25
26impl ClassificationSource {
27    /// Returns the stable snake_case value used in report text.
28    #[must_use]
29    pub const fn as_str(self) -> &'static str {
30        match self {
31            Self::Registry => "registry",
32            Self::Curated => "curated",
33            Self::Computed => "computed",
34            Self::Unknown => "unknown",
35        }
36    }
37}