import '../../contracts/tmdb.dart';


class TmdbRequestConfig {
  final String apiBaseUrl;
  final String imageBaseUrl;
  final String accessToken;
  final String apiKey;


  final Future<String?> Function()? onUnauthorized;

  const TmdbRequestConfig({
    required this.apiBaseUrl,
    required this.imageBaseUrl,
    this.accessToken = '',
    this.apiKey = '',
    this.onUnauthorized,
  });
}

abstract class TmdbGateway {
  Future<TmdbCreditsRes?> getCredits(
    TmdbRequestConfig config,
    String tmdbId,
    String mediaType, {
    required String language,
  });

  Future<TmdbRecommendationsRes?> getRecommendations(
    TmdbRequestConfig config,
    String tmdbId,
    String mediaType, {
    required String language,
  });

  Future<TmdbSeasonDetail?> getSeasonDetail(
    TmdbRequestConfig config,
    String tmdbId,
    int seasonNumber, {
    required String language,
  });

  Future<TmdbImageSet?> getImages(
    TmdbRequestConfig config,
    String tmdbId,
    String mediaType, {
    required String language,
  });

  Future<TmdbEnrichedDetail?> getEnrichedDetail(
    TmdbRequestConfig config,
    String tmdbId,
    String mediaType, {
    required String language,
    List<String> appendToResponse,
  });

  Future<TmdbVideosRes?> getVideos(
    TmdbRequestConfig config,
    String tmdbId,
    String mediaType, {
    required String language,
  });

  Future<TmdbPersonDetail?> getPersonDetail(
    TmdbRequestConfig config,
    int personId, {
    required String language,
  });

  Future<TmdbPersonCreditsRes?> getPersonCredits(
    TmdbRequestConfig config,
    int personId, {
    required String language,
  });

  Future<TmdbMediaDetail?> getMediaDetail(
    TmdbRequestConfig config,
    String tmdbId,
    String mediaType, {
    required String language,
  });

  Future<TmdbRecommendationsRes?> getTrending(
    TmdbRequestConfig config, {
    required String language,
    String mediaType,
    String timeWindow,
  });

  Future<TmdbRecommendationsRes?> getPopularMovies(
    TmdbRequestConfig config, {
    required String language,
  });

  Future<TmdbRecommendationsRes?> getPopularTv(
    TmdbRequestConfig config, {
    required String language,
  });

  Future<TmdbRecommendationsRes?> getAiringTodayTv(
    TmdbRequestConfig config, {
    required String language,
  });

  Future<TmdbRecommendationsRes?> getTopRatedMovies(
    TmdbRequestConfig config, {
    required String language,
  });


  Future<TmdbRecommendationsRes?> getDiscover(
    TmdbRequestConfig config,
    String mediaType, {
    required String language,
    String sortBy = 'popularity.desc',
    String? withGenres,
    String? voteCountGte,
  });

  Future<bool> testConnection(
    TmdbRequestConfig config, {
    required String language,
  });
}
