use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ModuleEntity {
pub name: String,
pub path: String,
pub language: String,
pub line_count: usize,
pub doc_comment: Option<String>,
pub attributes: Vec<String>,
}
impl ModuleEntity {
pub fn new(
name: impl Into<String>,
path: impl Into<String>,
language: impl Into<String>,
) -> Self {
Self {
name: name.into(),
path: path.into(),
language: language.into(),
line_count: 0,
doc_comment: None,
attributes: Vec::new(),
}
}
pub fn with_line_count(mut self, count: usize) -> Self {
self.line_count = count;
self
}
pub fn with_doc(mut self, doc: impl Into<String>) -> Self {
self.doc_comment = Some(doc.into());
self
}
pub fn with_attributes(mut self, attrs: Vec<String>) -> Self {
self.attributes = attrs;
self
}
}