diff --git a/src/LagoVista.Core/Interfaces/INotificationPublisherV2.cs b/src/LagoVista.Core/Interfaces/INotificationPublisherV2.cs new file mode 100644 index 00000000..ca736191 --- /dev/null +++ b/src/LagoVista.Core/Interfaces/INotificationPublisherV2.cs @@ -0,0 +1,47 @@ +using LagoVista.Core.Models; +using System; +using System.Threading.Tasks; + +namespace LagoVista.Core.Interfaces +{ + /// + /// Additive delivery-target flags. The legacy Targets enum and + /// INotificationPublisher signatures remain unchanged. + /// + [Flags] + public enum NotificationTargets + { + None = 0, + WebSocket = 1 << 0, + Push = 1 << 1, + Browser = 1 << 2, + Sms = 1 << 3 + } + + /// + /// Optional publisher capability for callers that explicitly select + /// multiple delivery transports. Existing publishers may continue to + /// implement INotificationPublisher only. + /// + public interface INotificationPublisherV2 : INotificationPublisher + { + Task PublishAsync(NotificationTargets targets, Notification notification, + NotificationVerbosity verbosity = NotificationVerbosity.Normal); + + Task PublishAsync(NotificationTargets targets, Channels channel, + string channelId, TPayload message, + NotificationVerbosity verbosity = NotificationVerbosity.Normal); + + Task PublishAsync(NotificationTargets targets, Channels channel, + string channelId, string text, TPayload message, + NotificationVerbosity verbosity = NotificationVerbosity.Normal); + + Task PublishAsync(NotificationTargets targets, TEntity entity, + NotificationVerbosity verbosity = NotificationVerbosity.Normal) + where TEntity : IIDEntity; + + Task PublishTextAsync(NotificationTargets targets, Channels channel, + string channelId, string text, + NotificationVerbosity verbosity = NotificationVerbosity.Normal); + } +} diff --git a/src/LagoVista.Core/Models/Notification.cs b/src/LagoVista.Core/Models/Notification.cs index f3225ad5..117f7075 100644 --- a/src/LagoVista.Core/Models/Notification.cs +++ b/src/LagoVista.Core/Models/Notification.cs @@ -23,6 +23,10 @@ public Notification() [JsonProperty("dateStamp")] public String DateStamp { get; set; } + // Absent in legacy queue messages: consumers retain existing WebSocket delivery. + [JsonProperty("deliveryTargets", NullValueHandling = NullValueHandling.Ignore)] + public NotificationTargets? DeliveryTargets { get; set; } + [JsonProperty("channel")] public EntityHeader Channel { get; set; }