import {
  ChatMessage,
  ProposedEventChange,
  ExpandedEvent,
  CalendarEvent,
} from "@calchat/shared";

export interface AIContext {
  userId: string;
  conversationHistory: ChatMessage[];
  currentDate: Date;
  // Callback to load events from a specific date range
  // Returns ExpandedEvent[] with occurrenceStart/occurrenceEnd for recurring events
  fetchEventsInRange: (
    startDate: Date,
    endDate: Date,
  ) => Promise<ExpandedEvent[]>;
  // Callback to search events by title
  searchEvents: (query: string) => Promise<CalendarEvent[]>;
  // Callback to fetch a single event by ID
  fetchEventById: (eventId: string) => Promise<CalendarEvent | null>;
}

export interface AIResponse {
  content: string;
  proposedChanges?: ProposedEventChange[];
}

export interface AIProvider {
  processMessage(message: string, context: AIContext): Promise<AIResponse>;
}
