vidsage_core/commentary/
style.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
7pub enum CommentaryStyle {
8 #[serde(rename = "professional")]
9 Professional, #[serde(rename = "casual")]
12 Casual, #[serde(rename = "educational")]
15 Educational, #[serde(rename = "entertaining")]
18 Entertaining, #[serde(rename = "analytical")]
21 Analytical, #[serde(rename = "storytelling")]
24 Storytelling, #[serde(rename = "poetic")]
27 Poetic, #[serde(rename = "technical")]
30 Technical, }
32
33impl CommentaryStyle {
34 pub fn display_name(&self) -> &'static str {
36 match self {
37 CommentaryStyle::Professional => "Professional",
38 CommentaryStyle::Casual => "Casual",
39 CommentaryStyle::Educational => "Educational",
40 CommentaryStyle::Entertaining => "Entertaining",
41 CommentaryStyle::Analytical => "Analytical",
42 CommentaryStyle::Storytelling => "Storytelling",
43 CommentaryStyle::Poetic => "Poetic",
44 CommentaryStyle::Technical => "Technical",
45 }
46 }
47
48 pub fn description(&self) -> &'static str {
50 match self {
51 CommentaryStyle::Professional => {
52 "Formal, technical commentary suitable for business or academic contexts"
53 },
54 CommentaryStyle::Casual => {
55 "Relaxed, conversational style that feels natural and approachable"
56 },
57 CommentaryStyle::Educational => {
58 "Informative, teaching-focused commentary that explains concepts clearly"
59 },
60 CommentaryStyle::Entertaining => {
61 "Engaging, humorous style that keeps viewers entertained"
62 },
63 CommentaryStyle::Analytical => "Data-driven, detailed analysis of video content",
64 CommentaryStyle::Storytelling => {
65 "Narrative, storytelling approach that creates a compelling story"
66 },
67 CommentaryStyle::Poetic => "Creative, poetic language that adds artistic flair",
68 CommentaryStyle::Technical => {
69 "Highly technical, detailed explanations of video content"
70 },
71 }
72 }
73}
74
75#[cfg(test)]
76mod tests {
77 use super::*;
78 use serde_json;
79
80 #[test]
81 fn test_commentary_style_display_name() {
82 assert_eq!(CommentaryStyle::Professional.display_name(), "Professional");
83 assert_eq!(CommentaryStyle::Casual.display_name(), "Casual");
84 assert_eq!(CommentaryStyle::Educational.display_name(), "Educational");
85 assert_eq!(CommentaryStyle::Entertaining.display_name(), "Entertaining");
86 assert_eq!(CommentaryStyle::Analytical.display_name(), "Analytical");
87 assert_eq!(CommentaryStyle::Storytelling.display_name(), "Storytelling");
88 assert_eq!(CommentaryStyle::Poetic.display_name(), "Poetic");
89 assert_eq!(CommentaryStyle::Technical.display_name(), "Technical");
90 }
91
92 #[test]
93 fn test_commentary_style_description() {
94 assert!(!CommentaryStyle::Professional.description().is_empty());
95 assert!(!CommentaryStyle::Casual.description().is_empty());
96 assert!(!CommentaryStyle::Educational.description().is_empty());
97 assert!(!CommentaryStyle::Entertaining.description().is_empty());
98 assert!(!CommentaryStyle::Analytical.description().is_empty());
99 assert!(!CommentaryStyle::Storytelling.description().is_empty());
100 assert!(!CommentaryStyle::Poetic.description().is_empty());
101 assert!(!CommentaryStyle::Technical.description().is_empty());
102 }
103
104 #[test]
105 fn test_commentary_style_serialization() {
106 let style = CommentaryStyle::Professional;
108 let json = serde_json::to_string(&style).unwrap();
109 assert_eq!(json, "\"professional\"");
110
111 let deserialized: CommentaryStyle = serde_json::from_str(&json).unwrap();
113 assert_eq!(deserialized, CommentaryStyle::Professional);
114
115 let deserialized: CommentaryStyle = serde_json::from_str("\"casual\"").unwrap();
117 assert_eq!(deserialized, CommentaryStyle::Casual);
118
119 let deserialized: CommentaryStyle = serde_json::from_str("\"educational\"").unwrap();
120 assert_eq!(deserialized, CommentaryStyle::Educational);
121 }
122}