Skip to main content

ito_domain/modules/
mod.rs

1//! Module domain models and repository.
2//!
3//! This module provides domain models for Ito modules and a repository
4//! for loading and querying module data.
5
6mod repository;
7
8pub use repository::ModuleRepository;
9
10use std::path::PathBuf;
11
12/// Full module with metadata loaded.
13#[derive(Debug, Clone)]
14pub struct Module {
15    /// Module identifier (e.g., "005")
16    pub id: String,
17    /// Module name (e.g., "dev-tooling")
18    pub name: String,
19    /// Optional description
20    pub description: Option<String>,
21    /// Path to the module directory
22    pub path: PathBuf,
23    /// Sub-modules belonging to this module; empty when none are defined.
24    pub sub_modules: Vec<SubModule>,
25}
26
27/// Lightweight module summary for listings.
28#[derive(Debug, Clone)]
29pub struct ModuleSummary {
30    /// Module identifier
31    pub id: String,
32    /// Module name
33    pub name: String,
34    /// Number of changes in this module
35    pub change_count: u32,
36    /// Sub-module summaries; empty when none are defined.
37    pub sub_modules: Vec<SubModuleSummary>,
38}
39
40/// A sub-module that groups changes within a parent module.
41///
42/// Sub-modules allow a module to be divided into named sections, each with
43/// their own change sequence. The canonical identifier is `NNN.SS` where
44/// `NNN` is the parent module number and `SS` is the sub-module number.
45#[derive(Debug, Clone)]
46pub struct SubModule {
47    /// Canonical sub-module identifier (e.g., "005.01")
48    pub id: String,
49    /// Parent module identifier (e.g., "005")
50    pub parent_module_id: String,
51    /// Sub-module number, zero-padded to 2 digits (e.g., "01")
52    pub sub_id: String,
53    /// Sub-module name (e.g., "core-api")
54    pub name: String,
55    /// Optional description
56    pub description: Option<String>,
57    /// Number of changes in this sub-module
58    pub change_count: u32,
59    /// Path to the sub-module directory
60    pub path: PathBuf,
61}
62
63/// Lightweight sub-module summary for listings.
64///
65/// Included in [`ModuleSummary`] when sub-modules are present.
66#[derive(Debug, Clone)]
67pub struct SubModuleSummary {
68    /// Canonical sub-module identifier (e.g., "005.01")
69    pub id: String,
70    /// Sub-module name
71    pub name: String,
72    /// Number of changes in this sub-module
73    pub change_count: u32,
74}
75
76#[cfg(test)]
77mod modules_tests;