use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum Dimension {
Accessibility,
Performance,
Seo,
Security,
Mobile,
}
impl Dimension {
pub fn label(&self) -> &'static str {
match self {
Dimension::Accessibility => "Accessibility",
Dimension::Performance => "Performance",
Dimension::Seo => "SEO",
Dimension::Security => "Security",
Dimension::Mobile => "Mobile",
}
}
}
impl std::fmt::Display for Dimension {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.label())
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum Subcategory {
ContentAlternatives,
StructureSemantics,
NavigationInteraction,
FormsInteraction,
LanguageClarity,
TechnicalRobustness,
VisualPresentation,
LoadBehavior,
Interactivity,
VisualStability,
ResourceUsage,
TechnicalComplexity,
SnippetMetadata,
ContentStructure,
Indexability,
Linking,
SemanticSignals,
Transport,
Headers,
BrowserProtection,
ServerConfiguration,
Viewport,
TouchUsability,
Readability,
ResponsiveLayout,
ContentSizing,
}
impl Subcategory {
pub fn dimension(&self) -> Dimension {
match self {
Self::ContentAlternatives
| Self::StructureSemantics
| Self::NavigationInteraction
| Self::FormsInteraction
| Self::LanguageClarity
| Self::TechnicalRobustness
| Self::VisualPresentation => Dimension::Accessibility,
Self::LoadBehavior
| Self::Interactivity
| Self::VisualStability
| Self::ResourceUsage
| Self::TechnicalComplexity => Dimension::Performance,
Self::SnippetMetadata
| Self::ContentStructure
| Self::Indexability
| Self::Linking
| Self::SemanticSignals => Dimension::Seo,
Self::Transport
| Self::Headers
| Self::BrowserProtection
| Self::ServerConfiguration => Dimension::Security,
Self::Viewport
| Self::TouchUsability
| Self::Readability
| Self::ResponsiveLayout
| Self::ContentSizing => Dimension::Mobile,
}
}
pub fn label(&self) -> &'static str {
match self {
Self::ContentAlternatives => "Inhalte & Alternativen",
Self::StructureSemantics => "Struktur & Semantik",
Self::NavigationInteraction => "Navigation & Bedienung",
Self::FormsInteraction => "Formulare & Interaktion",
Self::LanguageClarity => "Sprache & Verständlichkeit",
Self::TechnicalRobustness => "Technische Robustheit",
Self::VisualPresentation => "Visuelle Darstellung",
Self::LoadBehavior => "Ladeverhalten",
Self::Interactivity => "Interaktivität",
Self::VisualStability => "Stabilität",
Self::ResourceUsage => "Ressourcenverbrauch",
Self::TechnicalComplexity => "Technische Komplexität",
Self::SnippetMetadata => "Snippet & Metadaten",
Self::ContentStructure => "Inhaltsstruktur",
Self::Indexability => "Indexierbarkeit",
Self::Linking => "Verlinkung",
Self::SemanticSignals => "Semantische Signale",
Self::Transport => "Transport",
Self::Headers => "Security Headers",
Self::BrowserProtection => "Browser-Schutz",
Self::ServerConfiguration => "Server-Konfiguration",
Self::Viewport => "Viewport",
Self::TouchUsability => "Touch & Bedienbarkeit",
Self::Readability => "Lesbarkeit",
Self::ResponsiveLayout => "Responsive Layout",
Self::ContentSizing => "Content Sizing",
}
}
}