namespace ZB.MOM.WW.MxGateway.Server.Configuration;

public sealed class WorkerOptions
{
    /// <summary>The path to the worker executable.</summary>
    public string ExecutablePath { get; init; } =
        @"src\ZB.MOM.WW.MxGateway.Worker\bin\x86\Release\ZB.MOM.WW.MxGateway.Worker.exe";

    /// <summary>The working directory for the worker process, or null to inherit.</summary>
    public string? WorkingDirectory { get; init; }

    /// <summary>The required processor architecture for the worker.</summary>
    public WorkerArchitecture RequiredArchitecture { get; init; } = WorkerArchitecture.X86;

    /// <summary>The maximum time in seconds for the worker to start.</summary>
    public int StartupTimeoutSeconds { get; init; } = 30;

    /// <summary>The number of retry attempts for the startup probe.</summary>
    public int StartupProbeRetryAttempts { get; init; } = 3;

    /// <summary>The delay in milliseconds between startup probe retries.</summary>
    public int StartupProbeRetryDelayMilliseconds { get; init; } = 250;

    /// <summary>The timeout in milliseconds for connecting to the worker pipe.</summary>
    public int PipeConnectAttemptTimeoutMilliseconds { get; init; } = 2000;

    /// <summary>The maximum time in seconds for graceful shutdown.</summary>
    public int ShutdownTimeoutSeconds { get; init; } = 10;

    /// <summary>The interval in seconds for worker heartbeats.</summary>
    public int HeartbeatIntervalSeconds { get; init; } = 5;

    /// <summary>The grace period in seconds after a heartbeat before considering the worker unresponsive.</summary>
    public int HeartbeatGraceSeconds { get; init; } = 15;

    /// <summary>The maximum message size in bytes for IPC communication.</summary>
    public int MaxMessageBytes { get; init; } = 16 * 1024 * 1024;
}
