use {
super::{component_type::ComponentType, information::ComponentInformation},
crate::{
fh::{FileHierarchy, Level},
LewpError,
},
std::rc::Rc,
};
pub trait Component {
type Content;
type ContentParameter;
fn component_information(&self) -> Rc<ComponentInformation>;
fn file_hierarchy(&self) -> Rc<FileHierarchy>;
fn content(
&self,
params: Self::ContentParameter,
) -> Result<Self::Content, LewpError>;
fn id(&self) -> String {
self.component_information().id.clone()
}
fn level(&self) -> Level {
self.component_information().level
}
fn kind(&self) -> ComponentType {
self.component_information().kind.clone()
}
}