using ZB.MOM.WW.OtOpcUa.Configuration.Enums;
namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;
///
/// Per-(node, deployment) apply progress row owned by the DriverHostActor. Replaces the
/// v1 ClusterNodeGenerationState single-row-per-node model with a history
/// of every apply attempt so the ConfigPublishCoordinator can reconstruct in-flight state
/// after a failover.
///
public sealed class NodeDeploymentState
{
/// Gets or sets the cluster node identifier.
public required string NodeId { get; init; }
/// Gets or sets the deployment identifier.
public Guid DeploymentId { get; init; }
/// Gets or sets the deployment status on this node.
public NodeDeploymentStatus Status { get; set; } = NodeDeploymentStatus.Applying;
/// Gets or sets the UTC timestamp when the deployment application started.
public DateTime StartedAtUtc { get; set; } = DateTime.UtcNow;
/// Gets or sets the UTC timestamp when the deployment was successfully applied, or null if not yet applied.
public DateTime? AppliedAtUtc { get; set; }
/// Gets or sets the failure reason if the deployment failed, or null if successful.
public string? FailureReason { get; set; }
/// Gets or sets the row version for optimistic concurrency control.
public byte[] RowVersion { get; set; } = Array.Empty();
/// Gets or sets the cluster node entity reference.
public ClusterNode? Node { get; set; }
/// Gets or sets the deployment entity reference.
public Deployment? Deployment { get; set; }
}