namespace ZB.MOM.WW.ScadaBridge.Host;
public class NodeOptions
{
/// Gets or sets the node role (e.g. Central or Site).
public string Role { get; set; } = string.Empty;
/// Gets or sets the hostname or IP address this node advertises to the Akka cluster.
public string NodeHostname { get; set; } = string.Empty;
///
/// Operator-configured semantic node name used to stamp the SourceNode
/// column on audit rows. Conventional values are node-a/node-b
/// on site nodes and central-a/central-b on central nodes,
/// but the value is a free-form label — no validation is enforced.
///
public string NodeName { get; set; } = string.Empty;
/// Gets or sets the site identifier for site nodes; null for central nodes.
public string? SiteId { get; set; }
/// Gets or sets the Akka.NET remoting port for cluster communication.
public int RemotingPort { get; set; } = 8081;
/// Gets or sets the gRPC port for the site stream server.
public int GrpcPort { get; set; } = 8083;
///
/// HTTP/2 (h2c) port the CENTRAL node listens on for the site→central
/// CentralControlService gRPC control plane. Default 8083 — deliberately symmetric
/// with the site , since a node is either central or a site and the
/// two never share a process. This listener is distinct from central's :5000 HTTP/1
/// surface (Central UI, Management/Inbound API), which stays exactly as-is: gRPC does NOT go
/// through Traefik (HTTP/1 only). Ignored on site nodes.
///
public int CentralGrpcPort { get; set; } = 8083;
///
/// HTTP/1.1 port serving the Prometheus /metrics scrape endpoint on site nodes.
/// Defaults to 8084 — deliberately distinct from (8082)
/// and (8083) so the Kestrel metrics listener never contends
/// with the Akka remoting port a site node binds.
///
public int MetricsPort { get; set; } = 8084;
///
/// This node's own TLS certificate for the Kestrel HTTP surface (ScadaBridge#108, design
/// 2026-11-09-tls-production-profile stage 1). Default: nothing set. Required if (and only if)
/// ASPNETCORE_URLS contains an https:// entry; central then refuses to boot
/// without it. Applies to central's HTTP/1.1+HTTP/2 surface only; the gRPC listener is unchanged.
///
public NodeTlsOptions Tls { get; set; } = new();
}
///
/// Certificate source for : a .pfx path plus password, OR a
/// certificate-store thumbprint. Same shape as the cluster's RemotingTls certificate fields.
///
public sealed class NodeTlsOptions
{
/// Path to a PKCS#12 (.pfx) file with the private key. Set this OR .
public string? CertificatePath { get; set; }
/// Password for ; write it as ${secret:NAME}, never a literal.
public string? CertificatePassword { get; set; }
/// Thumbprint of a certificate in the OS store. Set this OR .
public string? CertificateThumbprint { get; set; }
/// Store name for . Default My.
public string StoreName { get; set; } = "My";
/// Store location for : local-machine (default) or current-user.
public string StoreLocation { get; set; } = "local-machine";
/// Whether any certificate source field is set.
public bool IsConfigured =>
!string.IsNullOrWhiteSpace(CertificatePath) || !string.IsNullOrWhiteSpace(CertificateThumbprint);
}