namespace ZB.MOM.WW.MxGateway.Server.Configuration;
public sealed class WorkerOptions
{
/// The path to the worker executable.
public string ExecutablePath { get; init; } =
@"src\ZB.MOM.WW.MxGateway.Worker\bin\x86\Release\ZB.MOM.WW.MxGateway.Worker.exe";
/// The working directory for the worker process, or null to inherit.
public string? WorkingDirectory { get; init; }
/// The required processor architecture for the worker.
public WorkerArchitecture RequiredArchitecture { get; init; } = WorkerArchitecture.X86;
/// The maximum time in seconds for the worker to start.
public int StartupTimeoutSeconds { get; init; } = 30;
/// The number of retry attempts for the startup probe.
public int StartupProbeRetryAttempts { get; init; } = 3;
/// The delay in milliseconds between startup probe retries.
public int StartupProbeRetryDelayMilliseconds { get; init; } = 250;
/// The timeout in milliseconds for connecting to the worker pipe.
public int PipeConnectAttemptTimeoutMilliseconds { get; init; } = 2000;
/// The maximum time in seconds for graceful shutdown.
public int ShutdownTimeoutSeconds { get; init; } = 10;
/// The interval in seconds for worker heartbeats.
public int HeartbeatIntervalSeconds { get; init; } = 5;
/// The grace period in seconds after a heartbeat before considering the worker unresponsive.
public int HeartbeatGraceSeconds { get; init; } = 15;
///
/// The maximum worker-frame (pipe) message size in bytes. Must stay at least
/// above
/// so a maximally-sized accepted gRPC payload
/// still fits one worker frame; the gateway conveys this value to the worker in the
/// handshake (GatewayHello.max_frame_bytes). Default is the 16 MB public gRPC cap
/// plus that reserve.
///
public int MaxMessageBytes { get; init; } =
(16 * 1024 * 1024) + Workers.WorkerFrameProtocolOptions.EnvelopeOverheadReserveBytes;
}