use chrono::{DateTime, Utc}; use derivative::Derivative; use serde::{Deserialize, Serialize}; use serde_json::Number; use crate::models::HorizontallyScrollableText; #[derive(Deserialize, Debug)] #[serde(rename_all = "camelCase")] pub struct DiskSpace { pub free_space: Number, pub total_space: Number, } #[derive(Deserialize, Debug)] #[serde(rename_all = "camelCase")] pub struct SystemStatus { pub version: String, pub start_time: DateTime, } #[derive(Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct RootFolder { pub path: String, pub accessible: bool, pub free_space: Number, } #[derive(Derivative, Deserialize, Debug, Clone, PartialEq, Eq)] #[derivative(Default)] #[serde(rename_all = "camelCase")] pub struct Movie { #[derivative(Default(value = "Number::from(0)"))] pub id: Number, pub title: String, pub original_language: Language, #[derivative(Default(value = "Number::from(0)"))] pub size_on_disk: Number, pub status: String, pub overview: String, pub path: String, pub studio: String, pub genres: Vec, #[derivative(Default(value = "Number::from(0)"))] pub year: Number, pub monitored: bool, pub has_file: bool, #[derivative(Default(value = "Number::from(0)"))] pub runtime: Number, #[derivative(Default(value = "Number::from(0)"))] pub quality_profile_id: Number, pub certification: Option, pub ratings: RatingsList, pub movie_file: Option, pub collection: Option, } #[derive(Derivative, Deserialize, Debug, Clone, PartialEq, Eq)] #[derivative(Default)] #[serde(rename_all = "camelCase")] pub struct CollectionMovie { pub title: String, pub overview: String, #[derivative(Default(value = "Number::from(0)"))] pub year: Number, #[derivative(Default(value = "Number::from(0)"))] pub runtime: Number, pub genres: Vec, pub ratings: RatingsList, } #[derive(Deserialize, Derivative, Clone, Debug, PartialEq, Eq)] #[derivative(Default)] #[serde(rename_all = "camelCase")] pub struct Collection { pub title: String, pub root_folder_path: Option, pub search_on_add: bool, pub overview: Option, #[derivative(Default(value = "Number::from(0)"))] pub quality_profile_id: Number, pub movies: Option>, } #[derive(Deserialize, Derivative, Debug, Clone, PartialEq, Eq)] #[derivative(Default)] #[serde(rename_all = "camelCase")] pub struct MovieFile { pub relative_path: String, pub path: String, pub date_added: DateTime, pub media_info: MediaInfo, } #[derive(Deserialize, Derivative, Debug, Clone, PartialEq, Eq)] #[derivative(Default)] #[serde(rename_all = "camelCase")] pub struct MediaInfo { #[derivative(Default(value = "Number::from(0)"))] pub audio_bitrate: Number, #[derivative(Default(value = "Number::from(0)"))] pub audio_channels: Number, pub audio_codec: Option, pub audio_languages: Option, #[derivative(Default(value = "Number::from(0)"))] pub audio_stream_count: Number, #[derivative(Default(value = "Number::from(0)"))] pub video_bit_depth: Number, #[derivative(Default(value = "Number::from(0)"))] pub video_bitrate: Number, pub video_codec: String, #[derivative(Default(value = "Number::from(0)"))] pub video_fps: Number, pub resolution: String, pub run_time: String, pub scan_type: String, } #[derive(Default, Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct RatingsList { pub imdb: Option, pub tmdb: Option, pub rotten_tomatoes: Option, } #[derive(Derivative, Deserialize, Debug, Clone, PartialEq, Eq)] #[derivative(Default)] pub struct Rating { #[derivative(Default(value = "Number::from(0)"))] pub value: Number, } #[derive(Derivative, Deserialize, Debug)] #[derivative(Default)] #[serde(rename_all = "camelCase")] pub struct DownloadsResponse { pub records: Vec, } #[derive(Derivative, Deserialize, Debug, Clone, PartialEq, Eq)] #[derivative(Default)] #[serde(rename_all = "camelCase")] pub struct DownloadRecord { pub title: String, pub status: String, #[derivative(Default(value = "Number::from(0)"))] pub movie_id: Number, #[derivative(Default(value = "Number::from(0)"))] pub size: Number, #[derivative(Default(value = "Number::from(0)"))] pub sizeleft: Number, pub output_path: HorizontallyScrollableText, pub indexer: String, pub download_client: String, } #[derive(Derivative, Deserialize, Debug)] #[derivative(Default)] #[serde(rename_all = "camelCase")] pub struct QualityProfile { #[derivative(Default(value = "Number::from(0)"))] pub id: Number, pub name: String, } #[derive(Deserialize, Default, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct MovieHistoryItem { pub source_title: HorizontallyScrollableText, pub quality: QualityHistory, pub languages: Vec, pub date: DateTime, pub event_type: String, } #[derive(Deserialize, Default, Debug, Clone, PartialEq, Eq)] pub struct Language { pub name: String, } #[derive(Deserialize, Default, Debug, Clone, PartialEq, Eq)] pub struct QualityHistory { pub quality: Quality, } #[derive(Deserialize, Default, Debug, Clone, PartialEq, Eq)] pub struct Quality { pub name: String, } #[derive(Deserialize, PartialEq, Eq, Clone, Debug)] #[serde(rename_all = "lowercase")] pub enum CreditType { Cast, Crew, } #[derive(Deserialize, Clone, Debug, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct Credit { pub person_name: String, pub character: Option, pub department: Option, pub job: Option, #[serde(rename(deserialize = "type"))] pub credit_type: CreditType, } #[derive(Default, Derivative, Serialize, Debug)] #[serde(rename_all = "camelCase")] pub struct AddMovieBody { pub tmdb_id: u64, pub title: String, pub root_folder_path: String, pub quality_profile_id: u64, pub minimum_availability: String, pub monitored: bool, pub add_options: AddOptions, } #[derive(Default, Serialize, Debug, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct AddOptions { pub search_for_movie: bool, } #[derive(Derivative, Deserialize, Debug, Clone, PartialEq, Eq)] #[derivative(Default)] #[serde(rename_all = "camelCase")] pub struct AddMovieSearchResult { #[derivative(Default(value = "Number::from(0)"))] pub tmdb_id: Number, pub title: String, pub original_language: Language, pub status: String, pub overview: String, pub genres: Vec, #[derivative(Default(value = "Number::from(0)"))] pub year: Number, #[derivative(Default(value = "Number::from(0)"))] pub runtime: Number, pub ratings: RatingsList, }