import { toDate, addDays, getThisWeek, getLastWeek, getThisMonth, getLastMonth } from '../../../utils/dateUtils.js';

/**
 * Default date range presets matching the reference design
 */
const DEFAULT_DATE_RANGE_PRESETS = [
    {
        label: "Today",
        getValue: () => {
            const today = toDate(new Date());
            return { start: today, end: today };
        },
    },
    {
        label: "Yesterday",
        getValue: () => {
            const yesterday = addDays(new Date(), -1);
            return { start: yesterday, end: yesterday };
        },
    },
    {
        label: "This week",
        getValue: () => getThisWeek(),
    },
    {
        label: "Last week",
        getValue: () => getLastWeek(),
    },
    {
        label: "This month",
        getValue: () => getThisMonth(),
    },
    {
        label: "Last month",
        getValue: () => getLastMonth(),
    },
    {
        label: "Last 3 months",
        getValue: () => {
            const today = new Date();
            today.setHours(23, 59, 59, 999);
            const start = new Date(today.getFullYear(), today.getMonth() - 3, today.getDate());
            start.setHours(0, 0, 0, 0);
            return { start, end: today };
        },
    },
    {
        label: "Year to date",
        getValue: () => {
            const today = new Date();
            today.setHours(23, 59, 59, 999);
            const start = new Date(today.getFullYear(), 0, 1);
            start.setHours(0, 0, 0, 0);
            return { start, end: today };
        },
    },
];

export { DEFAULT_DATE_RANGE_PRESETS };
