using ScadaLink.Commons.Types.Enums;
namespace ScadaLink.Commons.Entities.Deployment;
public class DeploymentRecord
{
///
/// The deployment record identifier.
///
public int Id { get; set; }
///
/// The instance identifier being deployed.
///
public int InstanceId { get; set; }
///
/// The current deployment status.
///
public DeploymentStatus Status { get; set; }
///
/// The deployment identifier.
///
public string DeploymentId { get; set; }
///
/// The revision hash of the deployed configuration, or null.
///
public string? RevisionHash { get; set; }
///
/// The user who initiated the deployment.
///
public string DeployedBy { get; set; }
///
/// The time when the deployment was initiated.
///
public DateTimeOffset DeployedAt { get; set; }
///
/// The time when the deployment completed, or null if still in progress.
///
public DateTimeOffset? CompletedAt { get; set; }
///
/// Error message if the deployment failed, or null.
///
public string? ErrorMessage { get; set; }
///
/// WP-4: Optimistic concurrency token for deployment status updates.
///
public byte[] RowVersion { get; set; } = [];
///
/// Initializes a new instance of the DeploymentRecord.
///
/// The deployment identifier.
/// The user initiating the deployment.
public DeploymentRecord(string deploymentId, string deployedBy)
{
DeploymentId = deploymentId ?? throw new ArgumentNullException(nameof(deploymentId));
DeployedBy = deployedBy ?? throw new ArgumentNullException(nameof(deployedBy));
}
}