using EnvelopeGenerator.Application.Common.Dto;
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
using EnvelopeGenerator.Application.Common.Extensions;
using EnvelopeGenerator.Domain.Constants;
using MediatR;
namespace EnvelopeGenerator.Application.Common.Notifications.DocSigned;
///
/// Notification raised when a document is signed by a receiver.
///
[Obsolete("This notification is deprecated. Use Signature.Commands.SignCommand instead.")]
public record DocSignedNotification : INotification, ISendMailNotification
{
///
/// The envelope receiver information.
///
public required EnvelopeReceiverDto EnvelopeReceiver { get; init; }
///
/// The PSPDFKit annotation data.
///
[Obsolete("The PSPDFKit library is deprecated.")]
public PsPdfKitAnnotation? PsPdfKitAnnotation { get; init; }
///
/// Gets the email template type.
///
public EmailTemplateType TemplateType => EmailTemplateType.DocumentSigned;
///
/// Gets the email address of the receiver.
///
public string EmailAddress => EnvelopeReceiver.Receiver?.EmailAddress
?? throw new InvalidOperationException($"Receiver is null." +
$"DocSignedNotification:\n{this.ToJson(Format.Json.ForDiagnostics)}");
}