namespace StellaOps.Signals.Contracts;
///
/// Interface for consuming signals from the signal bus.
/// Implemented by services that process signals.
///
public interface ISignalConsumer
{
///
/// Consumes signals from the signal bus as an async enumerable.
///
/// Optional signal type to filter by.
/// Cancellation token.
/// Async enumerable of signal envelopes.
IAsyncEnumerable ConsumeAsync(
SignalType? filterType = null,
CancellationToken cancellationToken = default);
///
/// Gets the latest signal for a given key.
///
/// The signal key to look up.
/// Cancellation token.
/// The signal envelope if found, null otherwise.
ValueTask GetLatestAsync(
string signalKey,
CancellationToken cancellationToken = default);
///
/// Gets all signals for a given PURL.
///
/// The package URL to look up.
/// Cancellation token.
/// Collection of signal envelopes for the PURL.
ValueTask> GetByPurlAsync(
string purl,
CancellationToken cancellationToken = default);
}