use chrono::NaiveDateTime; use serde::{Deserialize, Serialize}; #[derive(Clone)] pub struct User { pub id: i64, pub username: String, } #[derive(Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum DeviceType { Desktop, Laptop, Mobile, Server, Other, } #[derive(Serialize)] pub struct Device { pub id: String, pub caption: String, pub r#type: DeviceType, pub subscriptions: i64, } #[derive(Deserialize)] pub struct DevicePatch { pub caption: Option, pub r#type: Option, } #[derive(Serialize, Deserialize, Debug)] #[serde(rename_all = "lowercase")] #[serde(tag = "action")] pub enum EpisodeActionType { Download, Play { #[serde(default)] started: Option, position: i32, #[serde(default)] total: Option, }, Delete, New, } #[derive(Serialize, Deserialize, Debug)] pub struct EpisodeAction { pub podcast: String, pub episode: String, pub timestamp: Option, #[serde(default)] pub device: Option, #[serde(flatten)] pub action: EpisodeActionType, }