// Calendar type definitions // Time period view types (how much time to display) export type ViewPeriod = 'day' | 'week' | 'month'; // Calendar mode types (how to organize the data) export type CalendarMode = 'date' | 'resource'; // Legacy aliases for backwards compatibility export type DateViewType = ViewPeriod; export type ViewType = DateViewType; export type CalendarView = ViewType; export type CalendarType = CalendarMode; export type SyncStatus = 'synced' | 'pending' | 'error'; export interface Resource { name: string; displayName: string; avatarUrl: string; employeeId: string; events: CalendarEvent[]; } export interface ResourceCalendarData { date: string; resources: Resource[]; } export interface RenderContext { container: HTMLElement; startDate: Date; endDate: Date; } export interface CalendarEvent { id: string; title: string; start: string; // ISO 8601 end: string; // ISO 8601 type: string; // Flexible event type - can be any string value allDay: boolean; syncStatus: SyncStatus; // Resource information (only present in resource calendar mode) resource?: { name: string; displayName: string; employeeId: string; }; recurringId?: string; metadata?: Record; } export interface CalendarConfig { // Scrollbar styling scrollbarWidth: number; // Width of scrollbar in pixels scrollbarColor: string; // Scrollbar thumb color scrollbarTrackColor: string; // Scrollbar track color scrollbarHoverColor: string; // Scrollbar thumb hover color scrollbarBorderRadius: number; // Border radius for scrollbar thumb // Interaction settings allowDrag: boolean; allowResize: boolean; allowCreate: boolean; // API settings apiEndpoint: string; dateFormat: string; timeFormat: string; // Feature flags enableSearch: boolean; enableTouch: boolean; // Event defaults defaultEventDuration: number; // Minutes minEventDuration: number; // Minutes maxEventDuration: number; // Minutes } export interface EventLogEntry { type: string; detail: any; timestamp: number; } export interface ListenerEntry { eventType: string; handler: EventListener; options?: AddEventListenerOptions; } export interface IEventBus { on(eventType: string, handler: EventListener, options?: AddEventListenerOptions): () => void; once(eventType: string, handler: EventListener): () => void; off(eventType: string, handler: EventListener): void; emit(eventType: string, detail?: any): boolean; getEventLog(eventType?: string): EventLogEntry[]; setDebug(enabled: boolean): void; destroy(): void; } export interface GridPosition { minutes: number; time: string; y: number; } export interface Period { start: string; end: string; mode?: CalendarMode; // Optional: which calendar mode this period is for } export interface EventData { events: CalendarEvent[]; meta: { start: string; end: string; total: number; mode?: CalendarMode; // Which calendar mode this data is for }; } /** * Context interfaces for different calendar modes */ export interface DateModeContext { mode: 'date'; currentWeek: Date; period: ViewPeriod; weekDays: number; firstDayOfWeek: number; } export interface ResourceModeContext { mode: 'resource'; selectedDate: Date; resources: Resource[]; maxResources: number; } /** * Union type for type-safe mode contexts */ export type CalendarModeContext = DateModeContext | ResourceModeContext;