import { BusyStatus, ICalendarItemBase } from "./Common"; export type EventStatus = "CONFIRMED" | "TENTATIVE" | "CANCELLED"; /** * - SINGLE: a normal non-recurring event * - SERIES_MASTER: the recurring master * - SERIES_OVERRIDE: an exception/override for one occurrence */ export type EventDocKind = "SINGLE" | "SERIES_MASTER" | "SERIES_OVERRIDE"; export interface IRecurrence { /** * iCal RRULE compatible with Google: * e.g. "FREQ=WEEKLY;BYDAY=MO,WE;INTERVAL=1" */ rrule: string; /** Optional expansion limit (alternative to COUNT in RRULE). */ until?: Date; /** Excluded occurrences (EXDATE). */ exDates?: Date[]; /** Additional occurrences (RDATE). */ rDates?: Date[]; /** Event timezone (strongly recommended). */ timeZone: string; } export interface IRecurrenceOverride { /** Link to master series. */ masterId: string; /** * Occurrence key: original start time of the occurrence as generated from the master. * This aligns with how Google identifies instances via originalStartTime. */ originalStartAt: Date; /** What happens to that occurrence. */ action: "MODIFY" | "CANCEL"; /** When MODIFY: patch fields to override. */ patch?: Partial>; } export interface ICalendarEvent extends ICalendarItemBase { kind: "EVENT"; /** Document kind for recurrence handling. */ docKind: EventDocKind; allDay: boolean; /** * Use startAt/endAt for time range. * If allDay=true, recommended convention: * - startAt at 00:00 in recurrence.timeZone * - endAt exclusive (next day 00:00) for single-day all-day */ startAt: Date; endAt: Date; /** Should it block availability? */ busyStatus?: BusyStatus; status?: EventStatus; /** * Recurrence definition, only for docKind="SERIES_MASTER" */ recurrence?: IRecurrence; /** * Override definition, only for docKind="SERIES_OVERRIDE" */ override?: IRecurrenceOverride; }