using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Kyoo.Abstractions.Controllers;
using Kyoo.Abstractions.Models;
using Kyoo.Abstractions.Models.Exceptions;
using Kyoo.Utils;
namespace Kyoo.Core.Controllers
{
public class LibraryManager : ILibraryManager
{
///
/// The list of repositories
///
private readonly IBaseRepository[] _repositories;
///
public ILibraryRepository LibraryRepository { get; }
///
public ILibraryItemRepository LibraryItemRepository { get; }
///
public ICollectionRepository CollectionRepository { get; }
///
public IShowRepository ShowRepository { get; }
///
public ISeasonRepository SeasonRepository { get; }
///
public IEpisodeRepository EpisodeRepository { get; }
///
public ITrackRepository TrackRepository { get; }
///
public IPeopleRepository PeopleRepository { get; }
///
public IStudioRepository StudioRepository { get; }
///
public IGenreRepository GenreRepository { get; }
///
public IProviderRepository ProviderRepository { get; }
///
public IUserRepository UserRepository { get; }
///
/// Create a new instance with every repository available.
///
/// The list of repositories that this library manager should manage.
/// If a repository for every base type is not available, this instance won't be stable.
public LibraryManager(IEnumerable repositories)
{
_repositories = repositories.ToArray();
LibraryRepository = GetRepository() as ILibraryRepository;
LibraryItemRepository = GetRepository() as ILibraryItemRepository;
CollectionRepository = GetRepository() as ICollectionRepository;
ShowRepository = GetRepository() as IShowRepository;
SeasonRepository = GetRepository() as ISeasonRepository;
EpisodeRepository = GetRepository() as IEpisodeRepository;
TrackRepository = GetRepository