namespace ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Config;
///
/// Driver-instance options for the in-process .NET 10 Galaxy driver. Maps to the
/// DriverConfig JSON column on the central config DB. Decomposed into nested
/// records so the JSON structure mirrors the runtime shape and operators can target
/// individual sections (gateway endpoint, mxaccess client identity, reconnect policy)
/// without touching the rest.
///
/// Connection details for the MxAccess gateway (mxaccessgw repo).
/// MXAccess-specific knobs surfaced through gw — client name, publishing interval, write-user.
/// Galaxy Repository browse options consumed by the discoverer.
/// Backoff knobs for the in-driver reconnect supervisor (PR 4.5).
public sealed record GalaxyDriverOptions(
GalaxyGatewayOptions Gateway,
GalaxyMxAccessOptions MxAccess,
GalaxyRepositoryOptions Repository,
GalaxyReconnectOptions Reconnect);
///
/// Connection details for the MxAccess gateway. resolves
/// through the server-side secret store (DPAPI for production, environment override for
/// dev) — the API key never appears in cleartext config.
///
public sealed record GalaxyGatewayOptions(
string Endpoint,
string ApiKeySecretRef,
bool UseTls = true,
string? CaCertificatePath = null,
int ConnectTimeoutSeconds = 10,
int DefaultCallTimeoutSeconds = 5,
int StreamTimeoutSeconds = 0);
///
/// MXAccess-specific knobs the gateway forwards to the worker process.
///
///
/// Wonderware client identity. MUST be unique per OtOpcUa instance — when two instances
/// share a name, the older session loses subscription state. Redundancy pairs (decision
/// #149) enforce uniqueness via install scripts.
///
///
/// Hint forwarded as buffered_update_interval_ms on subscribe; lets the worker
/// coalesce updates at the OPC UA publishing cadence rather than every COM tick.
///
///
/// Reserved for ArchestrA secured-write user mapping; PR 4.3 wires WriteSecured
/// routing against this id. 0 = anonymous.
///
public sealed record GalaxyMxAccessOptions(
string ClientName,
int PublishingIntervalMs = 1000,
int WriteUserId = 0);
///
/// Galaxy Repository browse-side knobs consumed by PR 4.1's GalaxyDiscoverer.
///
public sealed record GalaxyRepositoryOptions(
int DiscoverPageSize = 5000,
bool WatchDeployEvents = true);
///
/// Backoff knobs for the in-driver reconnect supervisor (PR 4.5). Replay-on-session-lost
/// calls the gw's ReplaySubscriptions RPC after reconnect rather than re-issuing
/// subscribe-bulk for every tag.
///
public sealed record GalaxyReconnectOptions(
int InitialBackoffMs = 500,
int MaxBackoffMs = 30_000,
bool ReplayOnSessionLost = true);