use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum Kind {
Entity,
Concept,
Synthesis,
}
impl Kind {
#[must_use]
pub fn as_str(self) -> &'static str {
match self {
Self::Entity => "entity",
Self::Concept => "concept",
Self::Synthesis => "synthesis",
}
}
#[must_use]
pub fn defaults() -> &'static [Self] {
&[Self::Entity, Self::Concept, Self::Synthesis]
}
}
impl std::fmt::Display for Kind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum Status {
Active,
Superseded,
Stale,
Deprecated,
}
impl Status {
#[must_use]
pub fn as_str(self) -> &'static str {
match self {
Self::Active => "active",
Self::Superseded => "superseded",
Self::Stale => "stale",
Self::Deprecated => "deprecated",
}
}
#[must_use]
pub fn defaults() -> &'static [Self] {
&[
Self::Active,
Self::Superseded,
Self::Stale,
Self::Deprecated,
]
}
}
impl std::fmt::Display for Status {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}