using EnvelopeGenerator.Application.Dto.EnvelopeReceiver; using MediatR; using System.Dynamic; namespace EnvelopeGenerator.Application.Common.Notifications; /// /// /// /// public record DocSignedNotification(EnvelopeReceiverDto Original) : EnvelopeReceiverDto(Original), INotification { /// /// /// public required ExpandoObject Annotations { get; init; } } /// /// /// public static class DocSignedNotificationExtensions { /// /// Converts an to a . /// /// The DTO to convert. /// /// A new instance. public static DocSignedNotification ToDocSignedNotification(this EnvelopeReceiverDto dto, ExpandoObject annotations) => new(dto) { Annotations = annotations }; /// /// Asynchronously converts a to a . /// /// The task that returns the DTO to convert. /// /// A task that represents the asynchronous conversion operation. public static async Task ToDocSignedNotification(this Task dtoTask, ExpandoObject annotations) => await dtoTask is EnvelopeReceiverDto dto ? new(dto) { Annotations = annotations } : null; }