2021-07-17 13:15:14 +02:00
/ * *
* Teapod
*
* Copyright 2020 - 2021 < seil0 @mosad . xyz >
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston ,
* MA 02110 - 1301 , USA .
*
* /
2021-07-10 23:37:16 +02:00
package org.mosad.teapod.util.tmdb
2021-07-17 13:15:14 +02:00
import com.google.gson.annotations.SerializedName
/ * *
* These data classes represent the tmdb api json objects .
* Fields which are nullable in the tmdb api are also nullable here .
* /
2021-07-10 23:37:16 +02:00
abstract class TMDBResult {
abstract val id : Int
2021-07-17 13:15:14 +02:00
abstract val name : String
abstract val overview : String ? // for movies tmdb return string or null
2021-07-10 23:37:16 +02:00
abstract val posterPath : String ?
abstract val backdropPath : String ?
}
2021-07-25 19:15:31 +02:00
data class TMDBMovie (
2021-07-10 23:37:16 +02:00
override val id : Int ,
2021-07-17 13:15:14 +02:00
override val name : String ,
override val overview : String ? ,
@SerializedName ( " poster_path " )
override val posterPath : String ? ,
@SerializedName ( " backdrop_path " )
override val backdropPath : String ? ,
@SerializedName ( " release_date " )
val releaseDate : String ,
@SerializedName ( " runtime " )
val runtime : Int ? ,
2021-07-10 23:37:16 +02:00
// TODO generes
) : TMDBResult ( )
2021-07-25 19:15:31 +02:00
data class TMDBTVShow (
2021-07-10 23:37:16 +02:00
override val id : Int ,
2021-07-17 13:15:14 +02:00
override val name : String ,
override val overview : String ,
@SerializedName ( " poster_path " )
override val posterPath : String ? ,
@SerializedName ( " backdrop_path " )
override val backdropPath : String ? ,
@SerializedName ( " first_air_date " )
val firstAirDate : String ,
@SerializedName ( " status " )
val status : String ,
2021-07-10 23:37:16 +02:00
// TODO generes
) : TMDBResult ( )
2021-07-25 19:15:31 +02:00
data class TMDBTVSeason (
2021-07-10 23:37:16 +02:00
val id : Int ,
2021-07-11 12:56:21 +02:00
val name : String ,
val overview : String ,
2021-07-17 13:15:14 +02:00
@SerializedName ( " poster_path " )
val posterPath : String ? ,
@SerializedName ( " air_date " )
2021-07-11 12:56:21 +02:00
val airDate : String ,
2021-07-17 13:15:14 +02:00
@SerializedName ( " episodes " )
2021-07-25 19:15:31 +02:00
val episodes : List < TMDBTVEpisode > ,
2021-07-17 13:15:14 +02:00
@SerializedName ( " season_number " )
2021-07-11 12:56:21 +02:00
val seasonNumber : Int
2021-07-10 23:37:16 +02:00
)
2021-07-25 19:15:31 +02:00
data class TMDBTVEpisode (
2021-07-10 23:37:16 +02:00
val id : Int ,
2021-07-11 12:56:21 +02:00
val name : String ,
val overview : String ,
2021-07-17 13:15:14 +02:00
@SerializedName ( " air_date " )
2021-07-11 12:56:21 +02:00
val airDate : String ,
2021-07-17 13:15:14 +02:00
@SerializedName ( " episode_number " )
2021-07-11 12:56:21 +02:00
val episodeNumber : Int
2021-07-10 23:37:16 +02:00
)