"use strict";
const electron = require("electron");
electron.contextBridge.exposeInMainWorld("electronAPI", {
  signZomeCall: (zomeCall) => electron.ipcRenderer.invoke("sign-zome-call", zomeCall),
  dialogMessagebox: (options) => electron.ipcRenderer.invoke("dialog-messagebox", options),
  installApp: (filePath, appId, networkSeed) => electron.ipcRenderer.invoke("install-app", filePath, appId, networkSeed),
  isAppletDev: () => electron.ipcRenderer.invoke("is-applet-dev"),
  onDeepLinkReceived: (callback) => electron.ipcRenderer.on("deep-link-received", callback),
  onSwitchToApplet: (callback) => electron.ipcRenderer.on("switch-to-applet", callback),
  openApp: (appId) => electron.ipcRenderer.invoke("open-app", appId),
  openAppStore: () => electron.ipcRenderer.invoke("open-appstore"),
  openDevHub: () => electron.ipcRenderer.invoke("open-devhub"),
  getAllAppAssetsInfos: () => electron.ipcRenderer.invoke("get-all-app-assets-infos"),
  getAppletDevPort: (lowerCaseAppletIdB64) => electron.ipcRenderer.invoke("get-applet-dev-port", lowerCaseAppletIdB64),
  getAppletIframeScript: () => electron.ipcRenderer.invoke("get-applet-iframe-script"),
  getAppVersion: () => electron.ipcRenderer.invoke("get-app-version"),
  getInstalledApps: () => electron.ipcRenderer.invoke("get-installed-apps"),
  getConductorInfo: () => electron.ipcRenderer.invoke("get-conductor-info"),
  installAppletBundle: (appId, networkSeed, membraneProofs, agentPubKey, happOrWebHappUrl, distributionInfo, sha256Happ, sha256Ui, sha256Webhapp, metadata) => electron.ipcRenderer.invoke(
    "install-applet-bundle",
    appId,
    networkSeed,
    membraneProofs,
    agentPubKey,
    happOrWebHappUrl,
    distributionInfo,
    sha256Happ,
    sha256Ui,
    sha256Webhapp,
    metadata
  ),
  isDevModeEnabled: () => electron.ipcRenderer.invoke("is-dev-mode-enabled"),
  isMainWindowFocused: () => electron.ipcRenderer.invoke("is-main-window-focused"),
  joinGroup: (networkSeed) => electron.ipcRenderer.invoke("join-group", networkSeed),
  notification: (notification, showInSystray, notifyOS, appletId, appletName) => electron.ipcRenderer.invoke("notification", notification, showInSystray, notifyOS, appletId, appletName),
  enableDevMode: () => electron.ipcRenderer.invoke("enable-dev-mode"),
  disableDevMode: () => electron.ipcRenderer.invoke("disable-dev-mode"),
  fetchIcon: (appActionHashB64) => electron.ipcRenderer.invoke("fetch-icon", appActionHashB64),
  selectScreenOrWindow: () => electron.ipcRenderer.invoke("select-screen-or-window"),
  updateAppletUi: (appId, happOrWebHappUrl, distributionInfo, sha256Happ, sha256Ui, sha256Webhapp) => electron.ipcRenderer.invoke(
    "update-applet-ui",
    appId,
    happOrWebHappUrl,
    distributionInfo,
    sha256Happ,
    sha256Ui,
    sha256Webhapp
  ),
  uninstallApplet: (appId) => electron.ipcRenderer.invoke("uninstall-applet", appId),
  validateHappOrWebhapp: (bytes) => electron.ipcRenderer.invoke("validate-happ-or-webhapp", bytes)
});
