public class Constants {
    public static final String[] MOVIE_COLUMNS = {

            MovieContract.Movies.TABLE_NAME + "." + MovieContract.Movies._ID,
            MovieContract.Movies.PAGE,
            MovieContract.Movies.POSTER_PATH,
            MovieContract.Movies.ADULT,
            MovieContract.Movies.OVERVIEW,
            MovieContract.Movies.RELEASE_DATE,
            MovieContract.Movies.MOVIE_ID,
            MovieContract.Movies.ORIGINAL_TITLE,
            MovieContract.Movies.ORIGINAL_LANGUAGE,
            MovieContract.Movies.TITLE,
            MovieContract.Movies.BACKDROP_PATH,
            MovieContract.Movies.POPULARITY,
            MovieContract.Movies.VOTE_COUNT,
            MovieContract.Movies.VOTE_AVERAGE,
            MovieContract.Movies.FAVOURED,
            MovieContract.Movies.SHOWED,
            MovieContract.Movies.DOWNLOADED,
            MovieContract.Movies.MODE
    };

    public static final String[] MOVIE_COLUMNS_MIN = {
            MovieContract.Movies.TABLE_NAME + "." + MovieContract.Movies._ID
    };


    public static final String[] MOVIE_DETAILS_COLUMNS_MIN = {
            MovieContract.MovieDetails.TABLE_NAME + "." + MovieContract.MovieDetails._ID,
            MovieContract.MovieDetails.MOVIE_ID
    };

    public static final String[] TV_DETAILS_COLUMNS_MIN = {
            MovieContract.TVDetails.TABLE_NAME + "." + MovieContract.TVDetails._ID,
            MovieContract.TVDetails.TV_ID
    };

    public static final String[] PEOPLE_DETAILS_COLUMNS_MIN = {
            MovieContract.People.TABLE_NAME + "." + MovieContract.People._ID,
            MovieContract.People.ID
    };


    public static final String[] CREATOR_COLUMNS = {
            MovieContract.TVCreator.TABLE_NAME + "." + MovieContract.TVCreator._ID,
            MovieContract.TVCreator.TV_ID,
            MovieContract.TVCreator.ID,
            MovieContract.TVCreator.NAME,
            MovieContract.TVCreator.PROFILE_PATH
    };

    public static final String[] TV_SEASONS_COLUMNS = {
            MovieContract.TVSeasons.TABLE_NAME + "." + MovieContract.TVSeasons._ID,
            MovieContract.TVSeasons.ID,
            MovieContract.TVSeasons.EPISODE_COUNT,
            MovieContract.TVSeasons.TV_ID,
            MovieContract.TVSeasons.SEASON_NUMBER,
            MovieContract.TVSeasons.POSTER_PATH
    };
    public static final String[] MOVIE_DETAILS_COLUMNS = {

            MovieContract.MovieDetails.TABLE_NAME + "." + MovieContract.MovieDetails._ID,
            MovieContract.MovieDetails.MOVIE_ID,
            MovieContract.MovieDetails.ADULT,
            MovieContract.MovieDetails.BACKDROP_PATH,
            MovieContract.MovieDetails.BUDGET,
            MovieContract.MovieDetails.HOMEPAGE,
            MovieContract.MovieDetails.ORIGINAL_LANGUAGE,
            MovieContract.MovieDetails.ORIGINAL_TITLE,
            MovieContract.MovieDetails.OVERVIEW,
            MovieContract.MovieDetails.POPULARITY,
            MovieContract.MovieDetails.POSTER_PATH,
            MovieContract.MovieDetails.RELEASE_DATE,
            MovieContract.MovieDetails.REVENUE,
            MovieContract.MovieDetails.RUNTIME,
            MovieContract.MovieDetails.STATUS,
            MovieContract.MovieDetails.TAGLINE,
            MovieContract.MovieDetails.TITLE,
            MovieContract.MovieDetails.VOTE_AVERAGE,
            MovieContract.MovieDetails.VOTE_COUNT,
            MovieContract.MovieDetails.FAVOURED,
            MovieContract.MovieDetails.SHOWED,
            MovieContract.MovieDetails.DOWNLOADED
    };
    public static final String[] CREW_COLUMNS = {

            MovieContract.Crew.TABLE_NAME + "." + MovieContract.Crew._ID,
            MovieContract.Crew.CREDIT_ID,
            MovieContract.Crew.DEPARTMENT,
            MovieContract.Crew.ID,
            MovieContract.Crew.JOB,
            MovieContract.Crew.NAME,
            MovieContract.Crew.PROFILE_PATH,
            MovieContract.Crew.MOVIE_ID
    };
    public static final String[] CAST_COLUMNS = {

            MovieContract.Cast._ID,
            MovieContract.Cast.CAST_ID,
            MovieContract.Cast.CHARACTER,
            MovieContract.Cast.CREDIT_ID,
            MovieContract.Cast.ID,
            MovieContract.Cast.NAME,
            MovieContract.Cast.ORDER,
            MovieContract.Cast.PROFILE_PATH,
            MovieContract.Cast.MOVIE_ID
    };
    public static final String[] TVCAST_COLUMNS = {

            MovieContract.TVCast._ID,
            MovieContract.TVCast.CHARACTER,
            MovieContract.TVCast.CREDIT_ID,
            MovieContract.TVCast.ID,
            MovieContract.TVCast.NAME,
            MovieContract.TVCast.ORDER,
            MovieContract.TVCast.PROFILE_PATH,
            MovieContract.TVCast.TV_ID
    };
    public static final String[] SIMILAR_MOVIE_COLUMNS = {

            MovieContract.SimilarMovies.TABLE_NAME + "." + MovieContract.SimilarMovies._ID,
            MovieContract.SimilarMovies.MOVIE_ID_OLD,
            MovieContract.SimilarMovies.PAGE,
            MovieContract.SimilarMovies.POSTER_PATH,
            MovieContract.SimilarMovies.ADULT,
            MovieContract.SimilarMovies.OVERVIEW,
            MovieContract.SimilarMovies.RELEASE_DATE,
            MovieContract.SimilarMovies.MOVIE_ID,
            MovieContract.SimilarMovies.ORIGINAL_TITLE,
            MovieContract.SimilarMovies.ORIGINAL_LANGUAGE,
            MovieContract.SimilarMovies.TITLE,
            MovieContract.SimilarMovies.BACKDROP_PATH,
            MovieContract.SimilarMovies.POPULARITY,
            MovieContract.SimilarMovies.VOTE_COUNT,
            MovieContract.SimilarMovies.VOTE_AVERAGE,
            MovieContract.SimilarMovies.FAVOURED,
            MovieContract.SimilarMovies.SHOWED,
            MovieContract.SimilarMovies.DOWNLOADED,
    };
    public static final String[] TV_SIMILAR_MOVIE_COLUMNS = {

            MovieContract.TVSimilar.TABLE_NAME + "." + MovieContract.TVSimilar._ID,
            MovieContract.TVSimilar.POSTER_PATH,
            MovieContract.TVSimilar.TV_ID,
            MovieContract.TVSimilar.ORIGINAL_NAME,
    };
    public static final String[] TV_COLUMNS_MIN = {
            MovieContract.TV.TABLE_NAME + "." + MovieContract.TV._ID
    };
    public static final String[] TV_COLUMNS = {

            MovieContract.TV.TABLE_NAME + "." + MovieContract.TV._ID,
            MovieContract.TV.PAGE,
            MovieContract.TV.POSTER_PATH,
            MovieContract.TV.OVERVIEW,
            MovieContract.TV.FIRST_AIR_DATE,
            MovieContract.TV.TV_ID,
            MovieContract.TV.ORIGINAL_NAME,
            MovieContract.TV.ORIGINAL_LANGUAGE,
            MovieContract.TV.NAME,
            MovieContract.TV.BACKDROP_PATH,
            MovieContract.TV.POPULARITY,
            MovieContract.TV.VOTE_COUNT,
            MovieContract.TV.VOTE_AVERAGE,
            MovieContract.TV.FAVOURED,
            MovieContract.TV.SHOWED,
            MovieContract.TV.DOWNLOADED,
            MovieContract.TV.MODE
    };
    public static final String[] TV_DETAILS_COLUMNS = {

            TVDetails.TABLE_NAME + "." + TVDetails._ID,
            TVDetails.TV_ID,
            TVDetails.BACKDROP_PATH,
            TVDetails.FIRST_AIR_DATE,
            TVDetails.HOMEPAGE,
            TVDetails.IN_PRODUCTION,
            TVDetails.LAST_AIR_DATE,
            TVDetails.NAME,
            TVDetails.NUMBER_OF_EPISODES,
            TVDetails.NUMBER_OF_SEASONS,
            TVDetails.ORIGINAL_LANG,
            TVDetails.ORIGINAL_NAME,
            TVDetails.OVERVIEW,
            TVDetails.POPULARITY,
            TVDetails.POSTER_PATH,
            TVDetails.STATUS,
            TVDetails.TYPE,
            TVDetails.VOTE_AVERAGE,
            TVDetails.VOTE_COUNT,
            TVDetails.FAVOURED
    };
    public static final String[] VIDEO_COLUMNS = {

            MovieContract.Videos.TABLE_NAME + "." + MovieContract.Videos._ID,
            MovieContract.Videos.TABLE_NAME + "." + MovieContract.Videos.VIDEO_ID,
            MovieContract.Videos.TABLE_NAME + "." + MovieContract.Videos.KEY,
            MovieContract.Videos.TABLE_NAME + "." + MovieContract.Videos.NAME,
            MovieContract.Videos.TABLE_NAME + "." + MovieContract.Videos.SITE,
            MovieContract.Videos.TABLE_NAME + "." + MovieContract.Videos.SIZE,
            MovieContract.Videos.TABLE_NAME + "." + MovieContract.Videos.TYPE,
            MovieContract.Videos.TABLE_NAME + "." + MovieContract.Videos.MOVIE_ID,
    };
    public static final String[] TV_VIDEO_COLUMNS = {

            MovieContract.TVVideos.TABLE_NAME + "." + MovieContract.TVVideos._ID,
            MovieContract.TVVideos.TABLE_NAME + "." + MovieContract.TVVideos.VIDEO_ID,
            MovieContract.TVVideos.TABLE_NAME + "." + MovieContract.TVVideos.KEY,
            MovieContract.TVVideos.TABLE_NAME + "." + MovieContract.TVVideos.NAME,
            MovieContract.TVVideos.TABLE_NAME + "." + MovieContract.TVVideos.SITE,
            MovieContract.TVVideos.TABLE_NAME + "." + MovieContract.TVVideos.SIZE,
            MovieContract.TVVideos.TABLE_NAME + "." + MovieContract.TVVideos.TYPE,
            MovieContract.TVVideos.TABLE_NAME + "." + MovieContract.TVVideos.TV_ID,
    };
    public static final String[] REVIEW_COLUMNS = {

            MovieContract.Reviews.TABLE_NAME + "." + MovieContract.Reviews._ID,
            MovieContract.Reviews.TABLE_NAME + "." + MovieContract.Reviews.PAGE,
            MovieContract.Reviews.TABLE_NAME + "." + MovieContract.Reviews.TOTAL_PAGE,
            MovieContract.Reviews.TABLE_NAME + "." + MovieContract.Reviews.TOTAL_RESULTS,
            MovieContract.Reviews.TABLE_NAME + "." + MovieContract.Reviews.ID_REVIEWS,
            MovieContract.Reviews.TABLE_NAME + "." + MovieContract.Reviews.AUTHOR,
            MovieContract.Reviews.TABLE_NAME + "." + MovieContract.Reviews.CONTENT,
            MovieContract.Reviews.TABLE_NAME + "." + MovieContract.Reviews.URL,
            MovieContract.Reviews.TABLE_NAME + "." + MovieContract.Reviews.MOVIE_ID

    };
    public static final String[] GENRE_COLUMNS = {

            MovieContract.Genres.TABLE_NAME + "." + MovieContract.Genres._ID,
            MovieContract.Genres.TABLE_NAME + "." + MovieContract.Genres.NAME,
            MovieContract.Genres.TABLE_NAME + "." + MovieContract.Genres.ID_GENRES,
            MovieContract.Genres.TABLE_NAME + "." + MovieContract.Genres.MOVIE_ID
    };
    public static final String[] TV_GENRE_COLUMNS = {

            MovieContract.TVGenres.TABLE_NAME + "." + MovieContract.TVGenres._ID,
            MovieContract.TVGenres.TABLE_NAME + "." + MovieContract.TVGenres.NAME,
            MovieContract.TVGenres.TABLE_NAME + "." + MovieContract.TVGenres.ID_GENRES,
            MovieContract.TVGenres.TABLE_NAME + "." + MovieContract.TVGenres.TV_ID
    };
    public static final String[] PEOPLE_COLUMNS = {

            MovieContract.People.TABLE_NAME + "." + MovieContract.People._ID,
            MovieContract.People.ADULT,
            MovieContract.People.BIOGRAPHY,
            MovieContract.People.BIRTHDAY,
            MovieContract.People.DEATHDAY,
            MovieContract.People.GENDER,
            MovieContract.People.HOMEPAGE,
            MovieContract.People.ID,
            MovieContract.People.NAME,
            MovieContract.People.PLACE_OF_BIRTH,
            MovieContract.People.POPULARITY,
            MovieContract.People.PROFILE_PATH
    };
    public static final String[] FAVOURITE_MOVIE_COLUMNS = {

            MovieContract.FavouritesMovies.TABLE_NAME + "." + MovieContract.FavouritesMovies._ID,
            MovieContract.FavouritesMovies.MOVIE_ID
    };
    public static final String[] FAVOURITE_TV_COLUMNS = {

            MovieContract.FavouritesTVs.TABLE_NAME + "." + MovieContract.FavouritesTVs._ID,
            MovieContract.FavouritesTVs.TV_ID
    };
    public static final String[] TV_NETWORKS_COLUMNS = {

            MovieContract.TVNetworks.TABLE_NAME + "." + MovieContract.TVNetworks._ID,
            MovieContract.TVNetworks.ID,
            MovieContract.TVNetworks.NAME,
            MovieContract.TVNetworks.TV_ID
    };
    public static final String[] TV_RUNTIME_EPISODES_COLUMNS = {

            MovieContract.TVEpisodeRuntime.TABLE_NAME + "." + MovieContract.TVEpisodeRuntime._ID,
            MovieContract.TVEpisodeRuntime.TV_ID,
            MovieContract.TVEpisodeRuntime.TIME
    };

    public static final String[] TV_SEASON_DETAILS_COLUMNS = {

            MovieContract.TVSeasonDetails.TABLE_NAME + "." + MovieContract.TVSeasonDetails._ID,
            MovieContract.TVSeasonDetails.SEASON_ID,
            MovieContract.TVSeasonDetails.AIR_DATE,
            MovieContract.TVSeasonDetails.NAME,
            MovieContract.TVSeasonDetails.OVERVIEW,
            MovieContract.TVSeasonDetails.SEASON__ID,
            MovieContract.TVSeasonDetails.POSTER_PATH,
            MovieContract.TVSeasonDetails.SEASON_NUMBER,
    };
    public static final String[] TV_EPISODE_COLUMNS = {

            MovieContract.TVEpisode.TABLE_NAME + "." + MovieContract.TVEpisode._ID,
            MovieContract.TVEpisode.SEASON_ID,
            MovieContract.TVEpisode.AIR_DATE,
            MovieContract.TVEpisode.EPISODE_NUMBER,
            MovieContract.TVEpisode.NAME,
            MovieContract.TVEpisode.OVERVIEW,
            MovieContract.TVEpisode.ID,
            MovieContract.TVEpisode.PRODUCTION_CODE,
            MovieContract.TVEpisode.SEASON_NUMBER,
            MovieContract.TVEpisode.STILL_PATH,
            MovieContract.TVEpisode.VOTE_AVERAGE,
            MovieContract.TVEpisode.VOTE_COUNT,
    };
    public static final String[] TV_EPISODE_CREW_COLUMNS = {

            MovieContract.TVEpisodeCrew.TABLE_NAME + "." + MovieContract.TVEpisodeCrew._ID,
            MovieContract.TVEpisodeCrew.EPISODE_ID,
            MovieContract.TVEpisodeCrew.ID,
            MovieContract.TVEpisodeCrew.CREDIT_ID,
            MovieContract.TVEpisodeCrew.NAME,
            MovieContract.TVEpisodeCrew.DEPARTMENT,
            MovieContract.TVEpisodeCrew.JOB,
            MovieContract.TVEpisodeCrew.PROFILE_PATH
    };
    public static final String[] TV_EPISODE_GUEST_COLUMNS = {

            MovieContract.TVEpisodeGuestStar.TABLE_NAME + "." + MovieContract.TVEpisodeGuestStar._ID,
            MovieContract.TVEpisodeGuestStar.EPISODE_ID,
            MovieContract.TVEpisodeGuestStar.ID,
            MovieContract.TVEpisodeGuestStar.NAME,
            MovieContract.TVEpisodeGuestStar.CREDIT_ID,
            MovieContract.TVEpisodeGuestStar.CHARACTER,
            MovieContract.TVEpisodeGuestStar.ORDER,
            MovieContract.TVEpisodeGuestStar.PROFILE_PATH
    };
    public static final int TV_EPISODE_COL_AIR_DATE = 2;
    public static final int TV_EPISODE_COL_EPISODE_NUMBER = 3;
    public static final int TV_EPISODE_COL_NAME = 4;
    public static final int TV_EPISODE_COL_OVERVIEW = 5;
    public static final int TV_EPISODE_COL_ID = 6;
    public static final int TV_EPISODE_COL_STILL_PATH = 9;
    public static final int TV_EPISODE_COL_VOTE_AVERAGE = 10;
    public static final int TV_SEASON_DETAILS_COL_AIR_DATE = 2;
    public static final int TV_SEASON_DETAILS_COL_NAME = 3;
    public static final int TV_SEASON_DETAILS_COL_OVERVIEW = 4;
    public static final int TV_SEASON_DETAILS_COL_POSTER_PATH = 6;
    public static final int TV_EPISODE_CREW_COL_ID = 2;
    public static final int TV_EPISODE_CREW_COL_NAME = 4;
    public static final int TV_EPISODE_CREW_COL_PROFILE_PATH = 7;
    public static final int TV_EPISODE_GUEST_COL_ID = 2;
    public static final int TV_EPISODE_GUEST_COL_NAME = 3;
    public static final int TV_EPISODE_GUEST_COL_CHARACTER = 5;
    public static final int TV_EPISODE_GUEST_COL_PROFILE_PATH = 7;
    public static final int TV_SEASON_COL_ID = 1;
    public static final int TV_SEASON_COL_EPISODE_COUNT = 2;
    public static final int TV_SEASON_COL_TV_ID = 3;
    public static final int TV_SEASON_COL_SEASON_NUMBER = 4;
    public static final int TV_SEASON_COL_POSTER_PATH = 5;
    public static final int CREATOR_COL_ID = 2;
    public static final int CREATOR_COL_NAME = 3;
    public static final int TV_CAST_COL_CHARACTER = 1;
    public static final int TV_CAST_COL_ID = 3;
    public static final int TV_CAST_COL_NAME = 4;
    public static final int TV_CAST_COL_PROFILE_PATH = 6;
    public static final int TV_SIMILAR_COL_POSTER_PATH = 1;
    public static final int TV_SIMILAR_COL_TV_ID = 2;
    public static final int TV_SIMILAR_COL_ORIGINAL_NAME = 3;
    public static final int TV_DETAILS_COL_TV_ID = 1;
    public static final int TV_DETAILS_COL_BACKDROP_PATH = 2;
    public static final int TV_DETAILS_COL_FIRST_AIR_DATE = 3;
    public static final int TV_DETAILS_COL_HOMEPAGE = 4;
    public static final int TV_DETAILS_COL_LAST_AIR_DATE = 6;
    public static final int TV_DETAILS_COL_ORIGINAL_LANG = 10;
    public static final int TV_DETAILS_COL_ORIGINAL_NAME = 11;
    public static final int TV_DETAILS_COL_OVERVIEW = 12;
    public static final int TV_DETAILS_COL_POPULARITY = 13;
    public static final int TV_DETAILS_COL_POSTER_PATH = 14;
    public static final int TV_DETAILS_COL_STATUS = 15;
    public static final int TV_DETAILS_COL_VOTE_AVERAGE = 17;
    public static final int TV_RUNTIME_EPISODE_COL_TIME = 2;
    public static final int TV_NETWORKS_COL_NAME = 2;
    public static final int PEOPLE_COL_BIOGRAPHY = 2;
    public static final int PEOPLE_COL_BIRTHDAY = 3;
    public static final int PEOPLE_COL_HOMEPAGE = 6;
    public static final int PEOPLE_COL_NAME = 8;
    public static final int PEOPLE_COL_PLACE_OF_BIRTH = 9;
    public static final int PEOPLE_COL_PROFILE_PATH = 11;
    public static final int MOV_DETAILS_COL_MOVIE_ID = 1;
    public static final int MOV_DETAILS_COL_BUDGET = 4;
    public static final int MOV_DETAILS_COL_HOMEPAGE = 5;
    public static final int MOV_DETAILS_COL_ORIGINAL_LANGUAGE = 6;
    public static final int MOV_DETAILS_COL_ORIGINAL_TITLE = 7;
    public static final int MOV_DETAILS_COL_OVERVIEW = 8;
    public static final int MOV_DETAILS_COL_POPULARITY = 9;
    public static final int MOV_DETAILS_COL_POSTER_PATH = 10;
    public static final int MOV_DETAILS_COL_RELEASE_DATE = 11;
    public static final int MOV_DETAILS_COL_REVENUE = 12;
    public static final int MOV_DETAILS_COL_RUNTIME = 13;
    public static final int MOV_DETAILS_COL_STATUS = 14;
    public static final int MOV_DETAILS_COL_VOTE_AVERAGE = 17;
    public static final int CREW_COL_ID = 3;
    public static final int CREW_COL_JOB = 4;
    public static final int CREW_COL_NAME = 5;
    public static final int CAST_COL_CHARACTER = 2;
    public static final int CAST_COL_ID = 4;
    public static final int CAST_COL_NAME = 5;
    public static final int CAST_COL_PROFILE_PATH = 7;
    public static final int SIMILAR_MOV_COL_POSTER_PATH = 3;
    public static final int SIMILAR_MOV_COL_MOVIE_ID = 7;
    public static final int SIMILAR_MOV_COL_ORIGINAL_TITLE = 8;
    public static final int MOV_COL_POSTER_PATH = 2;
    public static final int MOV_COL_RELEASE_DATE = 5;
    public static final int MOV_COL_MOVIE_ID = 6;
    public static final int MOV_COL_BACKDROP_PATH = 10;
    public static final int MOV_COL_POPULARITY = 11;
    public static final int MOV_COL_VOTE_AVERAGE = 13;
    public static final int TV_COL_ID = 0;
    public static final int TV_COL_POSTER_PATH = 2;
    public static final int TV_COL_FIRST_AIR_DATE = 4;
    public static final int TV_COL_TV_ID = 5;
    public static final int TV_COL_POPULARITY = 10;
    public static final int TV_COL_VOTE_AVERAGE = 12;
    public static final int COL_VIDEOS_KEY = 2;
    public static final int COL_VIDEOS_NAME = 3;
    public static final int COL_VIDEOS_TV_KEY = 2;
    public static final int COL_REVIEW_AUTHOR = 5;
    public static final int COL_REVIEW_CONTENT = 6;
    public static final int COL_REVIEW_URL = 7;
    public static final int COL_GENRE_NAME = 1;
    public static int TV_EPISODE_COL__ID = 0;
    public static int TV_EPISODE_COL_SEASON_ID = 1;
    public static int TV_EPISODE_COL_PRODUCTION_CODE = 7;
    public static int TV_EPISODE_COL_SEASON_NUMBER = 8;
    public static int TV_EPISODE_COL_VOTE_COUNT = 11;
    public static int TV_SEASON_DETAILS_COL__ID = 0;
    public static int TV_SEASON_DETAILS_COL_SEASON_ID = 1;
    public static int TV_SEASON_DETAILS_COL_SEASON__ID = 5;
    public static int TV_SEASON_DETAILS_COL_SEASON_NUMBER = 7;
    public static int TV_EPISODE_CREW_COL__ID = 0;
    public static int TV_EPISODE_CREW_COL_EPISODE_ID = 1;
    public static int TV_EPISODE_CREW_COL_CREDIT_ID = 3;
    public static int TV_EPISODE_CREW_COL_DEPARTMENT = 5;
    public static int TV_EPISODE_CREW_COL_JOB = 6;
    public static int TV_EPISODE_GUEST_COL__ID = 0;
    public static int TV_EPISODE_GUEST_COL_EPISODE_ID = 1;
    public static int TV_EPISODE_GUEST_COL_CREDIT_ID = 4;
    public static int TV_EPISODE_GUEST_COL_ORDER = 6;
    public static int TV_SEASON_COL__ID = 0;
    public static int CREATOR_COL__ID = 0;
    public static int CREATOR_COL_TV_ID = 1;
    public static int CREATOR_COL_PROFILE_PATH = 4;
    public static int TV_CAST_COL__ID = 0;
    public static int TV_CAST_COL_CREDIT_ID = 2;
    public static int TV_CAST_COL_ORDER = 5;
    public static int TV_CAST_COL_MOVIE_ID = 7;
    public static int TV_SIMILAR_COL_ID = 0;
    public static int TV_DETAILS_COL_ID = 0;
    public static int TV_DETAILS_COL_IN_PRODUCTION = 5;
    public static int TV_DETAILS_COL_NAME = 7;
    public static int TV_DETAILS_COL_NUMBER_OF_EPISODES = 8;
    public static int TV_DETAILS_COL_NUMBER_OF_SEASONS = 9;
    public static int TV_DETAILS_COL_TYPE = 16;
    public static int TV_DETAILS_COL_VOTE_COUNT = 18;
    public static int TV_DETAILS_COL_FAVOURED = 19;
    public static int TV_RUNTIME_EPISODE_COL__ID = 0;
    public static int TV_RUNTIME_EPISODE_COL_TV_ID = 1;
    public static int TV_NETWORKS_COL__ID = 0;
    public static int TV_NETWORKS_COL_ID = 1;
    public static int TV_NETWORKS_COL_TV_ID = 3;
    public static int FAV_MOV_COL_ID = 0;
    public static int FAV_MOV_COL_MOVIE_ID = 1;
    public static int FAV_TV_COL_ID = 0;
    public static int FAV_TV_COL_MOVIE_ID = 1;
    public static int PEOPLE_COL__ID = 0;
    public static int PEOPLE_COL_ADULT = 1;
    public static int PEOPLE_COL_DEATHDAY = 4;
    public static int PEOPLE_COL_GENDER = 5;
    public static int PEOPLE_COL_ID = 7;
    public static int PEOPLE_COL_POPULARITY = 10;
    public static int MOV_DETAILS_COL_ID = 0;
    public static int MOV_DETAILS_COL_ADULT = 2;
    public static int MOV_DETAILS_COL_BACKDROP_PATH = 3;
    public static int MOV_DETAILS_COL_TAGLINE = 15;
    public static int MOV_DETAILS_COL_TITLE = 16;
    public static int MOV_DETAILS_COL_VOTE_COUNT = 18;
    public static int MOV_DETAILS_COL_FAVOURED = 19;
    public static int MOV_DETAILS_COL_SHOWED = 20;
    public static int MOV_DETAILS_COL_DOWNLOADED = 21;
    public static int CREW_COL__ID = 0;
    public static int CREW_COL_CREDIT_ID = 1;
    public static int CREW_COL_DEPARTMENT = 2;
    public static int CREW_COL_PROFILE_PATH = 6;
    public static int CREW_COL_MOVIE_ID = 7;
    public static int CAST_COL__ID = 0;
    public static int CAST_COL_CAST_ID = 1;
    public static int CAST_COL_CREDIT_ID = 3;
    public static int CAST_COL_ORDER = 6;
    public static int CAST_COL_MOVIE_ID = 8;
    public static int SIMILAR_MOV_COL_ID = 0;
    public static int SIMILAR_MOV_COL_MOVIE_ID_OLD = 1;
    public static int SIMILAR_MOV_COL_PAGE = 2;
    public static int SIMILAR_MOV_COL_ADULT = 4;
    public static int SIMILAR_MOV_COL_OVERVIEW = 5;
    public static int SIMILAR_MOV_COL_RELEASE_DATE = 6;
    public static int SIMILAR_MOV_COL_ORIGINAL_LANG = 9;
    public static int SIMILAR_MOV_COL_TITLE = 10;
    public static int SIMILAR_MOV_COL_BACKDROP_PATH = 11;
    public static int SIMILAR_MOV_COL_POPULARITY = 12;
    public static int SIMILAR_MOV_COL_VOTE_COUNT = 13;
    public static int SIMILAR_MOV_COL_VOTE_AVERAGE = 14;
    public static int SIMILAR_MOV_COL_FAVOURED = 15;
    public static int SIMILAR_MOV_COL_SHOWED = 16;
    public static int SIMILAR_MOV_COL_DOWNLOADED = 17;
    public static int MOV_COL_ID = 0;
    public static int MOV_COL_PAGE = 1;
    public static int MOV_COL_ADULT = 3;
    public static int MOV_COL_OVERVIEW = 4;
    public static int MOV_COL_ORIGINAL_TITLE = 7;
    public static int MOV_COL_ORIGINAL_LANG = 8;
    public static int MOV_COL_TITLE = 9;
    public static int MOV_COL_VOTE_COUNT = 12;
    public static int MOV_COL_FAVOURED = 14;
    public static int MOV_COL_SHOWED = 15;
    public static int MOV_COL_DOWNLOADED = 16;
    public static int MOV_COL_MODE = 17;
    public static int TV_COL_PAGE = 1;
    public static int TV_COL_OVERVIEW = 3;
    public static int TV_COL_ORIGINAL_NAME = 6;
    public static int TV_COL_ORIGINAL_LANG = 7;
    public static int TV_COL_NAME = 8;
    public static int TV_COL_BACKDROP_PATH = 9;
    public static int TV_COL_VOTE_COUNT = 11;
    public static int TV_COL_FAVOURED = 13;
    public static int TV_COL_SHOWED = 14;
    public static int TV_COL_DOWNLOADED = 15;
    public static int TV_COL_MODE = 16;
    public static int COL_VIDEOS_ID = 0;
    public static int COL_VIDEOS_VIDEO_ID = 1;
    public static int COL_VIDEOS_SITE = 4;
    public static int COL_VIDEOS_SIZE = 5;
    public static int COL_VIDEOS_TYPE = 6;
    public static int COL_VIDEOS_MOVIE_ID = 7;
    public static int COL_VIDEOS_TV_VIDEO_ID = 1;
    public static int COL_VIDEOS_TV_NAME = 3;
    public static int COL_VIDEOS_TV_SITE = 4;
    public static int COL_VIDEOS_TV_SIZE = 5;
    public static int COL_VIDEOS_TV_TYPE = 6;
    public static int COL_VIDEOS_TV_ID = 7;
    public static int COL_REVIEW_ID = 0;
    public static int COL_REVIEW_PAGE = 1;
    public static int COL_REVIEW_TOTAL_PAGE = 2;
    public static int COL_REVIEW_TOTAL_RESULTS = 3;
    public static int COL_REVIEW_ID_REVIEWS = 4;
    public static int COL_REVIEW_MOVIE_ID = 8;
    public static int COL_GENRE_ID = 0;
    public static int COL_GENRE_ID_GENRE = 3;
    public static int COL_GENRE_MOVIE_ID = 4;
    public static int COL_GENRE_TV_ID = 4;


} public class EpisodesTVArrayAdapter extends
        RecyclerView.Adapter<EpisodesTVArrayAdapter.ViewHolder> {
    private static final String LOG_TAG = EpisodesTVArrayAdapter.class.getSimpleName();

    private final Cursor cursor;
    private Context context;
    private ViewHolderUtil.SetOnClickListener listener;

    public EpisodesTVArrayAdapter(Cursor cursor) {
        this.cursor = cursor;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        context = parent.getContext();
        LayoutInflater inflater = LayoutInflater.from(context);

        View view = inflater.inflate(R.layout.list_item_tv_seasons, parent, false);

        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(final ViewHolder viewHolder, int position) {
        cursor.moveToPosition(position);

        final String POSTER_BASE_URL = "http://image.tmdb.org/t/p/w185";
        final String url = POSTER_BASE_URL + cursor.getString(Constants.TV_EPISODE_COL_STILL_PATH);
        Picasso
                .with(context)
                .load(url)
                .networkPolicy(NetworkPolicy.OFFLINE)
                .transform(new RoundedTransformation(10, 10))
                .fit()
                .centerCrop()
                .into(viewHolder.imageView, new Callback() {
                    @Override
                    public void onSuccess() {
                    }

                    @Override
                    public void onError() {
                        Picasso
                                .with(context)
                                .load(url)
                                .error(R.mipmap.ic_launcher)
                                .fit()
                                .centerCrop()
                                .into(viewHolder.imageView, new Callback() {
                                    @Override
                                    public void onSuccess() {
                                    }

                                    @Override
                                    public void onError() {
                                    }
                                });
                    }
                });
        viewHolder.imageView.setAdjustViewBounds(true);
        viewHolder.name.setText(String.format(Locale.ENGLISH, "%s", cursor.getString(Constants.TV_EPISODE_COL_NAME)));
        viewHolder.count.setText(String.format(Locale.ENGLISH, "%d.", cursor.getInt(Constants.TV_EPISODE_COL_EPISODE_NUMBER)));
        viewHolder.setItemClickListener(listener);
    }

    @Override
    public int getItemCount() {
        if (cursor != null) {
            return cursor.getCount();
        }
        return 0;
    }

    public Cursor getCursor() {
        return cursor;
    }

    public void setOnClickListener(ViewHolderUtil.SetOnClickListener clickListener) {
        this.listener = clickListener;
    }

    public interface SetOnClickListener extends ViewHolderUtil.SetOnClickListener {
        void onItemClick(int position);
    }

    static class ViewHolder extends RecyclerView.ViewHolder {

        final ImageView imageView;
        final TextView name;
        final TextView count;
        private ViewHolderUtil.SetOnClickListener listener;

        ViewHolder(final View view) {
            super(view);
            imageView = (ImageView) view.findViewById(R.id.similar_movie_poster);
            name = (TextView) view.findViewById(R.id.name);
            count = (TextView) view.findViewById(R.id.season_count);
            view.setClickable(true);
            view.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (listener != null) {
                        listener.onItemClick(getAdapterPosition());
                    }
                }
            });
        }

        void setItemClickListener(ViewHolderUtil.SetOnClickListener itemClickListener) {
            this.listener = itemClickListener;
        }

    }
} public class FetchSeasonDetail extends AsyncTask<String, Void, Void> {

    private final String LOG_TAG = FetchSeasonDetail.class.getSimpleName();

    private final Context mContext;
    public AsyncResponse response = null;

    public FetchSeasonDetail(Context context) {
        mContext = context;
    }

    /**
     * Take the String representing the complete tv list in JSON Format and
     * pull out the data we need to construct the Strings needed for the wireframes.
     * <p>
     * Fortunately parsing is easy:  constructor takes the JSON string and converts it
     * into an Object hierarchy for us.
     */
    private void gettvDataFromJson(String tvJsonStr)
            throws JSONException {

        // These are the names of the JSON objects that need to be extracted.
        final String RESULT1 = "episodes";

        try {
            JSONObject tvJson = new JSONObject(tvJsonStr);
            JSONArray tvArrayEpisodes = tvJson.getJSONArray(RESULT1);

            String season_id = tvJson.getString("id");

            Vector<ContentValues> cVVectorEpisode = new Vector<ContentValues>(tvArrayEpisodes.length());

            for (int i = 0; i < tvArrayEpisodes.length(); i++) {

                JSONObject episode = tvArrayEpisodes.getJSONObject(i);
                JSONArray tvArrayEpisodeCrew = episode.getJSONArray("crew");
                JSONArray tvArrayEpisodeGuestStars = episode.getJSONArray("guest_stars");


                String air_date = episode.getString(TVEpisode.AIR_DATE);
                String episode_number = episode.getString(TVEpisode.EPISODE_NUMBER);
                String episode_name = episode.getString(TVEpisode.NAME);
                String overview = episode.getString(TVEpisode.AIR_DATE);
                String id = episode.getString(TVEpisode.ID);
                String production_code = episode.getString(TVEpisode.PRODUCTION_CODE);
                String season_number = episode.getString(TVEpisode.SEASON_NUMBER);
                String still_path = episode.getString(TVEpisode.STILL_PATH);
                String vote_average = episode.getString(TVEpisode.VOTE_AVERAGE);
                String vote_count = episode.getString(TVEpisode.VOTE_COUNT);

                Vector<ContentValues> cVVectorEpisodeCrew = new Vector<ContentValues>(tvArrayEpisodeCrew.length());

                for (int j = 0; j < tvArrayEpisodeCrew.length(); j++) {
                    JSONObject crew = tvArrayEpisodeCrew.getJSONObject(j);

                    String crew_id = crew.getString("id");
                    String credit_id = crew.getString(TVEpisodeCrew.CREDIT_ID);
                    String name = crew.getString(TVEpisodeCrew.NAME);
                    String department = crew.getString(TVEpisodeCrew.DEPARTMENT);
                    String job = crew.getString(TVEpisodeCrew.JOB);
                    String profile_path = crew.getString(TVEpisodeCrew.PROFILE_PATH);

                    ContentValues tvValues = new ContentValues();
                    tvValues.put(TVEpisodeCrew.EPISODE_ID, id);
                    tvValues.put(TVEpisodeCrew.ID, crew_id);
                    tvValues.put(TVEpisodeCrew.CREDIT_ID, credit_id);
                    tvValues.put(TVEpisodeCrew.NAME, name);
                    tvValues.put(TVEpisodeCrew.DEPARTMENT, department);
                    tvValues.put(TVEpisodeCrew.JOB, job);
                    tvValues.put(TVEpisodeCrew.PROFILE_PATH, profile_path);
                    cVVectorEpisodeCrew.add(tvValues);

                }
                // add to database
                if (cVVectorEpisodeCrew.size() > 0) {
                    ContentValues[] cvArray = new ContentValues[cVVectorEpisodeCrew.size()];
                    cVVectorEpisodeCrew.toArray(cvArray);
                    mContext.getContentResolver().bulkInsert(TVEpisodeCrew.CONTENT_URI, cvArray);
                }

                Vector<ContentValues> cVVectorEpisodeGuestStars = new Vector<ContentValues>(tvArrayEpisodeGuestStars.length());

                for (int j = 0; j < tvArrayEpisodeGuestStars.length(); j++) {
                    JSONObject guest = tvArrayEpisodeGuestStars.getJSONObject(j);

                    String guest_id = guest.getString("id");
                    String name = guest.getString(TVEpisodeGuestStar.NAME);
                    String credit_id = guest.getString(TVEpisodeGuestStar.CREDIT_ID);
                    String character = guest.getString(TVEpisodeGuestStar.CHARACTER);
                    String order = guest.getString("order");
                    String profile_path = guest.getString(TVEpisodeGuestStar.PROFILE_PATH);

                    ContentValues tvValues = new ContentValues();
                    tvValues.put(TVEpisodeGuestStar.EPISODE_ID, id);
                    tvValues.put(TVEpisodeGuestStar.ID, guest_id);
                    tvValues.put(TVEpisodeGuestStar.CREDIT_ID, credit_id);
                    tvValues.put(TVEpisodeGuestStar.NAME, name);
                    tvValues.put(TVEpisodeGuestStar.CHARACTER, character);
                    tvValues.put(TVEpisodeGuestStar.ORDER, order);
                    tvValues.put(TVEpisodeGuestStar.PROFILE_PATH, profile_path);
                    cVVectorEpisodeGuestStars.add(tvValues);

                }
                // add to database
                if (cVVectorEpisodeGuestStars.size() > 0) {
                    ContentValues[] cvArray = new ContentValues[cVVectorEpisodeGuestStars.size()];
                    cVVectorEpisodeGuestStars.toArray(cvArray);
                    mContext.getContentResolver().bulkInsert(TVEpisodeGuestStar.CONTENT_URI, cvArray);
                }

                ContentValues tvValues = new ContentValues();
                // Then add the data, along with the corresponding name of the data type,
                // so the content provider knows what kind of value is being inserted.

                tvValues.put(TVEpisode.SEASON_ID, season_id);
                tvValues.put(TVEpisode.AIR_DATE, air_date);
                tvValues.put(TVEpisode.EPISODE_NUMBER, episode_number);
                tvValues.put(TVEpisode.NAME, episode_name);
                tvValues.put(TVEpisode.OVERVIEW, overview);
                tvValues.put(TVEpisode.ID, id);
                tvValues.put(TVEpisode.PRODUCTION_CODE, production_code);
                tvValues.put(TVEpisode.SEASON_NUMBER, season_number);
                tvValues.put(TVEpisode.STILL_PATH, still_path);
                tvValues.put(TVEpisode.VOTE_AVERAGE, vote_average);
                tvValues.put(TVEpisode.VOTE_COUNT, vote_count);
                cVVectorEpisode.add(tvValues);

            }

            // add to database
            if (cVVectorEpisode.size() > 0) {
                ContentValues[] cvArray = new ContentValues[cVVectorEpisode.size()];
                cVVectorEpisode.toArray(cvArray);
                mContext.getContentResolver().bulkInsert(TVEpisode.CONTENT_URI, cvArray);
            }

            String _id = tvJson.getString("_id");
            String air_date = tvJson.getString(TVSeasonDetails.AIR_DATE);
            String name = tvJson.getString(TVSeasonDetails.NAME);
            String overview = tvJson.getString(TVSeasonDetails.OVERVIEW);
            String poster_path = tvJson.getString(TVSeasonDetails.POSTER_PATH);
            String season_number = tvJson.getString(TVSeasonDetails.SEASON_NUMBER);

            ContentValues[] cvArray = new ContentValues[1];

            ContentValues tvValues = new ContentValues();

            // Then add the data, along with the corresponding name of the data type,
            // so the content provider knows what kind of value is being inserted.

            tvValues.put(TVSeasonDetails.SEASON_ID, season_id);
            tvValues.put(TVSeasonDetails.AIR_DATE, air_date);
            tvValues.put(TVSeasonDetails.NAME, name);
            tvValues.put(TVSeasonDetails.OVERVIEW, overview);
            tvValues.put(TVSeasonDetails.SEASON__ID, _id);
            tvValues.put(TVSeasonDetails.POSTER_PATH, poster_path);
            tvValues.put(TVSeasonDetails.SEASON_NUMBER, season_number);
            cvArray[0] = tvValues;
            mContext.getContentResolver().bulkInsert(TVSeasonDetails.CONTENT_URI, cvArray);


        } catch (JSONException e) {
            //Log.e(LOG_TAG, e.getMessage(), e);
            e.printStackTrace();
        }
    }

    @Override
    protected Void doInBackground(String... params) {

        if (params.length == 0) {
            return null;
        }

        // These two need to be declared outside the try/catch
        // so that they can be closed in the finally block.
        HttpURLConnection urlConnection = null;
        BufferedReader reader = null;

        // Will contain the raw JSON response as a string.
        String tvJsonStr;

        try {
            // Construct the URL for the tvAPI query
            // Possible parameters are avaiable at OWM's forecast API page, at
            final String tv_BASE_URL =
                    "http://api.themoviedb.org/3/tv/";
            final String APPID_PARAM = "api_key";
            final String SEASON_PARAM = "season";

            Uri builtUri = Uri.parse(tv_BASE_URL).buildUpon()
                    .appendPath(params[0])
                    .appendPath(SEASON_PARAM)
                    .appendPath(params[1])
                    .appendQueryParameter(APPID_PARAM, BuildConfig.MOVIE_DB_API_KEY)
                    .build();

            URL url = new URL(builtUri.toString());

            urlConnection = (HttpURLConnection) url.openConnection();
            urlConnection.setRequestMethod("GET");
            urlConnection.connect();

            // Read the input stream into a String
            InputStream inputStream = urlConnection.getInputStream();
            StringBuilder buffer = new StringBuilder();
            if (inputStream == null) {
                // Nothing to do.
                return null;
            }
            reader = new BufferedReader(new InputStreamReader(inputStream));

            String line;
            while ((line = reader.readLine()) != null) {
                // Since it's JSON, adding a newline isn't necessary (it won't affect parsing)
                // But it does make debugging a *lot* easier if you print out the completed
                // buffer for debugging.
                buffer.append(line).append("\n");
            }

            if (buffer.length() == 0) {
                // Stream was empty.  No point in parsing.
                return null;
            }
            tvJsonStr = buffer.toString();
            gettvDataFromJson(tvJsonStr);
        } catch (IOException e) {
            //Log.e(LOG_TAG, "Error ", e);
            // If the code didn't successfully get the tv data, there's no point in attemping
            // to parse it.
            return null;
        } catch (JSONException e) {
            //Log.e(LOG_TAG, e.getMessage(), e);
            e.printStackTrace();
        } finally {
            if (urlConnection != null) {
                urlConnection.disconnect();
            }
            if (reader != null) {
                try {
                    reader.close();
                } catch (final IOException e) {
                    //Log.e(LOG_TAG, "Error closing stream", e);
                }
            }
        }
        // This will only happen if there was an error getting or parsing the forecast.
        return null;
    }

    @Override
    protected void onPostExecute(Void result) {
        super.onPostExecute(result);
        response.onFinish(true);
    }
} public class MovieContract {

    public static final String CONTENT_AUTHORITY = "work.technie.popularmovies";
    public static final String PATH_MOVIES = "movies";
    public static final String PATH_VIDEOS = "videos";
    public static final String PATH_SIMILAR_MOVIES = "similar_movies";
    public static final String PATH_CASTS = "casts";
    public static final String PATH_CREWS = "crews";
    public static final String PATH_REVIEWS = "reviews";
    public static final String PATH_GENRES = "genres";
    public static final String PATH_MOVIE_DETAILS = "movie_details";
    public static final String PATH_FAVOURITES_MOVIES = "favourites_movies";
    public static final String PATH_PEOPLE = "people";
    public static final String PATH_TV = "tv";
    public static final String PATH_TV_DETAILS = "tv_details";
    public static final String PATH_FAVOURITES_TV = "favourites_tv";
    public static final String PATH_TV_CREATOR = "tv_creator";
    public static final String PATH_TV_EPISODE_RUNTIME = "tv_episode_runtime";
    public static final String PATH_TV_GENRES = "tv_genres";
    public static final String PATH_TV_NETWORKS = "tv_networks";
    public static final String PATH_TV_SEASONS = "tv_seasons";
    public static final String PATH_TV_VIDEOS = "tv_videos";
    public static final String PATH_TV_CAST = "tv_cast";
    public static final String PATH_TV_SIMILAR = "tv_similar";
    public static final String PATH_TV_EPISODE_CREW = "tv_episode_crew";
    public static final String PATH_TV_EPISODE_GUEST_STAR = "tv_episode_guest_star";
    public static final String PATH_TV_EPISODE = "tv_episode";
    public static final String PATH_TV_SEASON_DETAILS = "tv_season_details";
    private static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);

    public static final class Movies implements BaseColumns {

        public static final String TABLE_NAME = "movies";

        public static final String PAGE = "page";
        public static final String POSTER_PATH = "poster_path";
        public static final String ADULT = "adult";
        public static final String OVERVIEW = "overview";
        public static final String RELEASE_DATE = "release_date";
        public static final String MOVIE_ID = "id";
        public static final String ORIGINAL_TITLE = "original_title";
        public static final String ORIGINAL_LANGUAGE = "original_language";
        public static final String TITLE = "title";
        public static final String BACKDROP_PATH = "backdrop_path";
        public static final String POPULARITY = "popularity";
        public static final String VOTE_COUNT = "vote_count";
        public static final String VOTE_AVERAGE = "vote_average";
        public static final String FAVOURED = "favoured";
        public static final String SHOWED = "shown";
        public static final String DOWNLOADED = "downloaded";
        public static final String MODE = "mode";
        public static final String PREF_LANGUAGE = "pref_lang";
        public static final String PREF_ADULT = "pref_adult";
        public static final String PREF_REGION = "pref_region";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_MOVIES).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_MOVIES;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_MOVIES;

        static Uri buildMoviesUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../movies/MovieId
        public static Uri buildMoviesUriWithMovieId(String MovieId) {
            return CONTENT_URI.buildUpon().appendPath(MovieId).build();
        }

        public static Uri buildMovieUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }


    }

    public static final class SimilarMovies implements BaseColumns {

        public static final String TABLE_NAME = "similar_movies";
        public static final String MOVIE_ID_OLD = "id_old";
        public static final String PAGE = "page";
        public static final String POSTER_PATH = "poster_path";
        public static final String ADULT = "adult";
        public static final String OVERVIEW = "overview";
        public static final String RELEASE_DATE = "release_date";
        public static final String MOVIE_ID = "id";
        public static final String ORIGINAL_TITLE = "original_title";
        public static final String ORIGINAL_LANGUAGE = "original_language";
        public static final String TITLE = "title";
        public static final String BACKDROP_PATH = "backdrop_path";
        public static final String POPULARITY = "popularity";
        public static final String VOTE_COUNT = "vote_count";
        public static final String VOTE_AVERAGE = "vote_average";
        public static final String FAVOURED = "favoured";
        public static final String SHOWED = "shown";
        public static final String DOWNLOADED = "downloaded";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_SIMILAR_MOVIES).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_SIMILAR_MOVIES;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_SIMILAR_MOVIES;

        static Uri buildSimilarMoviesUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../similar_movies/MovieId
        public static Uri buildSimilarMoviesUriWithMovieId(String MovieId) {
            return CONTENT_URI.buildUpon().appendPath(MovieId).build();
        }

        public static Uri buildSimilarMovieUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }


    }

    public static final class MovieDetails implements BaseColumns {

        public static final String TABLE_NAME = "movie_details";

        public static final String MOVIE_ID = "id";
        public static final String ADULT = "adult";
        public static final String BACKDROP_PATH = "backdrop_path";
        public static final String BUDGET = "budget";
        public static final String HOMEPAGE = "homepage";
        public static final String ORIGINAL_LANGUAGE = "original_language";
        public static final String ORIGINAL_TITLE = "original_title";
        public static final String OVERVIEW = "overview";
        public static final String POPULARITY = "popularity";
        public static final String POSTER_PATH = "poster_path";
        public static final String RELEASE_DATE = "release_date";
        public static final String REVENUE = "revenue";
        public static final String RUNTIME = "runtime";
        public static final String STATUS = "status";
        public static final String TAGLINE = "tagline";
        public static final String TITLE = "title";
        public static final String VOTE_AVERAGE = "vote_average";
        public static final String VOTE_COUNT = "vote_count";
        public static final String FAVOURED = "favoured";
        public static final String SHOWED = "shown";
        public static final String DOWNLOADED = "downloaded";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_MOVIE_DETAILS).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_MOVIE_DETAILS;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_MOVIE_DETAILS;

        static Uri buildMovieDetailsUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../movie_details/MovieId
        public static Uri buildMovieDetailsUriWithMovieId(String MovieId) {
            return CONTENT_URI.buildUpon().appendPath(MovieId).build();
        }

        public static Uri buildMovieDetailsUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class TVDetails implements BaseColumns {

        public static final String TABLE_NAME = "tv_details";

        public static final String TV_ID = "id";
        public static final String BACKDROP_PATH = "backdrop_path";
        public static final String FIRST_AIR_DATE = "first_air_date";
        public static final String HOMEPAGE = "homepage";
        public static final String IN_PRODUCTION = "in_production";
        public static final String LAST_AIR_DATE = "last_air_date";
        public static final String NAME = "name";
        public static final String NUMBER_OF_EPISODES = "number_of_episodes";
        public static final String NUMBER_OF_SEASONS = "number_of_seasons";
        public static final String ORIGINAL_LANG = "original_language";
        public static final String ORIGINAL_NAME = "original_name";
        public static final String OVERVIEW = "overview";
        public static final String POPULARITY = "popularity";
        public static final String POSTER_PATH = "poster_path";
        public static final String STATUS = "status";
        public static final String TYPE = "type";
        public static final String VOTE_AVERAGE = "vote_average";
        public static final String VOTE_COUNT = "vote_count";
        public static final String FAVOURED = "favoured";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV_DETAILS).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_DETAILS;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_DETAILS;

        static Uri buildTVDetailsUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../tv_details/tvId
        public static Uri buildTVDetailsUriWithTvId(String TVId) {
            return CONTENT_URI.buildUpon().appendPath(TVId).build();
        }

        public static Uri buildTVDetailsUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class TVSeasonDetails implements BaseColumns {

        public static final String TABLE_NAME = "tv_season_details";

        public static final String SEASON_ID = "season_id";
        public static final String AIR_DATE = "air_date";
        public static final String NAME = "name";
        public static final String OVERVIEW = "overview";
        public static final String SEASON__ID = "season__id";
        public static final String POSTER_PATH = "poster_path";
        public static final String SEASON_NUMBER = "season_number";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV_SEASON_DETAILS).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_SEASON_DETAILS;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_SEASON_DETAILS;

        static Uri buildTVSeasonDetailsUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../tv_season_details/seasonId
        public static Uri buildSeasonDetailsUriWithSeasonId(String seasonId) {
            return CONTENT_URI.buildUpon().appendPath(seasonId).build();
        }

        public static Uri buildSeasonDetailsUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class TVEpisode implements BaseColumns {

        public static final String TABLE_NAME = "tv_episode";

        public static final String SEASON_ID = "season_id";
        public static final String AIR_DATE = "air_date";
        public static final String EPISODE_NUMBER = "episode_number";
        public static final String NAME = "name";
        public static final String OVERVIEW = "overview";
        public static final String ID = "id";
        public static final String PRODUCTION_CODE = "production_code";
        public static final String SEASON_NUMBER = "season_number";
        public static final String STILL_PATH = "still_path";
        public static final String VOTE_AVERAGE = "vote_average";
        public static final String VOTE_COUNT = "vote_count";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV_EPISODE).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_EPISODE;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_EPISODE;

        static Uri buildTVEpisodeUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../tv_episode/episodeId
        public static Uri buildEpisodeUriWithEpisodeId(String seasonId) {
            return CONTENT_URI.buildUpon().appendPath(seasonId).build();
        }

        public static Uri buildEpisodeUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class TVEpisodeCrew implements BaseColumns {

        public static final String TABLE_NAME = "tv_episode_crew";

        public static final String EPISODE_ID = "episode_id";
        public static final String ID = "id";
        public static final String CREDIT_ID = "credit_id";
        public static final String NAME = "name";
        public static final String DEPARTMENT = "department";
        public static final String JOB = "job";
        public static final String PROFILE_PATH = "profile_path";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV_EPISODE_CREW).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_EPISODE_CREW;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_EPISODE_CREW;

        static Uri buildTVEpisodeCrewUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../tv_episode_crew/episodeId
        public static Uri buildEpisodeCrewUriWithEpisodeId(String episodeId) {
            return CONTENT_URI.buildUpon().appendPath(episodeId).build();
        }

        public static Uri buildEpisodeCrewUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }


    public static final class TVEpisodeGuestStar implements BaseColumns {

        public static final String TABLE_NAME = "tv_episode_guest_star";

        public static final String EPISODE_ID = "episode_id";
        public static final String ID = "id";
        public static final String NAME = "name";
        public static final String CREDIT_ID = "credit_id";
        public static final String CHARACTER = "character";
        public static final String ORDER = "order_guest";
        public static final String PROFILE_PATH = "profile_path";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV_EPISODE_GUEST_STAR).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_EPISODE_GUEST_STAR;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_EPISODE_GUEST_STAR;

        static Uri buildTVEpisodeGuestStarUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../tv_episode_guest_star/episodeId
        public static Uri buildEpisodeGuestStarUriWithEpisodeId(String episodeId) {
            return CONTENT_URI.buildUpon().appendPath(episodeId).build();
        }

        public static Uri buildEpisodeGuestStarUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class TVCreator implements BaseColumns {

        public static final String TABLE_NAME = "tv_creator";

        public static final String TV_ID = "tv_id";
        public static final String ID = "id";
        public static final String NAME = "name";
        public static final String PROFILE_PATH = "profile_path";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV_CREATOR).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_CREATOR;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_CREATOR;

        static Uri buildTVCreatorUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../tv_creator/tv_id
        public static Uri buildTVCreatorUriWithTVId(String id) {
            return CONTENT_URI.buildUpon().appendPath(id).build();
        }

        public static Uri buildTVCreatorUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class TVEpisodeRuntime implements BaseColumns {

        public static final String TABLE_NAME = "tv_episode_runtime";

        public static final String TV_ID = "tv_id";
        public static final String TIME = "time";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV_EPISODE_RUNTIME).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_EPISODE_RUNTIME;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_EPISODE_RUNTIME;

        static Uri buildTVEpisodeUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../tv_episode_runtime/tv_id
        public static Uri buildTVEpisodeRuntimeUriWithTVId(String tv_id) {
            return CONTENT_URI.buildUpon().appendPath(tv_id).build();
        }

        public static Uri buildTVEpisodeRuntimeUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class TVGenres implements BaseColumns {

        public static final String TABLE_NAME = "tv_genres";

        public static final String ID_GENRES = "id_genres";
        public static final String NAME = "name";
        public static final String TV_ID = "tv_id";


        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV_GENRES).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_GENRES;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_GENRES;

        static Uri buildTVGenreUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../genres/tvId
        public static Uri buildGenresUriWithTVId(String tvId) {
            return CONTENT_URI.buildUpon().appendPath(tvId).build();
        }

        public static Uri buildGenreUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class TVNetworks implements BaseColumns {

        public static final String TABLE_NAME = "tv_networks";

        public static final String ID = "id";
        public static final String NAME = "name";
        public static final String TV_ID = "tv_id";


        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV_NETWORKS).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_NETWORKS;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_NETWORKS;

        static Uri buildTVNetworksUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../tv_networks/tvId
        public static Uri buildTVNetworksUriWithTVId(String id) {
            return CONTENT_URI.buildUpon().appendPath(id).build();
        }

        public static Uri buildGenreUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class TVSeasons implements BaseColumns {

        public static final String TABLE_NAME = "tv_seasons";

        public static final String ID = "id";
        public static final String EPISODE_COUNT = "episode_count";
        public static final String TV_ID = "tv_id";
        public static final String SEASON_NUMBER = "season_number";
        public static final String POSTER_PATH = "poster_path";


        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV_SEASONS).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_SEASONS;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_SEASONS;

        static Uri buildTVSeasonsUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../tv_seasons/tvId
        public static Uri buildTVSeasonsUriWithTVId(String tvId) {
            return CONTENT_URI.buildUpon().appendPath(tvId).build();
        }

        public static Uri buildGenreUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class TVVideos implements BaseColumns {

        public static final String TABLE_NAME = "tv_videos";

        public static final String VIDEO_ID = "id";
        public static final String KEY = "key";
        public static final String NAME = "name";
        public static final String SITE = "site";
        public static final String SIZE = "size";
        public static final String TYPE = "type";
        public static final String TV_ID = "tv_id";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV_VIDEOS).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_VIDEOS;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_VIDEOS;

        static Uri buildTVVideosUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../tv_videos/TvId
        public static Uri buildTVUriWithTVId(String tvId) {
            return CONTENT_URI.buildUpon().appendPath(tvId).build();
        }

        public static Uri buildTVVideosUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class TVSimilar implements BaseColumns {

        public static final String TABLE_NAME = "similar_tv";
        public static final String TV_ID_OLD = "id_old";
        public static final String PAGE = "page";
        public static final String POSTER_PATH = "poster_path";
        public static final String OVERVIEW = "overview";
        public static final String FIRST_AIR_DATE = "first_air_date";
        public static final String TV_ID = "id";
        public static final String ORIGINAL_NAME = "original_name";
        public static final String ORIGINAL_LANGUAGE = "original_language";
        public static final String NAME = "name";
        public static final String BACKDROP_PATH = "backdrop_path";
        public static final String POPULARITY = "popularity";
        public static final String VOTE_COUNT = "vote_count";
        public static final String VOTE_AVERAGE = "vote_average";
        public static final String FAVOURED = "favoured";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV_SIMILAR).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_SIMILAR;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_SIMILAR;

        static Uri buildSimilarTVUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../similar_tv/MovieId
        public static Uri buildSimilarTVUriWithTVId(String TVId) {
            return CONTENT_URI.buildUpon().appendPath(TVId).build();
        }

        public static Uri buildSimilarTVUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }
    }

    public static final class TVCast implements BaseColumns {

        public static final String TABLE_NAME = "tv_cast";

        public static final String CHARACTER = "character";
        public static final String CREDIT_ID = "credit_id";
        public static final String ID = "id";
        public static final String NAME = "name";
        public static final String ORDER = "order_cast";
        public static final String PROFILE_PATH = "profile_path";
        public static final String TV_ID = "tv_id";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV_CAST).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_CAST;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV_CAST;

        static Uri buildTVCastUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../tv_casts/TvId
        public static Uri buildCastsUriWithTVId(String TVId) {
            return CONTENT_URI.buildUpon().appendPath(TVId).build();
        }

        public static Uri buildCastUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }


    public static final class Cast implements BaseColumns {

        public static final String TABLE_NAME = "cast";

        public static final String CAST_ID = "cast_id";
        public static final String CHARACTER = "character";
        public static final String CREDIT_ID = "credit_id";
        public static final String ID = "id";
        public static final String NAME = "name";
        public static final String ORDER = "order_cast";
        public static final String PROFILE_PATH = "profile_path";
        public static final String MOVIE_ID = "movie_id";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_CASTS).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_CASTS;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_CASTS;

        static Uri buildCastUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../casts/MovieId
        public static Uri buildCastsUriWithMovieId(String MovieId) {
            return CONTENT_URI.buildUpon().appendPath(MovieId).build();
        }

        public static Uri buildCastUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class People implements BaseColumns {

        public static final String TABLE_NAME = "people";

        public static final String ADULT = "adult";
        public static final String BIOGRAPHY = "biography";
        public static final String BIRTHDAY = "birthday";
        public static final String DEATHDAY = "deathday";
        public static final String GENDER = "gender";
        public static final String HOMEPAGE = "homepage";
        public static final String ID = "id";
        public static final String NAME = "name";
        public static final String PLACE_OF_BIRTH = "place_of_birth";
        public static final String POPULARITY = "popularity";
        public static final String PROFILE_PATH = "profile_path";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_PEOPLE).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_PEOPLE;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_PEOPLE;

        static Uri buildPeopleUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../people/peopleId
        public static Uri buildPeopleUriWithPeopleId(String peopleId) {
            return CONTENT_URI.buildUpon().appendPath(peopleId).build();
        }

        public static Uri buildPersonUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class Crew implements BaseColumns {

        public static final String TABLE_NAME = "crew";

        public static final String CREDIT_ID = "credit_id";
        public static final String DEPARTMENT = "department";
        public static final String ID = "id";
        public static final String JOB = "job";
        public static final String NAME = "name";
        public static final String PROFILE_PATH = "profile_path";
        public static final String MOVIE_ID = "movie_id";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_CREWS).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_CREWS;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_CREWS;

        static Uri buildCrewUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../crews/MovieId
        public static Uri buildCrewsUriWithMovieId(String MovieId) {
            return CONTENT_URI.buildUpon().appendPath(MovieId).build();
        }

        public static Uri buildCrewUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class TV implements BaseColumns {

        public static final String TABLE_NAME = "tv";

        public static final String PAGE = "page";
        public static final String POSTER_PATH = "poster_path";
        public static final String OVERVIEW = "overview";
        public static final String FIRST_AIR_DATE = "first_air_date";
        public static final String TV_ID = "id";
        public static final String ORIGINAL_NAME = "original_name";
        public static final String ORIGINAL_LANGUAGE = "original_language";
        public static final String NAME = "name";
        public static final String BACKDROP_PATH = "backdrop_path";
        public static final String POPULARITY = "popularity";
        public static final String VOTE_COUNT = "vote_count";
        public static final String VOTE_AVERAGE = "vote_average";
        public static final String FAVOURED = "favoured";
        public static final String SHOWED = "shown";
        public static final String DOWNLOADED = "downloaded";
        public static final String MODE = "mode";
        public static final String PREF_LANGUAGE = "pref_lang";
        public static final String PREF_ADULT = "pref_adult";
        public static final String PREF_REGION = "pref_region";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_TV).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_TV;

        static Uri buildTVUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../tv/TVid
        public static Uri buildTVUriWithTVId(String tvId) {
            return CONTENT_URI.buildUpon().appendPath(tvId).build();
        }

        public static Uri buildTVUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

    public static final class FavouritesMovies implements BaseColumns {

        public static final String TABLE_NAME = "favourites_movies";
        public static final String MOVIE_ID = "id";

        static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_FAVOURITES_MOVIES).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_FAVOURITES_MOVIES;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_FAVOURITES_MOVIES;

        static Uri buildMoviesUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../favourites_movies/MovieId
        public static Uri buildMoviesUriWithMovieId(String MovieId) {
            return CONTENT_URI.buildUpon().appendPath(MovieId).build();
        }

        public static Uri buildMovieUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }
    }

    public static final class FavouritesTVs implements BaseColumns {

        public static final String TABLE_NAME = "favourites_tv";
        public static final String TV_ID = "id";

        static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_FAVOURITES_TV).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_FAVOURITES_TV;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_FAVOURITES_TV;

        static Uri buildTVUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../favourites_tv/tvId
        public static Uri buildMoviesUriWithTvId(String tvId) {
            return CONTENT_URI.buildUpon().appendPath(tvId).build();
        }

        public static Uri buildTVUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }
    }

    public static final class Videos implements BaseColumns {

        public static final String TABLE_NAME = "videos";

        public static final String VIDEO_ID = "id";
        public static final String KEY = "key";
        public static final String NAME = "name";
        public static final String SITE = "site";
        public static final String SIZE = "size";
        public static final String TYPE = "type";
        public static final String MOVIE_ID = "movie_id";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_VIDEOS).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_VIDEOS;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_VIDEOS;

        static Uri buildMoviesUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../videos/MovieId
        public static Uri buildMoviesUriWithMovieId(String MovieId) {
            return CONTENT_URI.buildUpon().appendPath(MovieId).build();
        }

        public static Uri buildVideosUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }


    }

    public static final class Reviews implements BaseColumns {

        public static final String TABLE_NAME = "reviews";

        public static final String PAGE = "page";
        public static final String TOTAL_PAGE = "total_page";
        public static final String TOTAL_RESULTS = "total_results";
        public static final String ID_REVIEWS = "id_reviews";
        public static final String AUTHOR = "author";
        public static final String CONTENT = "content";
        public static final String URL = "url";
        public static final String MOVIE_ID = "movie_id";

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_REVIEWS).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_REVIEWS;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_REVIEWS;

        static Uri buildReviewsUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../reviews/MovieId
        public static Uri buildReviewsUriWithMovieId(String MovieId) {
            return CONTENT_URI.buildUpon().appendPath(MovieId).build();
        }

        public static Uri buildReviewUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }


    }

    public static final class Genres implements BaseColumns {

        public static final String TABLE_NAME = "genres";

        public static final String ID_GENRES = "id_genres";
        public static final String NAME = "name";
        public static final String MOVIE_ID = "movie_id";


        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_GENRES).build();

        static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_GENRES;
        static final String CONTENT_ITEM_TYPE =
                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_GENRES;

        static Uri buildMoviesUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        //content://work....../genres/MovieId
        public static Uri buildGenresUriWithMovieId(String MovieId) {
            return CONTENT_URI.buildUpon().appendPath(MovieId).build();
        }

        public static Uri buildGenreUri() {
            return CONTENT_URI.buildUpon().build();
        }

        public static String getIDFromUri(Uri uri) {
            return uri.getPathSegments().get(1);
        }

    }

} public interface AsyncResponse {
    void onFinish(boolean isData);
} public final class PaletteTransformation implements Transformation {
    private static final PaletteTransformation INSTANCE = new PaletteTransformation();
    private static final Map<Bitmap, Palette> CACHE = new WeakHashMap<>();

    private PaletteTransformation() {
    }

    public static PaletteTransformation instance() {
        return INSTANCE;
    }

    public static Palette getPalette(Bitmap bitmap) {
        return CACHE.get(bitmap);
    }

    @Override
    public Bitmap transform(Bitmap source) {
        Palette palette = Palette.generate(source);
        CACHE.put(source, palette);
        return source;
    }

    @Override
    public String key() {
        return "";
    }
} public class Utility {

    public static boolean hasNetworkConnection(Context context) {
        boolean hasConnectedWifi = false;
        boolean hasConnectedMobile = false;

        ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo[] netInfo = cm.getAllNetworkInfo();
        for (NetworkInfo ni : netInfo) {
            if (ni.getTypeName().equalsIgnoreCase("WIFI"))
                if (ni.isConnected())
                    hasConnectedWifi = true;
            if (ni.getTypeName().equalsIgnoreCase("MOBILE"))
                if (ni.isConnected())
                    hasConnectedMobile = true;
        }
        return hasConnectedWifi || hasConnectedMobile;
    }


    public static void playVideo(Activity mActivity, String source) {
        if (mActivity != null) {
            String version = YouTubeIntents.getInstalledYouTubeVersionName(mActivity);
            if (version == null) {
                Toast.makeText(mActivity, R.string.youtube_not_installed, Toast.LENGTH_SHORT).show();
            } else {
                Intent intent = YouTubeIntents.createPlayVideoIntentWithOptions(mActivity, source, true, false);
                mActivity.startActivity(intent);
            }
        }
    }
} public static final String[] TV_SEASON_DETAILS_COLUMNS = {

        MovieContract.TVSeasonDetails.TABLE_NAME + "." + MovieContract.TVSeasonDetails._ID,
        MovieContract.TVSeasonDetails.SEASON_ID,
        MovieContract.TVSeasonDetails.AIR_DATE,
        MovieContract.TVSeasonDetails.NAME,
        MovieContract.TVSeasonDetails.OVERVIEW,
        MovieContract.TVSeasonDetails.SEASON__ID,
        MovieContract.TVSeasonDetails.POSTER_PATH,
        MovieContract.TVSeasonDetails.SEASON_NUMBER,
}; public static final int TV_SEASON_DETAILS_COL_AIR_DATE = 2; public static final int TV_SEASON_DETAILS_COL_NAME = 3; public static final int TV_SEASON_DETAILS_COL_OVERVIEW = 4;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.graphics.Palette;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.transition.TransitionInflater;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import work.technie.popularmovies.Constants;
import work.technie.popularmovies.R;
import work.technie.popularmovies.adapter.EpisodesTVArrayAdapter;
import work.technie.popularmovies.asyntask.FetchSeasonDetail;
import work.technie.popularmovies.data.MovieContract;
import work.technie.popularmovies.utils.AsyncResponse;
import work.technie.popularmovies.utils.PaletteTransformation;
import work.technie.popularmovies.utils.Utility;
import static work.technie.popularmovies.Constants.TV_SEASON_DETAILS_COLUMNS;
import static work.technie.popularmovies.Constants.TV_SEASON_DETAILS_COL_AIR_DATE;
import static work.technie.popularmovies.Constants.TV_SEASON_DETAILS_COL_NAME;
import static work.technie.popularmovies.Constants.TV_SEASON_DETAILS_COL_OVERVIEW;
                    arguments.putString(Intent.EXTRA_BCC, cursor.getString(Constants.TV_EPISODE_COL_ID));
                    arguments.putBoolean(Intent.ACTION_SCREEN_ON, mTwoPane);

                    fragment.setArguments(arguments);
                    FragmentManager fragmentManager = ((AppCompatActivity) mActivity).getSupportFragmentManager();
                    if (mTwoPane) {
                        fragmentManager.beginTransaction()
                                .replace(R.id.movie_detail_container, fragment, SEASON_DETAIL_FRAGMENT_TAG)
                                .addToBackStack(null)
                                .commit();
                    } else {
                        fragmentManager.beginTransaction()
                                .add(R.id.frag_container, fragment, SEASON_DETAIL_FRAGMENT_TAG)
                                .addToBackStack(null)
                                .commit();
                    }
                }
            });
        }
    }

    private void loadData(final View rootView) {

        swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.detail_season_swipe_refresh);
        swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                if (Utility.hasNetworkConnection(getActivity())) {
                    getActivity().getContentResolver().delete(MovieContract.TVSeasonDetails.buildSeasonDetailsUriWithSeasonId(season_Id), null, null);
                    updateDetailList();
                } else {
                    Toast.makeText(getContext(), "Network Not Available!", Toast.LENGTH_SHORT).show();
                    swipeRefreshLayout.setRefreshing(false);
                }
            }
        });

        int count = 0;

        Uri Uri = MovieContract.TVSeasonDetails.buildSeasonDetailsUri();
        Cursor cursor = getActivity().getContentResolver().query(Uri, Constants.TV_SEASON_DETAILS_COLUMNS,
                MovieContract.TVSeasonDetails.SEASON_ID + " = ? ",
                new String[]{season_Id},
                null);
        if (cursor != null) {
            count = cursor.getCount();
            cursor.close();
        }

        if (count == 0) {
            if (!Utility.hasNetworkConnection(getActivity())) {
                Toast.makeText(getContext(), "Network Not Available!", Toast.LENGTH_LONG).show();
            } else {
                swipeRefreshLayout.post(new Runnable() {
                    @Override
                    public void run() {
                        swipeRefreshLayout.setRefreshing(true);
                    }
                });
                updateDetailList();
            }
        } else {
            populateAdapters();
        }
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        getLoaderManager().initLoader(SEASON_DETAILS_LOADER, null, this);
        super.onActivityCreated(savedInstanceState);
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        outState.putInt(DARK_MUTED_COLOR, dark_muted_color);
        outState.putInt(MUTED_COLOR, muted_color);
        super.onSaveInstanceState(outState);
    }

    @Override
    public Loader<Cursor> onCreateLoader(int id, Bundle args) {
        if (null != season_Id) {
            // Now create and return a CursorLoader that will take care of
            // creating a Cursor for the data being displayed.
            switch (id) {
                case SEASON_DETAILS_LOADER:
                    return new CursorLoader(
                            getActivity(),
                            MovieContract.TVSeasonDetails.buildSeasonDetailsUriWithSeasonId(season_Id),
                            TV_SEASON_DETAILS_COLUMNS,
                            null,
                            null,
                            null
                    );
            }
        }
        return null;
    }

    private void defaultShow() {
        rootView.findViewById(R.id.season_img).setVisibility(View.VISIBLE);
        rootView.findViewById(R.id.overview_title).setVisibility(View.VISIBLE);
        rootView.findViewById(R.id.air_date_title).setVisibility(View.VISIBLE);
        rootView.findViewById(R.id.episodes_title).setVisibility(View.VISIBLE);
        rootView.findViewById(R.id.tmdb_season).setVisibility(View.VISIBLE);
    }

    @Override
    public void onLoadFinished(Loader<Cursor> loader, final Cursor data) {
        swipeRefreshLayout.setRefreshing(false);
        if (!data.moveToFirst()) {
            return;
        }
        switch (loader.getId()) {
            case SEASON_DETAILS_LOADER:

                defaultShow();
                String name = data.getString(TV_SEASON_DETAILS_COL_NAME).trim();
                collapsingToolbar.setTitle(name.isEmpty() || name.equalsIgnoreCase("null") ? "-" : name);

                String overview = data.getString(TV_SEASON_DETAILS_COL_OVERVIEW).trim();