diff --git a/src/frontend/apps/calendars/src/features/calendar/components/scheduler/types.ts b/src/frontend/apps/calendars/src/features/calendar/components/scheduler/types.ts new file mode 100644 index 0000000..d13bf38 --- /dev/null +++ b/src/frontend/apps/calendars/src/features/calendar/components/scheduler/types.ts @@ -0,0 +1,80 @@ +/** + * Type definitions for Scheduler components. + */ + +import type { IcsEvent, IcsRecurrenceRule } from "ts-ics"; +import type { CalDavCalendar } from "../../services/dav/types/caldav-service"; +import type { EventCalendarAdapter } from "../../services/dav/EventCalendarAdapter"; + +/** + * Options for deleting recurring events. + */ +export type RecurringDeleteOption = 'this' | 'future' | 'all'; + +/** + * Props for the EventModal component. + */ +export interface EventModalProps { + isOpen: boolean; + mode: "create" | "edit"; + event: Partial | null; + calendarUrl: string; + calendars: CalDavCalendar[]; + adapter: EventCalendarAdapter; + onSave: (event: IcsEvent, calendarUrl: string) => Promise; + onDelete?: ( + event: IcsEvent, + calendarUrl: string, + option?: RecurringDeleteOption + ) => Promise; + onRespondToInvitation?: ( + event: IcsEvent, + status: 'ACCEPTED' | 'TENTATIVE' | 'DECLINED' + ) => Promise; + onClose: () => void; +} + +/** + * Props for the DeleteEventModal component. + */ +export interface DeleteEventModalProps { + isOpen: boolean; + isRecurring: boolean; + onConfirm: (option?: RecurringDeleteOption) => void; + onCancel: () => void; +} + +/** + * Props for the main Scheduler component. + */ +export interface SchedulerProps { + defaultCalendarUrl?: string; +} + +/** + * State for the event modal. + */ +export interface EventModalState { + isOpen: boolean; + mode: "create" | "edit"; + event: Partial | null; + calendarUrl: string; + eventUrl?: string; + etag?: string; +} + +/** + * Form state for the event modal. + */ +export interface EventFormState { + title: string; + description: string; + location: string; + startDateTime: string; + endDateTime: string; + selectedCalendarUrl: string; + isAllDay: boolean; + recurrence: IcsRecurrenceRule | undefined; + showRecurrence: boolean; + showAttendees: boolean; +}