using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Events;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Updates;
namespace MediaBrowser.Common.Updates
{
public interface IInstallationManager
{
///
/// The current installations
///
List> CurrentInstallations { get; set; }
///
/// The completed installations
///
ConcurrentBag CompletedInstallations { get; set; }
///
/// Occurs when [plugin uninstalled].
///
event EventHandler> PluginUninstalled;
///
/// Occurs when [plugin updated].
///
event EventHandler>> PluginUpdated;
///
/// Called when [plugin updated].
///
/// The plugin.
/// The new version.
void OnPluginUpdated(IPlugin plugin, PackageVersionInfo newVersion);
///
/// Occurs when [plugin updated].
///
event EventHandler> PluginInstalled;
///
/// Called when [plugin installed].
///
/// The package.
void OnPluginInstalled(PackageVersionInfo package);
///
/// Gets all available packages.
///
/// The cancellation token.
/// Type of the package.
/// The application version.
/// Task{List{PackageInfo}}.
Task> GetAvailablePackages(CancellationToken cancellationToken,
PackageType? packageType = null,
Version applicationVersion = null);
///
/// Gets the package.
///
/// The name.
/// The classification.
/// The version.
/// Task{PackageVersionInfo}.
Task GetPackage(string name, PackageVersionClass classification, Version version);
///
/// Gets the latest compatible version.
///
/// The name.
/// The classification.
/// Task{PackageVersionInfo}.
Task GetLatestCompatibleVersion(string name, PackageVersionClass classification = PackageVersionClass.Release);
///
/// Gets the latest compatible version.
///
/// The available packages.
/// The name.
/// The classification.
/// PackageVersionInfo.
PackageVersionInfo GetLatestCompatibleVersion(IEnumerable availablePackages, string name, PackageVersionClass classification = PackageVersionClass.Release);
///
/// Gets the available plugin updates.
///
/// if set to true [with auto update enabled].
/// The cancellation token.
/// Task{IEnumerable{PackageVersionInfo}}.
Task> GetAvailablePluginUpdates(bool withAutoUpdateEnabled, CancellationToken cancellationToken);
///
/// Installs the package.
///
/// The package.
/// The progress.
/// The cancellation token.
/// Task.
/// package
Task InstallPackage(PackageVersionInfo package, IProgress progress, CancellationToken cancellationToken);
///
/// Uninstalls a plugin
///
/// The plugin.
///
void UninstallPlugin(IPlugin plugin);
///
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
///
void Dispose();
}
}