using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Library
{
public interface ILibraryManager
{
///
/// Fires whenever any validation routine adds or removes items. The added and removed items are properties of the args.
/// *** Will fire asynchronously. ***
///
event EventHandler LibraryChanged;
///
/// Raises the event.
///
/// The instance containing the event data.
void ReportLibraryChanged(ChildrenChangedEventArgs args);
///
/// Resolves the item.
///
/// The args.
/// BaseItem.
BaseItem ResolveItem(ItemResolveArgs args);
///
/// Resolves a path into a BaseItem
///
/// The path.
/// The parent.
/// The file info.
/// BaseItem.
///
BaseItem ResolvePath(string path, Folder parent = null, WIN32_FIND_DATA? fileInfo = 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 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 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);
///
/// Saves display preferences for a Folder
///
/// The user.
/// The folder.
/// The data.
/// Task.
Task SaveDisplayPreferencesForFolder(User user, Folder folder, DisplayPreferences data);
///
/// 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 item by id.
///
/// The id.
/// The user id.
/// BaseItem.
BaseItem GetItemById(Guid id, Guid userId);
///
/// 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.
void AddParts(IEnumerable rules, IEnumerable pluginFolders,
IEnumerable resolvers, IEnumerable introProviders, IEnumerable itemComparers);
///
/// 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);
///
/// Sorts the specified items.
///
/// The items.
/// The search term.
/// IEnumerable{BaseItem}.
IEnumerable Search(IEnumerable items, string searchTerm);
///
/// Ensure supplied item has only one instance throughout
///
///
/// The proper instance to the item
BaseItem GetOrAddByReferenceItem(BaseItem item);
}
}