import { ipcMain } from 'electron';
import { getMainWindow } from '../window/create-window';

export function setupWindowControlHandlers(): void {
  ipcMain.on('window-minimize', () => {
    getMainWindow()?.minimize();
  });

  ipcMain.on('window-maximize', () => {
    const win = getMainWindow();

    if (win?.isMaximized())
      win.unmaximize();
    else
      win?.maximize();
  });

  ipcMain.on('window-close', () => {
    getMainWindow()?.close();
  });
}
