From 9f6004ba8c404f7a8f0ed2276b9e6993486d2421 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 15 Jun 2026 16:59:37 +0200 Subject: [PATCH] Refactor EnvelopeDto and add EnvelopeStatus enum Updated the `EnvelopeDto` class to use a simplified receiver model (`EnvelopeReceiverSimpleDto`) for streamlined data handling. Added the `EnvelopeReceiverSimpleDto` class to represent basic receiver information (`Name`, `Email`, `Signed`). Introduced the `EnvelopeStatus` enumeration in `EnvelopeStatus.cs` to define envelope lifecycle statuses, repurposed for the `ReceiverUI` context. Added `EnvelopeStatusExtensions` with `IsActive` and `IsCompleted` methods to evaluate envelope status states. --- .../Models/EnvelopeDto.cs | 17 +++++++++- .../Models/EnvelopeStatus.cs | 33 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 EnvelopeGenerator.ReceiverUI/Models/EnvelopeStatus.cs diff --git a/EnvelopeGenerator.ReceiverUI/Models/EnvelopeDto.cs b/EnvelopeGenerator.ReceiverUI/Models/EnvelopeDto.cs index 787742d1..eb6fb910 100644 --- a/EnvelopeGenerator.ReceiverUI/Models/EnvelopeDto.cs +++ b/EnvelopeGenerator.ReceiverUI/Models/EnvelopeDto.cs @@ -20,5 +20,20 @@ public class EnvelopeDto public byte[]? DocResult { get; set; } [JsonPropertyName("envelopeReceivers")] - public List EnvelopeReceivers { get; set; } = new(); + public List EnvelopeReceivers { get; set; } = new(); +} + +/// +/// Simplified receiver model for envelope list display +/// +public class EnvelopeReceiverSimpleDto +{ + [JsonPropertyName("name")] + public string? Name { get; set; } + + [JsonPropertyName("email")] + public string? Email { get; set; } + + [JsonPropertyName("signed")] + public bool Signed { get; set; } } diff --git a/EnvelopeGenerator.ReceiverUI/Models/EnvelopeStatus.cs b/EnvelopeGenerator.ReceiverUI/Models/EnvelopeStatus.cs new file mode 100644 index 00000000..cb19eab5 --- /dev/null +++ b/EnvelopeGenerator.ReceiverUI/Models/EnvelopeStatus.cs @@ -0,0 +1,33 @@ +namespace EnvelopeGenerator.ReceiverUI.Models; + +/// +/// Envelope status enumeration (copied from Domain for ReceiverUI) +/// +public enum EnvelopeStatus +{ + Invalid = 0, + EnvelopeCreated = 1001, + EnvelopeSaved = 1002, + EnvelopeQueued = 1003, + EnvelopeSent = 1004, + EnvelopePartlySigned = 1005, + EnvelopeCompletelySigned = 1006, + EnvelopeReportCreated = 1007, + EnvelopeArchived = 1008, + EnvelopeDeleted = 1009, + EnvelopeRejected = 10007, + EnvelopeWithdrawn = 10009 +} + +public static class EnvelopeStatusExtensions +{ + public static bool IsActive(this EnvelopeStatus status) + { + return status >= EnvelopeStatus.EnvelopeCreated && status < EnvelopeStatus.EnvelopePartlySigned; + } + + public static bool IsCompleted(this EnvelopeStatus status) + { + return status >= EnvelopeStatus.EnvelopeCompletelySigned && status <= EnvelopeStatus.EnvelopeWithdrawn; + } +}