using MediaBrowser.Model.Connect;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Events;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Model.ApiClient
{
    public interface IConnectionManager
    {
        /// 
        /// Occurs when [connected].
        /// 
        event EventHandler> Connected;
        /// 
        /// Occurs when [local user sign in].
        /// 
        event EventHandler> LocalUserSignIn;
        /// 
        /// Occurs when [connect user sign in].
        /// 
        event EventHandler> ConnectUserSignIn;
        /// 
        /// Occurs when [local user sign out].
        /// 
        event EventHandler> LocalUserSignOut;
        /// 
        /// Occurs when [connect user sign out].
        /// 
        event EventHandler ConnectUserSignOut;
        /// 
        /// Occurs when [remote logged out].
        /// 
        event EventHandler RemoteLoggedOut;
        
        /// 
        /// Gets the connect user.
        /// 
        /// The connect user.
        ConnectUser ConnectUser { get; }
        /// 
        /// Gets or sets a value indicating whether [save local credentials].
        /// 
        /// true if [save local credentials]; otherwise, false.
        bool SaveLocalCredentials { get; set; }
        /// 
        /// Gets the API client.
        /// 
        /// The item.
        /// IApiClient.
        IApiClient GetApiClient(IHasServerId item);
        /// 
        /// Gets the API client.
        /// 
        /// The server identifier.
        /// IApiClient.
        IApiClient GetApiClient(string serverId);
        
        /// 
        /// Connects the specified cancellation token.
        /// 
        /// The cancellation token.
        /// Task<ConnectionResult>.
        Task Connect(CancellationToken cancellationToken);
        /// 
        /// Connects the specified API client.
        /// 
        /// The API client.
        /// The cancellation token.
        /// Task<ConnectionResult>.
        Task Connect(IApiClient apiClient, CancellationToken cancellationToken);
        
        /// 
        /// Connects the specified server.
        /// 
        /// The server.
        /// The cancellation token.
        /// Task<ConnectionResult>.
        Task Connect(ServerInfo server, CancellationToken cancellationToken);
        /// 
        /// Connects the specified server.
        /// 
        /// The server.
        /// The options.
        /// The cancellation token.
        /// Task<ConnectionResult>.
        Task Connect(ServerInfo server, ConnectionOptions options, CancellationToken cancellationToken);
        /// 
        /// Connects the specified server.
        /// 
        /// The address.
        /// The cancellation token.
        /// Task<ConnectionResult>.
        Task Connect(string address, CancellationToken cancellationToken);
        /// 
        /// Logouts this instance.
        /// 
        /// Task<ConnectionResult>.
        Task Logout();
        /// 
        /// Logins to connect.
        /// 
        /// Task.
        Task LoginToConnect(string username, string password);
        /// 
        /// Gets the active api client instance
        /// 
        IApiClient CurrentApiClient { get; }
        /// 
        /// Creates the pin.
        /// 
        /// Task<PinCreationResult>.
        Task CreatePin();
        /// 
        /// Gets the pin status.
        /// 
        /// The pin.
        /// Task<PinStatusResult>.
        Task GetPinStatus(PinCreationResult pin);
        /// 
        /// Exchanges the pin.
        /// 
        /// The pin.
        /// Task.
        Task ExchangePin(PinCreationResult pin);
        /// 
        /// Gets the available servers.
        /// 
        /// The cancellation token.
        Task> GetAvailableServers(CancellationToken cancellationToken);
        /// 
        /// Authenticates an offline user with their password
        /// 
        /// The user.
        /// The password.
        /// if set to true [remember credentials].
        /// Task.
        Task AuthenticateOffline(UserDto user, string password, bool rememberCredentials);
    }
}