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

contextBridge.exposeInMainWorld('electronAPI', {
    writeFile: (fileName, content) => ipcRenderer.invoke('write-file', fileName, content),
    readFile: (fileName) => ipcRenderer.invoke('read-file', fileName),
    deleteFile: (fileName) => ipcRenderer.invoke('delete-file', fileName),
    changeContent: (nextPage) => ipcRenderer.invoke('change-content', nextPage),
    showAlert: (message) => ipcRenderer.invoke('show-alert', message),
    closeAlertWindow: () => ipcRenderer.send('close-alert-window'),
    openBackupDirDialog: () => ipcRenderer.invoke('open-backup-dir-dialog'),
    openFileDialog: () => ipcRenderer.invoke('open-file-dialog'),
    checkFileExists: (fileName) => ipcRenderer.invoke('check-file-exists', fileName)
});