use super::zone::ZoneId; use crate::schedule::Schedule; use serde::{Deserialize, Serialize}; use std::{sync::Arc, time::Duration}; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ProgramItem { // TODO: update nomenclature #[serde(rename = "sectionId")] pub zone_id: ZoneId, #[serde(with = "crate::serde::duration_secs")] pub duration: Duration, } pub type ProgramSequence = Vec; pub type ProgramId = u32; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Program { pub id: ProgramId, pub name: String, pub sequence: ProgramSequence, pub enabled: bool, pub schedule: Schedule, } pub type ProgramRef = Arc; pub type Programs = im::OrdMap; #[derive(Default, Debug, Serialize, Deserialize)] #[serde(default, rename_all = "camelCase")] pub struct ProgramUpdateData { pub name: Option, pub sequence: Option, pub enabled: Option, pub schedule: Option, }