using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Persistence
{
    /// 
    /// Provides an interface to implement an Item repository
    /// 
    public interface IItemRepository : IRepository
    {
        /// 
        /// Opens the connection to the repository
        /// 
        /// Task.
        Task Initialize();
        /// 
        /// Saves an item
        /// 
        /// The item.
        /// The cancellation token.
        /// Task.
        Task SaveItem(BaseItem item, CancellationToken cancellationToken);
        /// 
        /// Gets the critic reviews.
        /// 
        /// The item id.
        /// Task{IEnumerable{ItemReview}}.
        Task> GetCriticReviews(Guid itemId);
        /// 
        /// Saves the critic reviews.
        /// 
        /// The item id.
        /// The critic reviews.
        /// Task.
        Task SaveCriticReviews(Guid itemId, IEnumerable criticReviews);
        /// 
        /// Saves the items.
        /// 
        /// The items.
        /// The cancellation token.
        /// Task.
        Task SaveItems(IEnumerable items, CancellationToken cancellationToken);
        /// 
        /// Retrieves the item.
        /// 
        /// The id.
        /// BaseItem.
        BaseItem RetrieveItem(Guid id);
        /// 
        /// Gets chapters for an item
        /// 
        /// 
        /// 
        IEnumerable GetChapters(Guid id);
        /// 
        /// Gets a single chapter for an item
        /// 
        /// 
        /// 
        /// 
        ChapterInfo GetChapter(Guid id, int index);
        /// 
        /// Saves the chapters.
        /// 
        /// The id.
        /// The chapters.
        /// The cancellation token.
        /// Task.
        Task SaveChapters(Guid id, IEnumerable chapters, CancellationToken cancellationToken);
        /// 
        /// Gets the children.
        /// 
        /// The parent id.
        /// IEnumerable{ChildDefinition}.
        IEnumerable GetChildren(Guid parentId);
        /// 
        /// Saves the children.
        /// 
        /// The parent id.
        /// The children.
        /// The cancellation token.
        /// Task.
        Task SaveChildren(Guid parentId, IEnumerable children, CancellationToken cancellationToken);
    }
}