using EnvelopeGenerator.Application.Common.Dto;
using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor;
using MediatR;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace EnvelopeGenerator.Application.Envelopes.Commands;
///
/// Befehl zur Erstellung eines Umschlags.
///
public record CreateEnvelopeCommand : IRequest
{
public int? EnvelopeId { get; init; }
///
/// Der Titel des Umschlags. Dies ist ein Pflichtfeld.
///
public string? Title { get; set; }
///
/// Die Nachricht, die im Umschlag enthalten sein soll. Dies ist ein Pflichtfeld.
///
public string? Message { get; set; }
///
/// Gibt an, ob die Zwei-Faktor-Authentifizierung für den Umschlag aktiviert ist. Standardmäßig false.
///
public bool TFAEnabled { get; set; } = false;
public bool Send { get; init; }
public CreateEnvelopeDocumentDto? Document { get; init; }
public List Receivers { get; init; } = new();
///
/// ID des Absenders
///
internal int UserId { get; private set; }
///
///
///
///
///
public CreateEnvelopeCommand WithAuth(int userId)
{
UserId = userId;
return this;
}
///
/// Determines which component is used for envelope processing.
/// When true, processing is delegated to ;
/// when false, is used instead.
/// Note: should only be used in testing scenarios.
///
[JsonIgnore]
[NotMapped]
public bool UseSQLExecutor { get; set; } = true;
}
public record CreateEnvelopeDocumentDto(string DataAsBase64);
public record CreateEnvelopeFieldDto(double X, double Y, int Page);
public record CreateEnvelopeReceiverDto(
string EmailAddress,
string? Name,
string? PhoneNumber,
List Fields);