use crate::types::ReactionType;
use strum_macros::{AsRefStr, Display, EnumString, IntoStaticStr};
#[derive(Debug, Display, Clone, Copy, PartialEq, Eq, Hash, EnumString, AsRefStr, IntoStaticStr)]
pub enum ReactionTypeType {
#[strum(serialize = "emoji")]
Emoji,
#[strum(serialize = "custom_emoji")]
CustomEmoji,
#[strum(serialize = "paid")]
Paid,
}
impl ReactionTypeType {
#[must_use]
pub const fn all() -> [ReactionTypeType; 3usize] {
[
ReactionTypeType::Emoji,
ReactionTypeType::CustomEmoji,
ReactionTypeType::Paid,
]
}
}
impl From<ReactionTypeType> for Box<str> {
fn from(val: ReactionTypeType) -> Self {
Into::<&'static str>::into(val).into()
}
}
impl From<ReactionTypeType> for String {
fn from(val: ReactionTypeType) -> Self {
val.as_ref().to_owned()
}
}
impl<'a> PartialEq<&'a str> for ReactionTypeType {
fn eq(&self, other: &&'a str) -> bool {
self.as_ref() == *other
}
}
impl<'a> From<&'a ReactionType> for ReactionTypeType {
fn from(val: &'a ReactionType) -> Self {
match val {
ReactionType::Emoji(_) => ReactionTypeType::Emoji,
ReactionType::CustomEmoji(_) => ReactionTypeType::CustomEmoji,
ReactionType::Paid(_) => ReactionTypeType::Paid,
}
}
}
impl From<ReactionType> for ReactionTypeType {
fn from(val: ReactionType) -> Self {
ReactionTypeType::from(&val)
}
}