using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Kyoo.Models;
using Kyoo.Models.Exceptions;
namespace Kyoo.Controllers
{
	/// 
	/// An interface to interract with the database. Every repository is mapped through here. 
	/// 
	public interface ILibraryManager
	{
		/// 
		/// Get the repository corresponding to the T item.
		/// 
		/// The type you want
		/// If the item is not found
		/// The repository corresponding
		IRepository GetRepository() where T : class, IResource;
		/// 
		/// The repository that handle libraries.
		/// 
		ILibraryRepository LibraryRepository { get; }
		
		/// 
		/// The repository that handle libraries's items (a wrapper arround shows & collections).
		/// 
		ILibraryItemRepository LibraryItemRepository { get; }
		
		/// 
		/// The repository that handle collections.
		/// 
		ICollectionRepository CollectionRepository { get; }
		
		/// 
		/// The repository that handle shows.
		/// 
		IShowRepository ShowRepository { get; }
		
		/// 
		/// The repository that handle seasons.
		/// 
		ISeasonRepository SeasonRepository { get; }
		
		/// 
		/// The repository that handle episodes.
		/// 
		IEpisodeRepository EpisodeRepository { get; }
		
		/// 
		/// The repository that handle tracks.
		/// 
		ITrackRepository TrackRepository { get; }
		
		/// 
		/// The repository that handle people.
		/// 
		IPeopleRepository PeopleRepository { get; }
		
		/// 
		/// The repository that handle studios.
		/// 
		IStudioRepository StudioRepository { get; }
		
		/// 
		/// The repository that handle genres.
		/// 
		IGenreRepository GenreRepository { get; }
		
		/// 
		/// The repository that handle providers.
		/// 
		IProviderRepository ProviderRepository { get; }
		
		/// 
		/// Get the resource by it's ID
		/// 
		/// The id of the resource
		/// The type of the resource
		/// If the item is not found
		/// The resource found
		Task Get(int id) where T : class, IResource;
		
		/// 
		/// Get the resource by it's slug
		/// 
		/// The slug of the resource
		/// The type of the resource
		/// If the item is not found
		/// The resource found
		Task Get(string slug) where T : class, IResource;
		
		/// 
		/// Get the resource by a filter function.
		/// 
		/// The filter function.
		/// The type of the resource
		/// If the item is not found
		/// The first resource found that match the where function
		Task Get(Expression> where) where T : class, IResource;
		/// 
		/// Get a season from it's showID and it's seasonNumber
		/// 
		/// The id of the show
		/// The season's number
		/// If the item is not found
		/// The season found
		Task Get(int showID, int seasonNumber);
		
		/// 
		/// Get a season from it's show slug and it's seasonNumber
		/// 
		/// The slug of the show
		/// The season's number
		/// If the item is not found
		/// The season found
		Task Get(string showSlug, int seasonNumber);
		
		/// 
		/// Get a episode from it's showID, it's seasonNumber and it's episode number.
		/// 
		/// The id of the show
		/// The season's number
		/// The episode's number
		/// If the item is not found
		/// The episode found
		Task Get(int showID, int seasonNumber, int episodeNumber);
		
		/// 
		/// Get a episode from it's show slug, it's seasonNumber and it's episode number.
		/// 
		/// The slug of the show
		/// The season's number
		/// The episode's number
		/// If the item is not found
		/// The episode found
		Task Get(string showSlug, int seasonNumber, int episodeNumber);
		/// 
		/// Get a track from it's slug and it's type.
		/// 
		/// The slug of the track
		/// The type (Video, Audio or Subtitle)
		/// If the item is not found
		/// The tracl found
		Task