| 1 | use serde::{Deserialize, Serialize}; |
| 2 | use super::player::{AudioFile, TauriResponse}; |
| 3 | |
| 4 | #[derive(Serialize)] |
| 5 | #[derive(Debug)] |
| 6 | pub struct ContentCarouselResponse { |
| 7 | pub status: TauriResponse, |
| 8 | pub message: String, |
| 9 | pub audio_files: Vec<SongProvider>, // TODO: Change to song_providers |
| 10 | } |
| 11 | |
| 12 | #[derive(Serialize, Deserialize)] |
| 13 | #[derive(Debug)] |
| 14 | pub struct CarouselResponse { |
| 15 | pub code: i32, |
| 16 | pub message: String, |
| 17 | pub audio_files: Vec<SongProvider>, |
| 18 | } |
| 19 | |
| 20 | #[derive(Serialize, Deserialize)] |
| 21 | #[derive(Debug)] |
| 22 | pub struct SongProvider { |
| 23 | pub id: i32, // API response code |
| 24 | pub name: String, |
| 25 | pub provider_id: String, |
| 26 | pub provider_type: ProviderType, |
| 27 | pub image_url: Option<String>, |
| 28 | pub audio_file: Option<AudioFile> |
| 29 | } |
| 30 | |
| 31 | #[derive(Serialize, Deserialize)] |
| 32 | #[derive(Debug)] |
| 33 | pub enum ProviderType { |
| 34 | #[serde(rename = "youtube")] |
| 35 | Youtube, |
| 36 | #[serde(rename = "spotify")] |
| 37 | Spotify, |
| 38 | } |
| 39 | |
| 40 | #[derive(Serialize)] |
| 41 | #[derive(Debug)] |
| 42 | pub struct ContentSongProviderResponse { |
| 43 | pub status: TauriResponse, |
| 44 | pub message: String, |
| 45 | pub song_provider: Option<SongProvider>, |
| 46 | pub votes: Vec<SongProviderVote> |
| 47 | } |
| 48 | |
| 49 | #[derive(Serialize, Deserialize)] |
| 50 | #[derive(Debug)] |
| 51 | pub struct SongProviderResponse { |
| 52 | pub code: i32, // API response code |
| 53 | pub message: String, |
| 54 | pub error: Option<String>, |
| 55 | pub song_provider: Option<SongProvider>, |
| 56 | pub votes: Option<Vec<SongProviderVote>> |
| 57 | } |
| 58 | |
| 59 | #[derive(Serialize, Deserialize)] |
| 60 | #[derive(Debug)] |
| 61 | pub struct SongProviderVote { |
| 62 | pub id: i32, |
| 63 | pub user_id: i32, |
| 64 | pub song_provider_id: i32, |
| 65 | pub vote_type: VoteType, |
| 66 | pub voter_username_or_id: String, |
| 67 | pub voter_gravatar: String, |
| 68 | pub created_at: String, |
| 69 | pub updated_at: String |
| 70 | } |
| 71 | |
| 72 | #[derive(Serialize, Deserialize)] |
| 73 | #[derive(Debug)] |
| 74 | pub enum VoteType { |
| 75 | #[serde(rename = "up")] |
| 76 | UP, |
| 77 | #[serde(rename = "down")] |
| 78 | DOWN |
| 79 | } |
| 80 | |
| 81 | #[derive(Serialize)] |
| 82 | #[derive(Debug)] |
| 83 | pub struct ContentSplitResponse { |
| 84 | pub status: TauriResponse, |
| 85 | pub message: String, |
| 86 | pub audio_file: Option<AudioFile>, |
| 87 | } |
| 88 | |
| 89 | #[derive(Serialize, Deserialize)] |
| 90 | #[derive(Debug)] |
| 91 | pub struct SplitResponse { |
| 92 | pub code: i32, |
| 93 | pub message: String, |
| 94 | pub audio_file: Option<AudioFile>, |
| 95 | } |