using MediatR; using System.ComponentModel.DataAnnotations; namespace EnvelopeGenerator.Application.EnvelopeReceivers.Commands.Create; #region DTOs /// /// Signaturposition auf einem Dokument. /// /// X-Position /// Y-Position /// Seite, auf der sie sich befindet public record Signature([Required] int X, [Required] int Y, [Required] int Page); /// /// DTO für Empfänger, die erstellt oder abgerufen werden sollen. /// Wenn nicht, wird sie erstellt und mit einer Signatur versehen. /// /// Unterschriften auf Dokumenten. /// Der Name, mit dem der Käufer angesprochen werden soll. Bei Null oder keinem Wert wird der zuletzt verwendete Name verwendet. /// Sollte mit Vorwahl geschrieben werden public record ReceiverGetOrCreateDto([Required] IEnumerable Signatures, string? Name = null, string? PhoneNumber = null) { private string _emailAddress = string.Empty; /// /// E-Mail-Adresse des Empfängers. /// [Required] public required string EmailAddress { get => _emailAddress.ToLower(); init => _emailAddress = _emailAddress.ToLower(); } }; /// /// DTO for creating a document. /// /// /// The document data in byte array format. This is used when the document is provided as raw binary data. /// /// /// The document data in Base64 string format. This is used when the document is provided as a Base64-encoded string. /// public record DocumentCreateDto(byte[]? DataAsByte = null, string? DataAsBase64 = null); #endregion /// /// /// Command to create an envelope. /// /// The title of the envelope. This is a required field. /// The message to be included in the envelope. This is a required field. /// The document associated with the envelope. This is a required field. /// A collection of receivers who will receive the envelope. This is a required field. /// The language of the envelope. Defaults to "de-DE" if not specified. /// The expiration date of the envelope. Optional. /// The date when a warning should be issued before expiration. Optional. /// The type of contract associated with the envelope. Defaults to the "Contract" type. /// Indicates whether two-factor authentication is enabled for the envelope. Defaults to false. /// Befehl zur Erstellung eines Umschlags. /// /// /// /// /// /// /// /// /// /// public record CreateEnvelopeCommand( [Required] string Title, [Required] string Message, [Required] DocumentCreateDto Document, [Required] IEnumerable Receivers, string Language = "de-DE", DateTime? ExpiresWhen = null, DateTime? ExpiresWarningWhen = null, int ContractType = (int)Common.Constants.ContractType.Contract, bool TFAEnabled = false ) : IRequest;