package services

import (
	"testing"
	"time"
)

func TestDashboardDateCalculations(t *testing.T) {
	// Verify the date range logic used in Get()
	now := time.Date(2026, 3, 25, 14, 0, 0, 0, time.UTC) // Wednesday

	today := now.Format("2006-01-02")
	endOfWeek := now.AddDate(0, 0, 7-int(now.Weekday())).Format("2006-01-02")
	endOfNextWeek := now.AddDate(0, 0, 14-int(now.Weekday())).Format("2006-01-02")
	in7Days := now.AddDate(0, 0, 7).Format("2006-01-02")
	startOfMonth := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location()).Format("2006-01-02")

	if today != "2026-03-25" {
		t.Errorf("today = %s, want 2026-03-25", today)
	}
	if endOfWeek != "2026-03-29" { // Sunday
		t.Errorf("endOfWeek = %s, want 2026-03-29", endOfWeek)
	}
	if endOfNextWeek != "2026-04-05" {
		t.Errorf("endOfNextWeek = %s, want 2026-04-05", endOfNextWeek)
	}
	if in7Days != "2026-04-01" {
		t.Errorf("in7Days = %s, want 2026-04-01", in7Days)
	}
	if startOfMonth != "2026-03-01" {
		t.Errorf("startOfMonth = %s, want 2026-03-01", startOfMonth)
	}
}
