import { type CalendarCreatedBy, type CalendarEvent, type CalendarEventCategory, type CalendarEventCreateInput, type CalendarEventStatus, type CalendarEventUpdateInput, type CalendarFreeSlot, type CalendarOccurrence, type CalendarUpdatedRealtimeEvent } from '@xopcai/gateway-contract'; import { getDefaultTimezone, type NamedAgendaRange } from './recurrence.js'; export declare class CalendarNotFoundError extends Error { readonly code = "CALENDAR_EVENT_NOT_FOUND"; constructor(eventId: string); } export declare class CalendarRevisionConflictError extends Error { readonly code = "CALENDAR_REVISION_CONFLICT"; readonly expectedRevision: number; readonly actualRevision: number; constructor(eventId: string, expectedRevision: number, actualRevision: number); } export declare class CalendarValidationError extends Error { readonly code = "CALENDAR_VALIDATION_ERROR"; constructor(message: string); } export interface CalendarActorMeta { createdBy?: CalendarCreatedBy; conversationId?: string | null; } export interface CalendarListOccurrencesQuery { start: string; end: string; timezone?: string; sources?: string[]; categories?: CalendarEventCategory[]; includeCancelled?: boolean; search?: string; limit?: number; } export interface CalendarSearchQuery { query?: string; start?: string; end?: string; timezone?: string; source?: string; category?: CalendarEventCategory; status?: CalendarEventStatus; includeCancelled?: boolean; limit?: number; } export interface CalendarCheckConflictsInput { startAt: string; endAt: string; timezone?: string; excludeEventId?: string; includeAllDay?: boolean; } export interface CalendarFindFreeSlotsInput { start: string; end: string; timezone?: string; minDurationMinutes?: number; workHoursStart?: string; workHoursEnd?: string; includeAllDayAsBusy?: boolean; } export interface CalendarAgendaInput { range?: NamedAgendaRange; start?: string; end?: string; timezone?: string; includeCancelled?: boolean; } export interface CalendarUpsertResult { action: 'created' | 'updated' | 'unchanged'; event: CalendarEvent; conflicts: CalendarOccurrence[]; } export interface CalendarBatchUpsertResult { created: number; updated: number; unchanged: number; events: CalendarEvent[]; results: Array<{ action: 'created' | 'updated' | 'unchanged'; event: CalendarEvent; conflicts: CalendarOccurrence[]; }>; } export interface CalendarServiceOptions { onCalendarUpdated?: (event: CalendarUpdatedRealtimeEvent) => void; } export declare class CalendarService { private readonly onCalendarUpdated?; constructor(options?: CalendarServiceOptions); private emitUpdated; getEvent(eventId: string): CalendarEvent | null; listSources(): string[]; listEvents(options?: { includeCancelled?: boolean; limit?: number; offset?: number; }): CalendarEvent[]; listOccurrences(query: CalendarListOccurrencesQuery): { occurrences: CalendarOccurrence[]; total: number; sources: string[]; rangeStart: string; rangeEnd: string; }; searchEvents(query: CalendarSearchQuery): CalendarEvent[]; checkConflicts(input: CalendarCheckConflictsInput): CalendarOccurrence[]; findFreeSlots(input: CalendarFindFreeSlotsInput): { slots: CalendarFreeSlot[]; timezone: string; rangeStart: string; rangeEnd: string; }; getAgenda(input?: CalendarAgendaInput): { timezone: string; rangeStart: string; rangeEnd: string; total: number; days: Array<{ date: string; occurrences: CalendarOccurrence[]; }>; conflicts: Array<{ a: string; b: string; }>; }; private buildCreateRecord; createEvent(input: CalendarEventCreateInput, meta?: CalendarActorMeta): { event: CalendarEvent; conflicts: CalendarOccurrence[]; }; private upsertInsideTransaction; upsertEvent(input: CalendarEventCreateInput, meta?: CalendarActorMeta, options?: { dedupeByContent?: boolean; }): CalendarUpsertResult; batchUpsertEvents(items: CalendarEventCreateInput[], meta?: CalendarActorMeta, options?: { dedupeByContent?: boolean; }): CalendarBatchUpsertResult; updateEvent(eventId: string, rawPatch: CalendarEventUpdateInput, meta?: CalendarActorMeta): { event: CalendarEvent; conflicts: CalendarOccurrence[]; }; deleteEvent(eventId: string, options?: { expectedRevision?: number; scope?: 'series' | 'occurrence'; occurrenceDate?: string; }): { deleted: boolean; event?: CalendarEvent; }; } export { getDefaultTimezone };