using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; namespace ZB.MOM.WW.ScadaBridge.NotificationService; public static class ServiceCollectionExtensions { /// /// Registers the shared SMTP delivery primitives consumed by the central Notification /// Outbox's EmailNotificationDeliveryAdapter: , /// , and the factory. /// Central-only — sites no longer deliver notifications (see /// Component-NotificationService.md), and the orphaned site-shaped /// NotificationDeliveryService + INotificationDeliveryService contract /// was removed. Notification dispatch lives in ZB.MOM.WW.ScadaBridge.NotificationOutbox. /// /// The service collection to register into. /// The same collection, for chaining. public static IServiceCollection AddNotificationService(this IServiceCollection services) { services.AddOptions() .BindConfiguration("ScadaBridge:Notification") .ValidateOnStart(); services.TryAddEnumerable( ServiceDescriptor.Singleton, NotificationOptionsValidator>()); services.AddHttpClient(); services.AddSingleton(); services.AddSingleton>(_ => () => new MailKitSmtpClientWrapper()); return services; } /// /// Registers Akka.NET actors for the notification service (placeholder for actor registration). /// /// The service collection to register into. /// The same collection, for chaining. public static IServiceCollection AddNotificationServiceActors(this IServiceCollection services) { // Actor registration happens in AkkaHostedService. return services; } }