use std::path::Path;
pub fn validate_video_format(format: &str) -> bool {
matches!(
format.to_lowercase().as_str(),
"mp4" | "webm" | "avi" | "mov" | "mkv" | "flv" | "wmv" | "m4v"
)
}
pub fn validate_commentary_style(style: &str) -> bool {
matches!(
style.to_lowercase().as_str(),
"professional"
| "casual"
| "educational"
| "entertaining"
| "analytical"
| "storytelling"
| "poetic"
| "technical"
)
}
pub fn validate_language_code(code: &str) -> bool {
code.len() == 2 && code.chars().all(|c| c.is_ascii_lowercase())
}
pub fn validate_resolution(resolution: (u32, u32)) -> bool {
let (width, height) = resolution;
width > 0 && height > 0 && width <= 8192 && height <= 8192
}
pub fn validate_frame_rate(frame_rate: f64) -> bool {
frame_rate > 0.0 && frame_rate <= 120.0
}
pub fn validate_compression_level(level: u8) -> bool {
level <= 9
}
pub fn validate_file_path(path: &Path) -> bool {
path.is_absolute() || path.starts_with("./") || path.starts_with("../")
}
pub fn validate_video_quality(quality: &str) -> bool {
matches!(
quality.to_lowercase().as_str(),
"low" | "medium" | "high" | "ultra"
)
}
pub fn validate_positive_integer(value: i64) -> bool {
value > 0
}
pub fn validate_positive_float(value: f64) -> bool {
value > 0.0
}
pub fn validate_percentage(value: u8) -> bool {
value <= 100
}