use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ApiKeyScope {
#[serde(rename = "*")]
Star,
#[serde(rename = "api-keys:read")]
ApiKeysColonRead,
#[serde(rename = "api-keys:write")]
ApiKeysColonWrite,
#[serde(rename = "crawls:read")]
CrawlsColonRead,
#[serde(rename = "crawls:write")]
CrawlsColonWrite,
#[serde(rename = "patch-notes:read")]
PatchNotesColonRead,
#[serde(rename = "patch-notes:write")]
PatchNotesColonWrite,
#[serde(rename = "players:read")]
PlayersColonRead,
#[serde(rename = "players:read-details")]
PlayersColonReadDetails,
#[serde(rename = "players:write")]
PlayersColonWrite,
#[serde(rename = "punishments:read")]
PunishmentsColonRead,
#[serde(rename = "punishments:write")]
PunishmentsColonWrite,
}
impl std::fmt::Display for ApiKeyScope {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Self::Star => write!(f, "*"),
Self::ApiKeysColonRead => write!(f, "api-keys:read"),
Self::ApiKeysColonWrite => write!(f, "api-keys:write"),
Self::CrawlsColonRead => write!(f, "crawls:read"),
Self::CrawlsColonWrite => write!(f, "crawls:write"),
Self::PatchNotesColonRead => write!(f, "patch-notes:read"),
Self::PatchNotesColonWrite => write!(f, "patch-notes:write"),
Self::PlayersColonRead => write!(f, "players:read"),
Self::PlayersColonReadDetails => write!(f, "players:read-details"),
Self::PlayersColonWrite => write!(f, "players:write"),
Self::PunishmentsColonRead => write!(f, "punishments:read"),
Self::PunishmentsColonWrite => write!(f, "punishments:write"),
}
}
}
impl Default for ApiKeyScope {
fn default() -> ApiKeyScope {
Self::Star
}
}