use chrono::Weekday; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub enum Repetition { Daily { frequency: u8 }, Monthly { frequency: MonthFrequency }, Yearly, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub enum MonthFrequency { Day { day: u8 }, FirstDay { day: Weekday }, } // Validation pub fn validate_day(str: &str) -> Option { let n = str.parse::().ok()?; if n >= 1 && n <= 31 { Some(n) } else { None } }