export interface IElectronAPI {
  platform: NodeJS.Platform;
  getToken: () => Promise<string | null>;
  setToken: (token: string) => Promise<boolean>;
  removeToken: () => Promise<boolean>;
  loginSuccess: (token: string) => void;
  logout: () => void;

  // Database operations
  generateEncryptionKey: (userId: string) => Promise<{ success: boolean; key?: string; error?: string }>;
  getUserEncryptionKey: (userId: string) => Promise<string | null>;
  setUserEncryptionKey: (userId: string, encryptionKey: string) => Promise<boolean>;
  dbInitialize: (userId: string, encryptionKey: string) => Promise<{ success: boolean; error?: string }>;
  dbGetBooks: () => Promise<{ success: boolean; data?: any[]; error?: string }>;
  dbGetBook: (bookId: string) => Promise<{ success: boolean; data?: any; error?: string }>;
  dbSaveBook: (book: any, authorId?: string) => Promise<{ success: boolean; error?: string }>;
  dbDeleteBook: (bookId: string) => Promise<{ success: boolean; error?: string }>;
  dbSaveChapter: (chapter: any, bookId: string, contentId?: string) => Promise<{ success: boolean; error?: string }>;
  dbGetCharacters: (bookId: string) => Promise<{ success: boolean; data?: any[]; error?: string }>;
  dbSaveCharacter: (character: any, bookId: string) => Promise<{ success: boolean; error?: string }>;
  dbGetConversations: (bookId: string) => Promise<{ success: boolean; data?: any[]; error?: string }>;
  dbSaveConversation: (conversation: any, bookId: string) => Promise<{ success: boolean; error?: string }>;
  dbGetSyncStatus: () => Promise<{ success: boolean; data?: any[]; error?: string }>;
  dbGetPendingChanges: (limit?: number) => Promise<{ success: boolean; data?: any[]; error?: string }>;
}

declare global {
  interface Window {
    electron: IElectronAPI;
  }
}

export {};
