Skip to main content

archidoc_types/
annotation.rs

1use serde::{Deserialize, Serialize};
2use std::fmt;
3
4/// Two-tier confidence for GoF pattern assignments.
5///
6/// `planned` — developer intent, not yet structurally validated.
7/// `verified` — structural heuristic has confirmed pattern alignment.
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9#[serde(rename_all = "lowercase")]
10pub enum PatternStatus {
11    Planned,
12    Verified,
13}
14
15impl Default for PatternStatus {
16    fn default() -> Self {
17        Self::Planned
18    }
19}
20
21impl fmt::Display for PatternStatus {
22    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23        match self {
24            Self::Planned => write!(f, "planned"),
25            Self::Verified => write!(f, "verified"),
26        }
27    }
28}
29
30impl PatternStatus {
31    pub fn parse(s: &str) -> Self {
32        match s.trim().to_lowercase().as_str() {
33            "verified" => Self::Verified,
34            _ => Self::Planned,
35        }
36    }
37}
38
39/// Implementation maturity of a file.
40///
41/// Progression: `planned` -> `active` -> `stable`.
42#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
43#[serde(rename_all = "lowercase")]
44pub enum HealthStatus {
45    Planned,
46    Active,
47    Stable,
48}
49
50impl Default for HealthStatus {
51    fn default() -> Self {
52        Self::Planned
53    }
54}
55
56impl fmt::Display for HealthStatus {
57    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
58        match self {
59            Self::Planned => write!(f, "planned"),
60            Self::Active => write!(f, "active"),
61            Self::Stable => write!(f, "stable"),
62        }
63    }
64}
65
66impl HealthStatus {
67    pub fn parse(s: &str) -> Self {
68        match s.trim().to_lowercase().as_str() {
69            "active" => Self::Active,
70            "stable" => Self::Stable,
71            _ => Self::Planned,
72        }
73    }
74}