namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;
/// Physical OPC UA server node within a .
public sealed class ClusterNode
{
/// Stable per-machine logical ID, e.g. "LINE3-OPCUA-A".
public required string NodeId { get; set; }
/// The unique identifier of the cluster this node belongs to.
public required string ClusterId { get; set; }
/// Machine hostname / IP.
public required string Host { get; set; }
/// The OPC UA server port (default 4840).
public int OpcUaPort { get; set; } = 4840;
/// The dashboard HTTP port (default 8081).
public int DashboardPort { get; set; } = 8081;
///
/// OPC UA ApplicationUri — MUST be unique per node per OPC UA spec. Clients pin trust here.
/// Fleet-wide unique index enforces no two nodes share a value.
/// Stored explicitly, NOT derived from at runtime — silent rewrite on
/// hostname change would break all client trust.
///
public required string ApplicationUri { get; set; }
/// Primary = 200, Secondary = 150 by default.
public byte ServiceLevelBase { get; set; } = 200;
///
/// Per-node override JSON keyed by DriverInstanceId, merged onto cluster-level DriverConfig
/// at apply time. Minimal by intent. Nullable when no overrides exist.
///
public string? DriverConfigOverridesJson { get; set; }
/// Gets or sets a value indicating whether this node is enabled.
public bool Enabled { get; set; } = true;
/// Gets or sets the timestamp when this node was last seen.
public DateTime? LastSeenAt { get; set; }
/// Gets or sets the timestamp when this node was created.
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
/// Gets or sets the username of who created this node.
public required string CreatedBy { get; set; }
// Navigation
/// Gets or sets the cluster this node belongs to.
public ServerCluster? Cluster { get; set; }
/// Gets or sets the credentials associated with this node.
public ICollection Credentials { get; set; } = [];
}