using ZB.MOM.WW.OtOpcUa.Configuration.Enums;

namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;

/// <summary>
///     Atomic, immutable snapshot of one cluster's configuration.
///     Per decision #82 — cluster-scoped, not fleet-scoped.
/// </summary>
public sealed class ConfigGeneration
{
    /// <summary>Monotonically increasing ID, generated by <c>IDENTITY(1, 1)</c>.</summary>
    public long GenerationId { get; set; }

    public required string ClusterId { get; set; }

    public required GenerationStatus Status { get; set; }

    public long? ParentGenerationId { get; set; }

    public DateTime? PublishedAt { get; set; }

    public string? PublishedBy { get; set; }

    public string? Notes { get; set; }

    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

    public required string CreatedBy { get; set; }

    public ServerCluster? Cluster { get; set; }
    public ConfigGeneration? Parent { get; set; }
}
