namespace ZB.MOM.WW.GalaxyRepository;

/// <summary>Publishes Galaxy repository deploy events to subscribers.</summary>
public interface IGalaxyDeployNotifier
{
    /// <summary>The most recently published event, or null if no event has fired yet.</summary>
    GalaxyDeployEventInfo? Latest { get; }

    /// <summary>Publishes a deploy event to all current subscribers and stores it as Latest.</summary>
    /// <param name="info">The deploy event to publish.</param>
    void Publish(GalaxyDeployEventInfo info);

    /// <summary>Subscribes to deploy events. The sequence yields the latest event first (if available) then streams new events as they fire.</summary>
    /// <param name="cancellationToken">Token to cancel the asynchronous operation.</param>
    /// <returns>Async enumerable of deploy events.</returns>
    IAsyncEnumerable<GalaxyDeployEventInfo> SubscribeAsync(CancellationToken cancellationToken);
}
