using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
using ZB.MOM.WW.ScadaBridge.NotificationOutbox.Delivery;
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services;
///
/// Default that derives the supported channels
/// from the registered set. The central Host
/// registers the Email + SMS adapters (see AddNotificationOutbox) into the same DI
/// container that hosts the Central UI, so projecting each adapter's
/// yields exactly the channels the central
/// node can actually deliver — no hardcoded {Email, Sms} list to drift.
///
public sealed class NotificationChannelCatalog : INotificationChannelCatalog
{
///
/// Initializes the catalog from the registered delivery adapters, snapshotting the
/// distinct channel set once (the adapter registrations are fixed for the process
/// lifetime). Ordering follows the enum so the UI Type
/// selector renders in a stable order regardless of adapter registration order.
///
/// The registered delivery adapters (one per channel).
public NotificationChannelCatalog(IEnumerable adapters)
{
ArgumentNullException.ThrowIfNull(adapters);
SupportedChannels = adapters
.Select(a => a.Type)
.Distinct()
.OrderBy(t => (int)t)
.ToArray();
}
///
public IReadOnlyList SupportedChannels { get; }
}