namespace TaxBaik.Application.Tests;

using TaxBaik.Application.Utils;
using Xunit;

public class BusinessDayCalculatorTests
{
    [Theory]
    [InlineData(2026, 2, 14, 2026, 2, 19)]
    [InlineData(2026, 8, 15, 2026, 8, 18)]
    [InlineData(2026, 10, 3, 2026, 10, 6)]
    [InlineData(2026, 9, 24, 2026, 9, 28)]
    [InlineData(2027, 2, 6, 2027, 2, 10)]
    [InlineData(2027, 10, 9, 2027, 10, 12)]
    public void GetEffectiveDueDate_SkipsWeekendHolidayAndSubstituteHoliday(
        int dueYear, int dueMonth, int dueDay,
        int expectedYear, int expectedMonth, int expectedDay)
    {
        var effective = BusinessDayCalculator.GetEffectiveDueDate(new DateOnly(dueYear, dueMonth, dueDay));

        Assert.Equal(new DateOnly(expectedYear, expectedMonth, expectedDay), effective);
    }

    [Theory]
    [InlineData(2026, 2, 19, 0)]
    [InlineData(2026, 2, 20, -1)]
    [InlineData(2026, 2, 18, 1)]
    public void GetDday_UsesEffectiveDueDate(
        int refYear, int refMonth, int refDay,
        int expectedDays)
    {
        var dday = BusinessDayCalculator.GetDday(new DateOnly(2026, 2, 14), new DateOnly(refYear, refMonth, refDay));

        Assert.Equal(expectedDays, dday);
    }
}
