using System;
using System.Collections.Generic;
using System.Threading;
using Jellyfin.Database.Implementations.Entities;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Library
{
///
/// Interface IUserDataManager.
///
public interface IUserDataManager
{
///
/// Occurs when [user data saved].
///
event EventHandler? UserDataSaved;
///
/// Saves the user data.
///
/// The user.
/// The item.
/// The user data.
/// The reason.
/// The cancellation token.
void SaveUserData(User user, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
///
/// Save the provided user data for the given user.
///
/// The user.
/// The item.
/// The reason for updating the user data.
/// The reason.
void SaveUserData(User user, BaseItem item, UpdateUserItemDataDto userDataDto, UserDataSaveReason reason);
///
/// Gets the user data.
///
/// User to use.
/// Item to use.
/// User data.
UserItemData? GetUserData(User user, BaseItem item);
///
/// Gets the user data dto.
///
/// Item to use.
/// User to use.
/// User data dto.
UserItemDataDto? GetUserDataDto(BaseItem item, User user);
///
/// Gets user data for multiple items in a single batch operation.
///
/// The items to get user data for.
/// The user.
/// A dictionary mapping item IDs to their user data.
Dictionary GetUserDataBatch(IReadOnlyList items, User user);
///
/// Gets the user data that should drive resume for a multi-version item: the data of the most
/// recently played alternate version (including the item itself) that has a resume point.
///
/// The user.
/// The item.
/// The resume version's data, or null when the item has no versions or none has a resume point.
VersionResumeData? GetResumeUserData(User user, BaseItem item);
///
/// Gets the resume-driving user data for multiple items in a single batch operation.
/// See .
///
/// The items to get resume data for.
/// The user.
/// A dictionary mapping item ids to their resume version's data; items without one are omitted.
IReadOnlyDictionary GetResumeUserDataBatch(IReadOnlyList items, User user);
///
/// Gets the user data dto.
///
/// Item to use.
/// Item dto to use.
/// User to use.
/// Dto options to use.
/// User data dto.
UserItemDataDto? GetUserDataDto(BaseItem item, BaseItemDto? itemDto, User user, DtoOptions options);
///
/// Updates playstate for an item and returns true or false indicating if it was played to completion.
///
/// Item to update.
/// Data to update.
/// New playstate.
/// True if playstate was updated.
bool UpdatePlayState(BaseItem item, UserItemData data, long? reportedPositionTicks);
///
/// Clears any stored audio and subtitle stream selections for the given user/item pair.
/// Used when the user has opted out of remembering selections.
///
/// The user.
/// The item.
void ResetPlaybackStreamSelections(User user, BaseItem item);
}
}