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

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

/// <summary>
///     OPC UA namespace served by a cluster. Generation-versioned per decision #123 —
///     namespaces are content (affect what consumers see at the endpoint), not topology.
/// </summary>
public sealed class Namespace
{
    /// <summary>Gets or sets the row identifier for this namespace.</summary>
    public Guid NamespaceRowId { get; set; }

    /// <summary>Stable logical ID, e.g. "LINE3-OPCUA-equipment". Globally unique in v2.</summary>
    public required string NamespaceId { get; set; }

    /// <summary>Gets or sets the cluster identifier.</summary>
    public required string ClusterId { get; set; }

    /// <summary>Gets or sets the namespace kind.</summary>
    public required NamespaceKind Kind { get; set; }

    /// <summary>E.g. "urn:zb:warsaw-west:equipment". Unique fleet-wide per generation.</summary>
    public required string NamespaceUri { get; set; }

    /// <summary>Gets or sets a value indicating whether the namespace is enabled.</summary>
    public bool Enabled { get; set; } = true;

    /// <summary>Gets or sets optional notes about the namespace.</summary>
    public string? Notes { get; set; }

    /// <summary>Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.</summary>
    public byte[] RowVersion { get; set; } = Array.Empty<byte>();

    /// <summary>Gets or sets the associated server cluster.</summary>
    public ServerCluster? Cluster { get; set; }
}
