using System;
using System.Threading;
using System.Threading.Tasks;
namespace LANCommander.SDK.Plugins;
///
/// A minimal in-process, strongly-typed event aggregator that lets plugins react to host lifecycle
/// events (game install/launch/uninstall, login, etc.). Registered as a singleton in both hosts.
///
public interface IPluginEventBus
{
///
/// Subscribes a handler to events of type .
///
/// A token that unsubscribes the handler when disposed.
IDisposable Subscribe(Func handler);
///
/// Publishes an event to all subscribed handlers. Each handler is awaited and isolated so a
/// throwing handler cannot break the publisher or other handlers.
///
Task PublishAsync(TEvent @event, CancellationToken cancellationToken = default);
}