namespace ZB.MOM.WW.LmxProxy.Client;

/// <summary>
/// Configuration options for creating an LmxProxy client from IConfiguration sections.
/// </summary>
public class LmxProxyClientOptions
{
    /// <summary>Host address of the LmxProxy server.</summary>
    public string Host { get; set; } = "localhost";

    /// <summary>Port of the LmxProxy server.</summary>
    public int Port { get; set; } = 50051;

    /// <summary>API key for authentication.</summary>
    public string? ApiKey { get; set; }

    /// <summary>Default timeout for operations.</summary>
    public TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(30);

    /// <summary>Whether to use TLS for the connection.</summary>
    public bool UseSsl { get; set; }

    /// <summary>Path to the server CA certificate for TLS.</summary>
    public string? CertificatePath { get; set; }

    /// <summary>Whether to enable client-side metrics collection.</summary>
    public bool EnableMetrics { get; set; }

    /// <summary>Optional header name for correlation ID propagation.</summary>
    public string? CorrelationIdHeader { get; set; }

    /// <summary>Retry policy options.</summary>
    public RetryOptions Retry { get; set; } = new();
}

/// <summary>
/// Retry policy configuration options.
/// </summary>
public class RetryOptions
{
    /// <summary>Maximum number of retry attempts.</summary>
    public int MaxAttempts { get; set; } = 3;

    /// <summary>Base delay between retries.</summary>
    public TimeSpan Delay { get; set; } = TimeSpan.FromSeconds(1);
}
