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

contextBridge.exposeInMainWorld("sirayaPrinter", {
  getConfig: () => ipcRenderer.invoke("get-config"),
  getServiceStatus: () => ipcRenderer.invoke("get-service-status"),
  startService: () => ipcRenderer.invoke("service-start"),
  stopService: () => ipcRenderer.invoke("service-stop"),
  restartService: () => ipcRenderer.invoke("service-restart"),
  runSetup: () => ipcRenderer.invoke("run-setup"),
  openExternal: (url) => ipcRenderer.invoke("open-external", url),
  getServiceUrl: () => ipcRenderer.invoke("get-service-url"),
  onSetupProgress: (cb) => {
    ipcRenderer.on("setup-progress", (_, msg) => cb(msg));
  },
});
