use crate::{
model::entity::EntityModel,
traits::{EntityKind, Path},
types::EntityTag,
};
#[derive(Clone, Copy, Debug)]
pub struct EntityAuthority {
model: &'static EntityModel,
entity_tag: EntityTag,
store_path: &'static str,
}
impl EntityAuthority {
#[must_use]
pub const fn new(
model: &'static EntityModel,
entity_tag: EntityTag,
store_path: &'static str,
) -> Self {
Self {
model,
entity_tag,
store_path,
}
}
#[must_use]
pub const fn for_type<E: EntityKind>() -> Self {
Self::new(E::MODEL, E::ENTITY_TAG, E::Store::PATH)
}
#[must_use]
pub const fn model(&self) -> &'static EntityModel {
self.model
}
#[must_use]
pub const fn entity_tag(&self) -> EntityTag {
self.entity_tag
}
#[must_use]
pub const fn entity_path(&self) -> &'static str {
self.model.path()
}
#[must_use]
pub const fn store_path(&self) -> &'static str {
self.store_path
}
}