# -*- coding: utf-8 -*-
from typing import Optional

from themoviedb import schemas, utils
from themoviedb.routes_async._base import Base


class Discover(Base):
    async def movie(
        self,
        *,
        page: int = 1,
        sort_by: str = "popularity.desc",
        certification_country: Optional[str] = None,
        certification: Optional[str] = None,
        certification__lte: Optional[str] = None,
        certification__gte: Optional[str] = None,
        include_adult: Optional[bool] = None,
        include_video: Optional[bool] = None,
        primary_release_year: Optional[int] = None,
        primary_release_date__gte: Optional[str] = None,
        primary_release_date__lte: Optional[str] = None,
        release_date__gte: Optional[str] = None,
        release_date__lte: Optional[str] = None,
        with_release_type: Optional[int] = None,
        year: Optional[int] = None,
        vote_count__gte: Optional[int] = None,
        vote_count__lte: Optional[int] = None,
        vote_average__gte: Optional[float] = None,
        vote_average__lte: Optional[float] = None,
        with_cast: Optional[str] = None,
        with_crew: Optional[str] = None,
        with_people: Optional[str] = None,
        with_companies: Optional[str] = None,
        with_genres: Optional[str] = None,
        without_genres: Optional[str] = None,
        with_keywords: Optional[str] = None,
        without_keywords: Optional[str] = None,
        with_runtime__gte: Optional[int] = None,
        with_runtime__lte: Optional[int] = None,
        with_original_language: Optional[str] = None,
        with_watch_providers: Optional[str] = None,
        watch_region: Optional[str] = None,
        with_watch_monetization_types: Optional[str] = None,
    ) -> schemas.Movies:
        """Discover movies by different types of data.

        See more: https://developers.themoviedb.org/3/discover/movie-discover
        """
        data = await self.request(
            "discover/movie",
            page=page,
            sort_by=sort_by,
            watch_region=watch_region,
            certification_country=certification_country,
            certification=certification,
            certification__lte=certification__lte,
            certification__gte=certification__gte,
            include_adult=include_adult,
            include_video=include_video,
            primary_release_year=primary_release_year,
            primary_release_date__gte=primary_release_date__gte,
            primary_release_date__lte=primary_release_date__lte,
            release_date__gte=release_date__gte,
            release_date__lte=release_date__lte,
            with_release_type=with_release_type,
            year=year,
            vote_count__gte=vote_count__gte,
            vote_count__lte=vote_count__lte,
            vote_average__gte=vote_average__gte,
            vote_average__lte=vote_average__lte,
            with_cast=with_cast,
            with_crew=with_crew,
            with_people=with_people,
            with_companies=with_companies,
            with_genres=with_genres,
            without_genres=without_genres,
            with_keywords=with_keywords,
            without_keywords=without_keywords,
            with_runtime__gte=with_runtime__gte,
            with_runtime__lte=with_runtime__lte,
            with_original_language=with_original_language,
            with_watch_providers=with_watch_providers,
            with_watch_monetization_types=with_watch_monetization_types,
        )
        return utils.as_dataclass(schemas.Movies, data)

    async def tv(
        self,
        *,
        page: int = 1,
        sort_by: str = "popularity.desc",
        air_date__gte: Optional[str] = None,
        air_date__lte: Optional[str] = None,
        first_air_date__gte: Optional[str] = None,
        first_air_date__lte: Optional[str] = None,
        first_air_date_year: Optional[int] = None,
        timezone: Optional[str] = None,
        vote_average__gte: Optional[float] = None,
        vote_count__gte: Optional[int] = None,
        with_genres: Optional[str] = None,
        with_networks: Optional[str] = None,
        without_genres: Optional[str] = None,
        with_runtime__gte: Optional[int] = None,
        with_runtime__lte: Optional[int] = None,
        include_null_first_air_dates: Optional[bool] = None,
        with_original_language: Optional[str] = None,
        without_keywords: Optional[str] = None,
        screened_theatrically: Optional[bool] = None,
        with_companies: Optional[str] = None,
        with_keywords: Optional[str] = None,
        with_watch_providers: Optional[str] = None,
        watch_region: Optional[str] = None,
        with_watch_monetization_types: Optional[str] = None,
    ) -> schemas.TVs:
        """Discover TV shows by different types of data.

        See more: https://developers.themoviedb.org/3/discover/tv-discover
        """
        data = await self.request(
            "discover/tv",
            page=page,
            sort_by=sort_by,
            watch_region=watch_region,
            air_date__gte=air_date__gte,
            air_date__lte=air_date__lte,
            first_air_date__gte=first_air_date__gte,
            first_air_date__lte=first_air_date__lte,
            first_air_date_year=first_air_date_year,
            timezone=timezone,
            vote_average__gte=vote_average__gte,
            vote_count__gte=vote_count__gte,
            with_genres=with_genres,
            with_networks=with_networks,
            without_genres=without_genres,
            with_runtime__gte=with_runtime__gte,
            with_runtime__lte=with_runtime__lte,
            include_null_first_air_dates=include_null_first_air_dates,
            with_original_language=with_original_language,
            without_keywords=without_keywords,
            screened_theatrically=screened_theatrically,
            with_companies=with_companies,
            with_keywords=with_keywords,
            with_watch_providers=with_watch_providers,
            with_watch_monetization_types=with_watch_monetization_types,
        )
        return utils.as_dataclass(schemas.TVs, data)
