use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
pub struct CalendarCreationFlows {
pub flows: Vec<CalendarCreationFlow>,
}
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
pub struct CalendarCreationFlow {
pub id: String,
pub title: String,
pub description: String,
pub sections: Vec<CalendarCreationSection>,
}
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
pub struct CalendarCreationSection {
pub title: String,
pub description: String,
pub items: Vec<CalendarCreationItem>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(tag = "type")]
pub enum CalendarCreationItem {
#[serde(rename = "information")]
Information {
id: String,
title: String,
value: String,
},
#[serde(rename = "input")]
Input { id: String, title: String },
#[serde(rename = "color")]
Color { id: String, title: String },
}
impl CalendarCreationItem {
pub fn id(&self) -> &str {
match self {
Self::Information { id, .. } | Self::Input { id, .. } | Self::Color { id, .. } => id,
}
}
pub fn title(&self) -> &str {
match self {
Self::Information { title, .. }
| Self::Input { title, .. }
| Self::Color { title, .. } => title,
}
}
}