using DigitalData.UserManager.Application.DTOs.User;
using EnvelopeGenerator.Application.Common.Dto.Receiver;
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.Common.Dto.EnvelopeHistory;
///
/// Data Transfer Object representing the history of an envelope, including status, sender, receiver, and related metadata.
///
public record EnvelopeHistoryDto
{
///
/// Unique identifier for the envelope history entry.
///
public long Id { get; set; }
///
/// Identifier of the associated envelope.
///
public int EnvelopeId { get; set; }
///
/// Reference string for the user related to this history entry.
///
public required string UserReference { get; set; }
///
/// Include code of the envelope at this history point.
///
public EnvelopeStatus Status { get; set; }
///
/// Type of reference for this history entry.
///
public ReferenceType ReferenceType => ((int)Status).ToString().FirstOrDefault() switch
{
'1' => ReferenceType.Sender,
'2' => ReferenceType.Receiver,
_ => ReferenceType.System,
};
///
/// Human-readable name of the status.
///
public string? StatusName { get; set; }
///
/// Date and time when this history entry was added.
///
public DateTime AddedWhen { get; set; }
///
/// Date and time when an action was performed, if applicable.
///
public DateTime? ActionDate { get; set; }
///
/// Information about the sender associated with this history entry.
///
public UserCreateDto? Sender { get; set; }
///
/// Information about the receiver associated with this history entry.
///
public ReceiverDto? Receiver { get; set; }
///
/// Optional comment related to this history entry.
///
public string? Comment { get; set; }
///
public override int GetHashCode() => Id.GetHashCode();
};