using StellaOps.Plugin.Abstractions.Execution;
using StellaOps.Plugin.Abstractions.Health;
namespace StellaOps.Plugin.Host.Health;
///
/// Monitors the health of loaded plugins.
///
public interface IPluginHealthMonitor : IAsyncDisposable
{
///
/// Start the health monitoring loop.
///
/// Cancellation token.
Task StartAsync(CancellationToken ct);
///
/// Stop the health monitoring loop.
///
/// Cancellation token.
Task StopAsync(CancellationToken ct);
///
/// Register a plugin for health monitoring.
///
/// The loaded plugin.
void RegisterPlugin(LoadedPlugin plugin);
///
/// Unregister a plugin from health monitoring.
///
/// The plugin ID.
void UnregisterPlugin(string pluginId);
///
/// Perform an immediate health check on a plugin.
///
/// The plugin ID.
/// Cancellation token.
/// The health check result.
Task CheckHealthAsync(string pluginId, CancellationToken ct);
///
/// Get the current health status of a plugin.
///
/// The plugin ID.
/// The health status, or null if not registered.
HealthStatus? GetHealthStatus(string pluginId);
///
/// Get all plugin health statuses.
///
/// Dictionary of plugin ID to health status.
IReadOnlyDictionary GetAllHealthStatuses();
///
/// Event raised when a plugin's health status changes.
///
event EventHandler? HealthChanged;
}