use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum EditorialRole {
Owner,
Maintainer,
Editor,
Reviewer,
Publisher,
#[default]
Viewer,
}
impl EditorialRole {
#[must_use]
pub const fn can_initiate(self) -> bool {
matches!(self, Self::Owner | Self::Maintainer | Self::Editor)
}
#[must_use]
pub const fn can_review(self) -> bool {
matches!(self, Self::Owner | Self::Reviewer)
}
#[must_use]
pub const fn can_publish(self) -> bool {
matches!(self, Self::Owner | Self::Publisher)
}
#[must_use]
pub const fn can_withdraw(self) -> bool {
matches!(self, Self::Owner | Self::Maintainer | Self::Publisher)
}
}