import { Binding } from "@uplink-protocol/core"; import { CalendarDate, CalendarMonth, CalendarYear, DateRange, YearRange } from "./calendar.interfaces"; /** * View state service interface * Responsible for managing calendar view state and binding updates */ export interface IViewStateService { /** * Initialize view state bindings */ initializeBindings(currentDate: Date, selectedDate: Date | null, selectedDateRange: DateRange, firstDayOfWeek: number, isRangeSelection: boolean, calendarDaysGenerator: () => CalendarDate[], calendarMonthsGenerator: () => CalendarMonth[], calendarYearsGenerator: () => CalendarYear[]): { currentMonth: Binding; currentYear: Binding; currentDate: Binding; monthName: Binding; calendarDays: Binding; calendarMonths: Binding; calendarYears: Binding; selectedDate: Binding; selectedDateRange: Binding; focusedDate: Binding; weekdays: Binding; isRangeSelection: Binding; currentYearRangeBase: Binding; }; /** * Update current date in view state * @param date The date to update to * @param param1 Either individual bindings or an object containing the bindings * @param param2 Function to get month name or the generate calendar days function * @param param3 Optional function to generate calendar days */ updateCurrentDate(date: Date, currentMonthBinding: Binding | { currentMonth: Binding; currentYear: Binding; monthName: Binding; calendarDays: Binding; }, currentYearOrGetMonthName: Binding | ((month: number) => string), monthNameBindingOrGenerateCalendarDays: Binding | (() => CalendarDate[]), getMonthNameFn?: (month: number) => string, calendarDaysBinding?: Binding, generateCalendarDaysFn?: () => CalendarDate[]): { month: number; year: number; }; /** * Update selected date bindings */ updateSelectedDate(date: Date | null, binding: Binding, calendarDaysBinding?: Binding, generateCalendarDays?: () => CalendarDate[]): void; /** * Update date range bindings */ updateDateRange(range: DateRange, binding: Binding, calendarDaysBinding: Binding, generateCalendarDays: () => CalendarDate[]): void; /** * Update selection mode */ updateSelectionMode(isRange: boolean, binding: Binding, calendarDaysBinding: Binding, generateCalendarDays: () => CalendarDate[]): void; /** * Update selectedDateRange binding with new range */ updateSelectedDateRange(range: DateRange, binding: Binding): void; /** * Update calendarDays binding with new calendar days */ updateCalendarDays(calendarDays: CalendarDate[], binding: Binding): void; /** * Update focused date * @param date The date to focus * @param bindingArg Either the focusedDate binding or the calendarDays binding * @param generateCalendarDays Optional function to generate calendar days */ updateFocusedDate(date: Date | null, bindingArg?: Binding | Binding, generateCalendarDays?: () => CalendarDate[]): void; }