import 'dart:convert';

import 'package:built_collection/built_collection.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';

part 'tmdb_trending_response.g.dart';

abstract class TmdbTrendingResponse implements Built<TmdbTrendingResponse, TmdbTrendingResponseBuilder> {
  static Serializer<TmdbTrendingResponse> get serializer => _$tmdbTrendingResponseSerializer;

  int get page;

  BuiltList<TmdbMovieResult> get results;

  @BuiltValueField(wireName: 'total_pages')
  int get totalPages;

  @BuiltValueField(wireName: 'total_results')
  int get totalResults;

  TmdbTrendingResponse._();

  factory TmdbTrendingResponse([void Function(TmdbTrendingResponseBuilder) updates]) = _$TmdbTrendingResponse;
}

abstract class TmdbMovieResult implements Built<TmdbMovieResult, TmdbMovieResultBuilder> {
  static Serializer<TmdbMovieResult> get serializer => _$tmdbMovieResultSerializer;

  bool get adult;

  @BuiltValueField(wireName: 'backdrop_path')
  String get backdropPath;

  int get id;

  String get title;

  @BuiltValueField(wireName: 'original_title')
  String get originalTitle;

  String get overview;

  @BuiltValueField(wireName: 'poster_path')
  String get posterPath;

  @BuiltValueField(wireName: 'media_type')
  String get mediaType;

  @BuiltValueField(wireName: 'genre_ids')
  BuiltList<int> get genreIds;

  double get popularity;

  @BuiltValueField(wireName: 'release_date')
  DateTime get releaseDate;

  bool get video;

  @BuiltValueField(wireName: 'vote_average')
  double get voteAverage;

  @BuiltValueField(wireName: 'vote_count')
  int get voteCount;

  TmdbMovieResult._();

  factory TmdbMovieResult([void Function(TmdbMovieResultBuilder) updates]) = _$TmdbMovieResult;
}
