flix_tmdb/model/
movie.rs

1use core::time::Duration;
2
3use chrono::NaiveDate;
4
5use super::duration_from_minutes;
6use super::id::{CollectionId, MovieId};
7
8/// A deserialized Movie from the TMDB API
9#[derive(Debug, Clone, serde::Deserialize)]
10pub struct Movie {
11	/// The movie's TMDB ID
12	pub id: MovieId,
13	/// The movie's collection, if it exists
14	#[serde(rename = "belongs_to_collection")]
15	pub collection: Option<InCollection>,
16	/// The movie's title
17	pub title: String,
18	/// The movie's tagline
19	pub tagline: String,
20	/// The movie's overview
21	pub overview: String,
22	/// The movie's release date
23	pub release_date: NaiveDate,
24	/// The movie's runtime
25	#[serde(deserialize_with = "duration_from_minutes")]
26	pub runtime: Duration,
27}
28
29/// A deserialized movie's collection from the TMDB API
30#[derive(Debug, Clone, serde::Deserialize)]
31pub struct InCollection {
32	/// The collection's TMDB ID
33	pub id: CollectionId,
34	/// The collection's title
35	#[serde(rename = "name")]
36	pub title: String,
37}
38
39// TODO: Genres
40// pub genres: Vec<Genre>,
41// where: struct Genre { id, name }
42
43// TODO: Company
44// pub companies: Vec<Company>
45// where: struct Company { id, name }