diff --git a/EnvelopeGenerator.Application/DocStatus/Commands/CreateDocStatusCommand.cs b/EnvelopeGenerator.Application/DocStatus/Commands/CreateDocStatusCommand.cs
index ba7e7dc5..85c0209d 100644
--- a/EnvelopeGenerator.Application/DocStatus/Commands/CreateDocStatusCommand.cs
+++ b/EnvelopeGenerator.Application/DocStatus/Commands/CreateDocStatusCommand.cs
@@ -1,19 +1,17 @@
-using EnvelopeGenerator.Domain;
-
-namespace EnvelopeGenerator.Application.DocStatus.Commands;
+namespace EnvelopeGenerator.Application.DocStatus.Commands;
///
///
///
-public class CreateDocStatusCommand : UpdateDocStatusCommand
+public record CreateDocStatusCommand : ModifyDocStatusCommandBase
{
///
- /// Gets timestamp when this record was added. Returns the current date and time.
+ /// Gets timestamp when this record was added. Returns null.
///
- public DateTime AddedWhen => StatusChangedWhen;
+ public override DateTime? ChangedWhen => null;
///
- /// Gets timestamp when this record was added. Returns the current date and time.
+ /// Gets timestamp when this record was added. Returns the StatusChangedWhen value.
///
- public override DateTime? ChangedWhen { get; } = null;
+ public DateTime AddedWhen => StatusChangedWhen;
}
\ No newline at end of file
diff --git a/EnvelopeGenerator.Application/DocStatus/Commands/ModifyDocStatusCommandBase.cs b/EnvelopeGenerator.Application/DocStatus/Commands/ModifyDocStatusCommandBase.cs
new file mode 100644
index 00000000..6ecc0fe4
--- /dev/null
+++ b/EnvelopeGenerator.Application/DocStatus/Commands/ModifyDocStatusCommandBase.cs
@@ -0,0 +1,52 @@
+using EnvelopeGenerator.Domain;
+
+namespace EnvelopeGenerator.Application.DocStatus.Commands;
+
+///
+///
+///
+public abstract record ModifyDocStatusCommandBase
+{
+ ///
+ /// Gets or sets the ID of the associated envelope.
+ ///
+ public int EnvelopeId { get; set; }
+
+ ///
+ /// Gets or sets the ID of the receiver associated with this status.
+ ///
+ public int ReceiverId { get; set; }
+
+ ///
+ /// Gets the current status code.
+ ///
+ public Constants.DocumentStatus Status => Value is null ? Constants.DocumentStatus.Created : Constants.DocumentStatus.Signed;
+
+ ///
+ /// Gets or sets the display value associated with the status.
+ ///
+ public string? Value { get; set; }
+
+ ///
+ /// Gets timestamp when this record was added.
+ ///
+ public DateTime StatusChangedWhen { get; } = DateTime.Now;
+
+ ///
+ /// Gets timestamp when this record was added.
+ ///
+ public abstract DateTime? ChangedWhen { get; }
+
+ ///
+ /// Maps the current command to a new instance of the specified type.
+ ///
+ ///
+ ///
+ public TDest To() where TDest : ModifyDocStatusCommandBase, new()
+ => new()
+ {
+ EnvelopeId = EnvelopeId,
+ ReceiverId = ReceiverId,
+ Value = Value
+ };
+}
diff --git a/EnvelopeGenerator.Application/DocStatus/Commands/UpdateDocStatusCommand.cs b/EnvelopeGenerator.Application/DocStatus/Commands/UpdateDocStatusCommand.cs
index 2b024baa..97c5e2b8 100644
--- a/EnvelopeGenerator.Application/DocStatus/Commands/UpdateDocStatusCommand.cs
+++ b/EnvelopeGenerator.Application/DocStatus/Commands/UpdateDocStatusCommand.cs
@@ -5,35 +5,10 @@ namespace EnvelopeGenerator.Application.DocStatus.Commands;
///
///
///
-public class UpdateDocStatusCommand
+public record UpdateDocStatusCommand : ModifyDocStatusCommandBase
{
///
- /// Gets or sets the ID of the associated envelope.
+ /// Gets timestamp when this record was added. Returns the StatusChangedWhen value.
///
- public int EnvelopeId { get; set; }
-
- ///
- /// Gets or sets the ID of the receiver associated with this status.
- ///
- public int ReceiverId { get; set; }
-
- ///
- /// Gets the current status code.
- ///
- public Constants.DocumentStatus Status => Value is null ? Constants.DocumentStatus.Created : Constants.DocumentStatus.Signed;
-
- ///
- /// Gets the timestamp when the status was changed. Retrns the AddedWhen value.
- ///
- public DateTime StatusChangedWhen { get; } = DateTime.Now;
-
- ///
- /// Gets or sets the display value associated with the status.
- ///
- public string? Value { get; set; }
-
- ///
- /// Gets timestamp when this record was added. Returns the current date and time.
- ///
- public virtual DateTime? ChangedWhen { get; } = DateTime.Now;
+ public override DateTime? ChangedWhen => StatusChangedWhen;
}
\ No newline at end of file