namespace KArtSell.Modules.ModelOperations.Domain;

public interface ITradingSessionCalendar
{
    DateOnly AddTradingSessions(string calendarId, DateOnly startSession, int sessionCount);
}

public sealed record EvaluationWindowDue(int WindowTradingDays, DateOnly DueSession, string WindowCode);

public sealed class EvaluationWindowPlanner
{
    public static readonly int[] ApprovedWindows = [1, 5, 20, 63, 126, 252];

    public static IReadOnlyList<EvaluationWindowDue> Plan(
        string calendarId,
        DateOnly predictionSession,
        ITradingSessionCalendar calendar)
    {
        ArgumentException.ThrowIfNullOrWhiteSpace(calendarId);
        ArgumentNullException.ThrowIfNull(calendar);
        return ApprovedWindows
            .Select(window => new EvaluationWindowDue(
                window,
                calendar.AddTradingSessions(calendarId, predictionSession, window),
                $"W{window:D3}"))
            .ToArray();
    }
}
