export type CalendarProvider = 'google' | 'microsoft' | 'apple';
export type CalendarConnectionStatus = 'connected' | 'disconnected' | 'error';

export interface CalendarSelection {
  id: string;
  name: string;
  checkConflicts: boolean;
  writeTarget: boolean;
}

export interface CalendarConnection {
  id: string;
  provider: CalendarProvider;
  email: string;
  calendars: CalendarSelection[];
  status: CalendarConnectionStatus;
  lastSyncedAt: string | null;
}

export interface CalendarConnectionListResponse {
  data: CalendarConnection[];
}

export interface CalendarEventItem {
  id: string;
  title: string;
  start: string;
  end: string;
  calendarId: string;
  calendarName: string | null;
  allDay: boolean;
  /** App booking vs external provider event */
  source?: 'calendar' | 'booking';
  guestName?: string | null;
  status?: string | null;
}

export interface CalendarEventsResponse {
  data: CalendarEventItem[];
}

export interface ConnectAppleRequest {
  appleId: string;
  appSpecificPassword: string;
}

export interface UpdateCalendarConnectionRequest {
  calendars: Pick<CalendarSelection, 'id' | 'checkConflicts' | 'writeTarget'>[];
}
