const { contextBridge, ipcRenderer } = require('electron');

contextBridge.exposeInMainWorld('electronAPI', {
  loadData: () => ipcRenderer.invoke('load-data'),
  saveData: (json) => ipcRenderer.send('save-data', json),
  openExternal: (url) => ipcRenderer.send('open-external', url),
  exportBackup: (json, suggestedName) => ipcRenderer.invoke('export-backup', json, suggestedName),
  exportTextFile: (content, suggestedName, ext, description) =>
    ipcRenderer.invoke('export-text-file', content, suggestedName, ext, description),
  googleOAuthAuthorize: (params) => ipcRenderer.invoke('google-oauth-authorize', params),
  googleOAuthRefresh: (params) => ipcRenderer.invoke('google-oauth-refresh', params)
});
