use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum PlatformKind {
Telegram,
Discord,
}
impl fmt::Display for PlatformKind {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
Self::Telegram => "telegram",
Self::Discord => "discord",
})
}
}
#[derive(Debug, Clone)]
pub struct Platform {
pub(crate) kind: PlatformKind,
pub(crate) config: PlatformConfig,
}
#[derive(Debug, Clone)]
#[non_exhaustive]
#[allow(dead_code)] pub(crate) enum PlatformConfig {
Telegram { token: String },
Discord { token: String },
}
impl Platform {
pub fn telegram(token: impl Into<String>) -> Self {
Self {
kind: PlatformKind::Telegram,
config: PlatformConfig::Telegram {
token: token.into(),
},
}
}
pub fn discord(token: impl Into<String>) -> Self {
Self {
kind: PlatformKind::Discord,
config: PlatformConfig::Discord {
token: token.into(),
},
}
}
pub fn kind(&self) -> PlatformKind {
self.kind
}
}