using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Updates;
using Microsoft.Extensions.DependencyInjection;
namespace MediaBrowser.Common.Plugins
{
///
/// Defines the .
///
public interface IPluginManager
{
///
/// Gets the Plugins.
///
IReadOnlyList Plugins { get; }
///
/// Creates the plugins.
///
void CreatePlugins();
///
/// Returns all the assemblies.
///
/// An IEnumerable{Assembly}.
IEnumerable LoadAssemblies();
///
/// Unloads all of the assemblies.
///
void UnloadAssemblies();
///
/// Registers the plugin's services with the DI.
/// Note: DI is not yet instantiated yet.
///
/// A instance.
void RegisterServices(IServiceCollection serviceCollection);
///
/// Saves the manifest back to disk.
///
/// The to save.
/// The path where to save the manifest.
/// True if successful.
bool SaveManifest(PluginManifest manifest, string path);
///
/// Generates a manifest from repository data.
///
/// The used to generate a manifest.
/// Version to be installed.
/// The path where to save the manifest.
/// Initial status of the plugin.
/// True if successful.
Task GenerateManifest(PackageInfo packageInfo, Version version, string path, PluginStatus status);
///
/// Imports plugin details from a folder.
///
/// Folder of the plugin.
void ImportPluginFrom(string folder);
///
/// Disable the plugin.
///
/// The of the plug to disable.
void FailPlugin(Assembly assembly);
///
/// Disable the plugin.
///
/// The of the plug to disable.
void DisablePlugin(LocalPlugin plugin);
///
/// Enables the plugin, disabling all other versions.
///
/// The of the plug to disable.
void EnablePlugin(LocalPlugin plugin);
///
/// Attempts to find the plugin with and id of .
///
/// Id of plugin.
/// The version of the plugin to locate.
/// A if located, or null if not.
LocalPlugin? GetPlugin(Guid id, Version? version = null);
///
/// Removes the plugin.
///
/// The plugin.
/// Outcome of the operation.
bool RemovePlugin(LocalPlugin plugin);
}
}