namespace ZB.MOM.WW.ScadaBridge.StoreAndForward.Tests;

/// <summary>
/// WP-9: Tests for StoreAndForwardOptions defaults and configuration.
/// </summary>
public class StoreAndForwardOptionsTests
{
    [Fact]
    public void DefaultOptions_HasReasonableDefaults()
    {
        var options = new StoreAndForwardOptions();

        Assert.Equal("./data/store-and-forward.db", options.SqliteDbPath);
        Assert.Equal(TimeSpan.FromSeconds(30), options.DefaultRetryInterval);
        Assert.Equal(50, options.DefaultMaxRetries);
        Assert.Equal(TimeSpan.FromSeconds(10), options.RetryTimerInterval);
    }

    [Fact]
    public void Options_CanBeCustomized()
    {
        var options = new StoreAndForwardOptions
        {
            SqliteDbPath = "/custom/path.db",
            DefaultRetryInterval = TimeSpan.FromMinutes(5),
            DefaultMaxRetries = 100,
            RetryTimerInterval = TimeSpan.FromSeconds(30)
        };

        Assert.Equal("/custom/path.db", options.SqliteDbPath);
        Assert.Equal(TimeSpan.FromMinutes(5), options.DefaultRetryInterval);
        Assert.Equal(100, options.DefaultMaxRetries);
    }

    [Fact]
    public void SweepBatchLimit_Defaults_To_500() =>
        Assert.Equal(500, new StoreAndForwardOptions().SweepBatchLimit);
}
