Skip to main content

archidoc_types/
report.rs

1use serde::{Deserialize, Serialize};
2
3/// Aggregated health report across all architectural elements.
4#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5pub struct HealthReport {
6    pub total_elements: usize,
7    pub container_count: usize,
8    pub component_count: usize,
9    pub total_files: usize,
10    pub files_planned: usize,
11    pub files_active: usize,
12    pub files_stable: usize,
13    pub patterns_total: usize,
14    pub patterns_planned: usize,
15    pub patterns_verified: usize,
16    pub per_element: Vec<ElementHealth>,
17}
18
19/// Health summary for a single architectural element.
20#[derive(Debug, Clone, Serialize, Deserialize)]
21pub struct ElementHealth {
22    pub name: String,
23    pub c4_level: String,
24    pub file_count: usize,
25    pub files_planned: usize,
26    pub files_active: usize,
27    pub files_stable: usize,
28    pub pattern: String,
29    pub pattern_confidence: String,
30}
31
32/// Validation report for file table integrity.
33#[derive(Debug, Clone, Default, Serialize, Deserialize)]
34pub struct ValidationReport {
35    pub ghosts: Vec<GhostEntry>,
36    pub orphans: Vec<OrphanEntry>,
37}
38
39impl ValidationReport {
40    pub fn is_clean(&self) -> bool {
41        self.ghosts.is_empty() && self.orphans.is_empty()
42    }
43}
44
45/// A file listed in a catalog but not present on disk.
46#[derive(Debug, Clone, Serialize, Deserialize)]
47pub struct GhostEntry {
48    pub element: String,
49    pub filename: String,
50    pub source_dir: String,
51}
52
53/// A file present on disk but not listed in any catalog.
54#[derive(Debug, Clone, Serialize, Deserialize)]
55pub struct OrphanEntry {
56    pub element: String,
57    pub filename: String,
58    pub source_dir: String,
59}
60
61/// Drift detection report — comparison of generated vs existing docs.
62#[derive(Debug, Clone, Default, Serialize, Deserialize)]
63pub struct DriftReport {
64    pub drifted_files: Vec<DriftedFile>,
65    pub missing_files: Vec<String>,
66    pub extra_files: Vec<String>,
67}
68
69impl DriftReport {
70    pub fn has_drift(&self) -> bool {
71        !self.drifted_files.is_empty()
72            || !self.missing_files.is_empty()
73            || !self.extra_files.is_empty()
74    }
75}
76
77/// A single file that differs between generated and existing.
78#[derive(Debug, Clone, Serialize, Deserialize)]
79pub struct DriftedFile {
80    pub path: String,
81    pub expected_lines: usize,
82    pub actual_lines: usize,
83}