use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
pub enum CommentaryStyle {
#[serde(rename = "professional")]
Professional,
#[serde(rename = "casual")]
Casual,
#[serde(rename = "educational")]
Educational,
#[serde(rename = "entertaining")]
Entertaining,
#[serde(rename = "analytical")]
Analytical,
#[serde(rename = "storytelling")]
Storytelling,
#[serde(rename = "poetic")]
Poetic,
#[serde(rename = "technical")]
Technical, }
impl CommentaryStyle {
pub fn display_name(&self) -> &'static str {
match self {
CommentaryStyle::Professional => "Professional",
CommentaryStyle::Casual => "Casual",
CommentaryStyle::Educational => "Educational",
CommentaryStyle::Entertaining => "Entertaining",
CommentaryStyle::Analytical => "Analytical",
CommentaryStyle::Storytelling => "Storytelling",
CommentaryStyle::Poetic => "Poetic",
CommentaryStyle::Technical => "Technical",
}
}
pub fn description(&self) -> &'static str {
match self {
CommentaryStyle::Professional => {
"Formal, technical commentary suitable for business or academic contexts"
},
CommentaryStyle::Casual => {
"Relaxed, conversational style that feels natural and approachable"
},
CommentaryStyle::Educational => {
"Informative, teaching-focused commentary that explains concepts clearly"
},
CommentaryStyle::Entertaining => {
"Engaging, humorous style that keeps viewers entertained"
},
CommentaryStyle::Analytical => "Data-driven, detailed analysis of video content",
CommentaryStyle::Storytelling => {
"Narrative, storytelling approach that creates a compelling story"
},
CommentaryStyle::Poetic => "Creative, poetic language that adds artistic flair",
CommentaryStyle::Technical => {
"Highly technical, detailed explanations of video content"
},
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use serde_json;
#[test]
fn test_commentary_style_display_name() {
assert_eq!(CommentaryStyle::Professional.display_name(), "Professional");
assert_eq!(CommentaryStyle::Casual.display_name(), "Casual");
assert_eq!(CommentaryStyle::Educational.display_name(), "Educational");
assert_eq!(CommentaryStyle::Entertaining.display_name(), "Entertaining");
assert_eq!(CommentaryStyle::Analytical.display_name(), "Analytical");
assert_eq!(CommentaryStyle::Storytelling.display_name(), "Storytelling");
assert_eq!(CommentaryStyle::Poetic.display_name(), "Poetic");
assert_eq!(CommentaryStyle::Technical.display_name(), "Technical");
}
#[test]
fn test_commentary_style_description() {
assert!(!CommentaryStyle::Professional.description().is_empty());
assert!(!CommentaryStyle::Casual.description().is_empty());
assert!(!CommentaryStyle::Educational.description().is_empty());
assert!(!CommentaryStyle::Entertaining.description().is_empty());
assert!(!CommentaryStyle::Analytical.description().is_empty());
assert!(!CommentaryStyle::Storytelling.description().is_empty());
assert!(!CommentaryStyle::Poetic.description().is_empty());
assert!(!CommentaryStyle::Technical.description().is_empty());
}
#[test]
fn test_commentary_style_serialization() {
let style = CommentaryStyle::Professional;
let json = serde_json::to_string(&style).unwrap();
assert_eq!(json, "\"professional\"");
let deserialized: CommentaryStyle = serde_json::from_str(&json).unwrap();
assert_eq!(deserialized, CommentaryStyle::Professional);
let deserialized: CommentaryStyle = serde_json::from_str("\"casual\"").unwrap();
assert_eq!(deserialized, CommentaryStyle::Casual);
let deserialized: CommentaryStyle = serde_json::from_str("\"educational\"").unwrap();
assert_eq!(deserialized, CommentaryStyle::Educational);
}
}