namespace EnvelopeGenerator.Application.Common.Dto;
///
/// Represents a captured signature with metadata created by the receiver in the signature popup.
/// This model holds the signature image (as base64 data URL) along with signer information
/// used for rendering applied signatures on the PDF canvas.
///
///
/// Used in: EnvelopeViewer.razor signature popup workflow
///
/// Creation: User draws/types/uploads signature and fills required fields
///
public sealed record Signature
{
///
/// TBDD_DOCUMENT_RECEIVER_ELEMENT.ID - identifies the specific signature field on the PDF page.
///
public required int ElementId { get; init; }
///
/// Base64-encoded data URL of the signature image.
///
/// Format: data:image/png;base64,iVBORw0KG...
///
/// Source: Canvas.toDataURL() from signature pad (draw/text/image tabs)
///
/// Usage: Set as img.src in applied signature overlay
///
public required string DataUrl { get; init; }
///
/// Full name of the signer (first and last name).
///
/// Required: Yes (validated in popup)
///
/// Example: "Max Mustermann"
///
public required string FullName { get; init; }
private readonly string? _position = null;
///
/// Job title or position of the signer.
///
/// Required: No (optional field)
///
/// Example: "Geschäftsführer" or empty string
///
public string? Position
{
get => _position;
init => _position = string.IsNullOrWhiteSpace(value) ? value : null;
}
///
/// Location/place where the signature was created.
///
/// Required: Yes (validated in popup)
///
/// Display: Shown with current date in German format (dd.MM.yyyy)
///
/// Example: "Berlin" ? rendered as "Berlin, 26.01.2025"
///
public required string Place { get; init; }
}