using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Library
{
///
/// Interface ILibraryManager
///
public interface ILibraryManager
{
///
/// Resolves the item.
///
/// The args.
/// BaseItem.
BaseItem ResolveItem(ItemResolveArgs args);
///
/// Resolves a path into a BaseItem
///
/// The file info.
/// The parent.
/// BaseItem.
///
BaseItem ResolvePath(FileSystemInfo fileInfo, Folder parent = null);
///
/// Resolves a set of files into a list of BaseItem
///
///
/// The files.
/// The parent.
/// List{``0}.
List ResolvePaths(IEnumerable files, Folder parent)
where T : BaseItem;
///
/// Gets the root folder.
///
/// The root folder.
AggregateFolder RootFolder { get; }
///
/// Gets a Person
///
/// The name.
/// if set to true [allow slow providers].
/// Task{Person}.
Task GetPerson(string name, bool allowSlowProviders = false);
///
/// Gets the artist.
///
/// The name.
/// if set to true [allow slow providers].
/// Task{Artist}.
Task GetArtist(string name, bool allowSlowProviders = false);
///
/// Gets a Studio
///
/// The name.
/// if set to true [allow slow providers].
/// Task{Studio}.
Task GetStudio(string name, bool allowSlowProviders = false);
///
/// Gets a Genre
///
/// The name.
/// if set to true [allow slow providers].
/// Task{Genre}.
Task GetGenre(string name, bool allowSlowProviders = false);
///
/// Gets the genre.
///
/// The name.
/// if set to true [allow slow providers].
/// Task{MusicGenre}.
Task GetMusicGenre(string name, bool allowSlowProviders = false);
///
/// Gets the game genre.
///
/// The name.
/// if set to true [allow slow providers].
/// Task{GameGenre}.
Task GetGameGenre(string name, bool allowSlowProviders = false);
///
/// Gets a Year
///
/// The value.
/// if set to true [allow slow providers].
/// Task{Year}.
///
Task GetYear(int value, bool allowSlowProviders = false);
///
/// Validate and refresh the People sub-set of the IBN.
/// The items are stored in the db but not loaded into memory until actually requested by an operation.
///
/// The cancellation token.
/// The progress.
/// Task.
Task ValidatePeople(CancellationToken cancellationToken, IProgress progress);
///
/// Reloads the root media folder
///
/// The progress.
/// The cancellation token.
/// Task.
Task ValidateMediaLibrary(IProgress progress, CancellationToken cancellationToken);
///
/// Gets the default view.
///
/// IEnumerable{VirtualFolderInfo}.
IEnumerable GetDefaultVirtualFolders();
///
/// Gets the view.
///
/// The user.
/// IEnumerable{VirtualFolderInfo}.
IEnumerable GetVirtualFolders(User user);
///
/// Gets the item by id.
///
/// The id.
/// BaseItem.
BaseItem GetItemById(Guid id);
///
/// Gets the intros.
///
/// The item.
/// The user.
/// IEnumerable{System.String}.
IEnumerable GetIntros(BaseItem item, User user);
///
/// Adds the parts.
///
/// The rules.
/// The plugin folders.
/// The resolvers.
/// The intro providers.
/// The item comparers.
/// The prescan tasks.
/// The postscan tasks.
/// The savers.
void AddParts(IEnumerable rules,
IEnumerable pluginFolders,
IEnumerable resolvers,
IEnumerable introProviders,
IEnumerable itemComparers,
IEnumerable prescanTasks,
IEnumerable postscanTasks,
IEnumerable savers);
///
/// Sorts the specified items.
///
/// The items.
/// The user.
/// The sort by.
/// The sort order.
/// IEnumerable{BaseItem}.
IEnumerable Sort(IEnumerable items, User user, IEnumerable sortBy,
SortOrder sortOrder);
///
/// Ensure supplied item has only one instance throughout
///
/// The item.
/// The proper instance to the item
BaseItem GetOrAddByReferenceItem(BaseItem item);
///
/// Gets the user root folder.
///
/// The user root path.
/// UserRootFolder.
UserRootFolder GetUserRootFolder(string userRootPath);
///
/// Creates the item.
///
/// The item.
/// The cancellation token.
/// Task.
Task CreateItem(BaseItem item, CancellationToken cancellationToken);
///
/// Creates the items.
///
/// The items.
/// The cancellation token.
/// Task.
Task CreateItems(IEnumerable items, CancellationToken cancellationToken);
///
/// Updates the item.
///
/// The item.
/// The update reason.
/// The cancellation token.
/// Task.
Task UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken);
///
/// Retrieves the item.
///
/// The id.
/// BaseItem.
BaseItem RetrieveItem(Guid id);
///
/// Validates the artists.
///
/// The cancellation token.
/// The progress.
/// Task.
Task ValidateArtists(CancellationToken cancellationToken, IProgress progress);
///
/// Validates the music genres.
///
/// The cancellation token.
/// The progress.
/// Task.
Task ValidateMusicGenres(CancellationToken cancellationToken, IProgress progress);
///
/// Validates the game genres.
///
/// The cancellation token.
/// The progress.
/// Task.
Task ValidateGameGenres(CancellationToken cancellationToken, IProgress progress);
///
/// Validates the genres.
///
/// The cancellation token.
/// The progress.
/// Task.
Task ValidateGenres(CancellationToken cancellationToken, IProgress progress);
///
/// Validates the studios.
///
/// The cancellation token.
/// The progress.
/// Task.
Task ValidateStudios(CancellationToken cancellationToken, IProgress progress);
///
/// Occurs when [item added].
///
event EventHandler ItemAdded;
///
/// Occurs when [item updated].
///
event EventHandler ItemUpdated;
///
/// Occurs when [item removed].
///
event EventHandler ItemRemoved;
///
/// Reports the item removed.
///
/// The item.
void ReportItemRemoved(BaseItem item);
///
/// Finds the type of the collection.
///
/// The item.
/// System.String.
string FindCollectionType(BaseItem item);
}
}