import Store from "electron-store";

const store = new Store({
  defaults: {
    settings: {
      runOnStartup: true,
      filepaths: [],
      ppcFilePath: null,
      emsOutFilePath: null,
      qbFilePath: "",
      runWatcherOnStartup: true,
      enableMemDebug: false,
      polling: {
        enabled: false,
        interval: 30000,
      },
    },
    app: {
      windowBounds: {
        width: 800,
        height: 600,
        x: undefined,
        y: undefined,
      },
      user: null,
      isTest: false,
      bodyshop: {},
      masterdata: {
        opcodes: null,
      },
    },
  },
});

// store.onDidAnyChange((newValue, oldValue) => {
//   const mainWindow = BrowserWindow.getAllWindows()[0];
//   mainWindow?.webContents.send(ipcTypes.toRenderer.store.didChange, newValue);
// });

export default store;
