using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Updates;
namespace MediaBrowser.Common.Updates
{
    /// 
    /// Defines the .
    /// 
    public interface IInstallationManager : IDisposable
    {
        /// 
        /// Gets the completed installations.
        /// 
        IEnumerable CompletedInstallations { get; }
        /// 
        /// Parses a plugin manifest at the supplied URL.
        /// 
        /// Name of the repository.
        /// The URL to query.
        /// Filter out incompatible plugins.
        /// The cancellation token.
        /// Task{IReadOnlyList{PackageInfo}}.
        Task GetPackages(string manifestName, string manifest, bool filterIncompatible, CancellationToken cancellationToken = default);
        /// 
        /// Gets all available packages that are supported by this version.
        /// 
        /// The cancellation token.
        /// Task{IReadOnlyList{PackageInfo}}.
        Task> GetAvailablePackages(CancellationToken cancellationToken = default);
        /// 
        /// Returns all plugins matching the requirements.
        /// 
        /// The available packages.
        /// The name of the plugin.
        /// The id of the plugin.
        /// The version of the plugin.
        /// All plugins matching the requirements.
        IEnumerable FilterPackages(
            IEnumerable availablePackages,
            string? name = null,
            Guid id = default,
            Version? specificVersion = null);
        /// 
        /// Returns all compatible versions ordered from newest to oldest.
        /// 
        /// The available packages.
        /// The name.
        /// The id of the plugin.
        /// The minimum required version of the plugin.
        /// The specific version of the plugin to install.
        /// All compatible versions ordered from newest to oldest.
        IEnumerable GetCompatibleVersions(
            IEnumerable availablePackages,
            string? name = null,
            Guid id = default,
            Version? minVersion = null,
            Version? specificVersion = null);
        /// 
        /// Returns the available compatible plugin updates.
        /// 
        /// The cancellation token.
        /// The available plugin updates.
        Task> GetAvailablePluginUpdates(CancellationToken cancellationToken = default);
        /// 
        /// Installs the package.
        /// 
        /// The package.
        /// The cancellation token.
        /// .
        Task InstallPackage(InstallationInfo package, CancellationToken cancellationToken = default);
        /// 
        /// Uninstalls a plugin.
        /// 
        /// The plugin.
        void UninstallPlugin(LocalPlugin plugin);
        /// 
        /// Cancels the installation.
        /// 
        /// The id of the package that is being installed.
        /// Returns true if the install was cancelled.
        bool CancelInstallation(Guid id);
    }
}