const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('crm', {
  login: data => ipcRenderer.invoke('login', data), bootstrap: user => ipcRenderer.invoke('bootstrap', user),
  customersList: (user, filters) => ipcRenderer.invoke('customers:list', user, filters), customersAdd: (user, data) => ipcRenderer.invoke('customers:add', user, data), customersUpdate: (user, data) => ipcRenderer.invoke('customers:update', user, data), customersDelete: (user, id) => ipcRenderer.invoke('customers:delete', user, id), customersToPublic: (user, id) => ipcRenderer.invoke('customers:toPublic', user, id), publicList: user => ipcRenderer.invoke('public:list', user), publicClaim: (user, id) => ipcRenderer.invoke('public:claim', user, id),
  leadsList: (user, filters) => ipcRenderer.invoke('leads:list', user, filters), leadsAdd: (user, data) => ipcRenderer.invoke('leads:add', user, data), leadsImport: user => ipcRenderer.invoke('leads:import', user), leadsAssign: (user, data) => ipcRenderer.invoke('leads:assign', user, data), leadsClaim: (user, id) => ipcRenderer.invoke('leads:claim', user, id), leadsDeleteBatch: (user, ids) => ipcRenderer.invoke('leads:deleteBatch', user, ids), leadsConvert: (user, id) => ipcRenderer.invoke('leads:convert', user, id),
  companiesList: user => ipcRenderer.invoke('companies:list', user), companiesAdd: (user, data) => ipcRenderer.invoke('companies:add', user, data), companiesUpdate: (user, data) => ipcRenderer.invoke('companies:update', user, data), companiesDelete: (user, id) => ipcRenderer.invoke('companies:delete', user, id), auditList: user => ipcRenderer.invoke('audit:list', user),
  followupsList: (user, id) => ipcRenderer.invoke('followups:list', user, id), followupsAdd: (user, data) => ipcRenderer.invoke('followups:add', user, data),
  contractsList: (user, filters) => ipcRenderer.invoke('contracts:list', user, filters), contractsAdd: (user, data) => ipcRenderer.invoke('contracts:add', user, data), contractsUpdate: (user, data) => ipcRenderer.invoke('contracts:update', user, data), contractsDelete: (user, id) => ipcRenderer.invoke('contracts:delete', user, id), contractsUpdateServices: (user, data) => ipcRenderer.invoke('contracts:updateServices', user, data),
  attachmentsList: (user, id) => ipcRenderer.invoke('attachments:list', user, id), attachmentsAdd: (user, id) => ipcRenderer.invoke('attachments:add', user, id), attachmentsOpen: (user, id) => ipcRenderer.invoke('attachments:open', user, id),
  usersList: user => ipcRenderer.invoke('users:list', user), employeesStats: user => ipcRenderer.invoke('employees:stats', user), usersAdd: (user, data) => ipcRenderer.invoke('users:add', user, data), usersUpdate: (user, data) => ipcRenderer.invoke('users:update', user, data), usersResetPassword: (user, data) => ipcRenderer.invoke('users:resetPassword', user, data), usersTransfer: (user, data) => ipcRenderer.invoke('users:transfer', user, data),
  updateCheck: () => ipcRenderer.invoke('app:updateCheck'), updateOpen: url => ipcRenderer.invoke('app:updateOpen', url),
  getServer: () => ipcRenderer.invoke('app:getServer'), setServer: url => ipcRenderer.invoke('app:setServer', url), ping: () => ipcRenderer.invoke('app:ping'), logout: () => ipcRenderer.invoke('logout'),
  learningList: user => ipcRenderer.invoke('learning:list', user), learningPick: user => ipcRenderer.invoke('learning:pick', user), learningAdd: (user, data) => ipcRenderer.invoke('learning:add', user, data), learningUpdate: (user, data) => ipcRenderer.invoke('learning:update', user, data), learningDelete: (user, id) => ipcRenderer.invoke('learning:delete', user, id), learningDownload: (user, id) => ipcRenderer.invoke('learning:download', user, id),
  info: () => ipcRenderer.invoke('app:info')
});