const { ipcMain } = require("electron");
//const { app } = require("electron");
const log = require("electron-log");
//const Nucleus = require("nucleus-nodejs");
const { default: ipcTypes } = require("../src/ipc.types.commonjs");

// Nucleus.init("5f91b569b95bac34eefdb63a", {
//   disableInDev: true,
//   debug: false,
//   version: app.getVersion(),
// });

// Nucleus.setProps({
//   version: app.getVersion(),
// });

// Nucleus.onError = (type, err) => {
//   log.error(err);
//   // type will either be uncaughtException, unhandledRejection or windowError
// };

ipcMain.on(ipcTypes.app.toMain.setUserName, (event, userName) => {
//  Nucleus.setUserId(userName);
//  Nucleus.appStarted();
});

ipcMain.on(ipcTypes.app.toMain.track, (e, args) => {
  log.log("NUCLEUS Event", args);
 // const { event, ...eventDetails } = args;
  try {
  ////  Nucleus.track(event, eventDetails);
  } catch (error) {
    log.error(error);
  }
});
