using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Users;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Session
{
///
/// Interface ISessionManager
///
public interface ISessionManager
{
///
/// Occurs when [playback start].
///
event EventHandler PlaybackStart;
///
/// Occurs when [playback progress].
///
event EventHandler PlaybackProgress;
///
/// Occurs when [playback stopped].
///
event EventHandler PlaybackStopped;
///
/// Occurs when [session started].
///
event EventHandler SessionStarted;
///
/// Occurs when [session ended].
///
event EventHandler SessionEnded;
event EventHandler SessionActivity;
///
/// Occurs when [capabilities changed].
///
event EventHandler CapabilitiesChanged;
///
/// Occurs when [authentication failed].
///
event EventHandler> AuthenticationFailed;
///
/// Occurs when [authentication succeeded].
///
event EventHandler> AuthenticationSucceeded;
///
/// Gets the sessions.
///
/// The sessions.
IEnumerable Sessions { get; }
///
/// Adds the parts.
///
/// The session factories.
void AddParts(IEnumerable sessionFactories);
///
/// Logs the user activity.
///
/// Type of the client.
/// The app version.
/// The device id.
/// Name of the device.
/// The remote end point.
/// The user.
/// Task.
/// user
Task LogSessionActivity(string clientType, string appVersion, string deviceId, string deviceName, string remoteEndPoint, User user);
///
/// Used to report that playback has started for an item
///
/// The info.
/// Task.
Task OnPlaybackStart(PlaybackStartInfo info);
///
/// Used to report playback progress for an item
///
/// The info.
/// Task.
///
Task OnPlaybackProgress(PlaybackProgressInfo info);
///
/// Used to report that playback has ended for an item
///
/// The info.
/// Task.
///
Task OnPlaybackStopped(PlaybackStopInfo info);
///
/// Reports the session ended.
///
/// The session identifier.
/// Task.
void ReportSessionEnded(string sessionId);
///
/// Gets the session info dto.
///
/// The session.
/// SessionInfoDto.
SessionInfoDto GetSessionInfoDto(SessionInfo session);
///
/// Sends the general command.
///
/// The controlling session identifier.
/// The session identifier.
/// The command.
/// The cancellation token.
/// Task.
Task SendGeneralCommand(string controllingSessionId, string sessionId, GeneralCommand command, CancellationToken cancellationToken);
///
/// Sends the message command.
///
/// The controlling session identifier.
/// The session id.
/// The command.
/// The cancellation token.
/// Task.
Task SendMessageCommand(string controllingSessionId, string sessionId, MessageCommand command, CancellationToken cancellationToken);
///
/// Sends the play command.
///
/// The controlling session identifier.
/// The session id.
/// The command.
/// The cancellation token.
/// Task.
Task SendPlayCommand(string controllingSessionId, string sessionId, PlayRequest command, CancellationToken cancellationToken);
///
/// Sends the browse command.
///
/// The controlling session identifier.
/// The session id.
/// The command.
/// The cancellation token.
/// Task.
Task SendBrowseCommand(string controllingSessionId, string sessionId, BrowseRequest command, CancellationToken cancellationToken);
///
/// Sends the playstate command.
///
/// The controlling session identifier.
/// The session id.
/// The command.
/// The cancellation token.
/// Task.
Task SendPlaystateCommand(string controllingSessionId, string sessionId, PlaystateRequest command, CancellationToken cancellationToken);
///
/// Sends the message to user sessions.
///
///
/// The user identifier.
/// The name.
/// The data.
/// The cancellation token.
/// Task.
Task SendMessageToUserSessions(string userId, string name, T data, CancellationToken cancellationToken);
///
/// Sends the restart required message.
///
/// The cancellation token.
/// Task.
Task SendRestartRequiredNotification(CancellationToken cancellationToken);
///
/// Sends the server shutdown notification.
///
/// The cancellation token.
/// Task.
Task SendServerShutdownNotification(CancellationToken cancellationToken);
///
/// Sends the server restart notification.
///
/// The cancellation token.
/// Task.
Task SendServerRestartNotification(CancellationToken cancellationToken);
///
/// Adds the additional user.
///
/// The session identifier.
/// The user identifier.
void AddAdditionalUser(string sessionId, Guid userId);
///
/// Removes the additional user.
///
/// The session identifier.
/// The user identifier.
void RemoveAdditionalUser(string sessionId, Guid userId);
///
/// Reports the now viewing item.
///
/// The session identifier.
/// The item identifier.
void ReportNowViewingItem(string sessionId, string itemId);
///
/// Reports the now viewing item.
///
/// The session identifier.
/// The item.
void ReportNowViewingItem(string sessionId, BaseItemInfo item);
///
/// Authenticates the new session.
///
/// The request.
/// Task{SessionInfo}.
Task AuthenticateNewSession(AuthenticationRequest request);
///
/// Reports the capabilities.
///
/// The session identifier.
/// The capabilities.
void ReportCapabilities(string sessionId, ClientCapabilities capabilities);
///
/// Reports the transcoding information.
///
/// The device identifier.
/// The information.
void ReportTranscodingInfo(string deviceId, TranscodingInfo info);
///
/// Clears the transcoding information.
///
/// The device identifier.
void ClearTranscodingInfo(string deviceId);
///
/// Gets the session.
///
/// The device identifier.
/// The client.
/// The version.
/// SessionInfo.
SessionInfo GetSession(string deviceId, string client, string version);
///
/// Logouts the specified access token.
///
/// The access token.
/// Task.
Task Logout(string accessToken);
///
/// Revokes the user tokens.
///
/// The user identifier.
/// Task.
Task RevokeUserTokens(string userId);
///
/// Revokes the token.
///
/// The identifier.
/// Task.
Task RevokeToken(string id);
}
}