import { app, ipcMain, shell } from "electron";

ipcMain.handle("ipcCore:getCoreVersion", () => {
    return app.getVersion();
});

ipcMain.handle("ipcCore:getArch", () => {
    return process.arch;
})

ipcMain.handle("ipcCore:getUserDir", () => {
    const userDir = app.getPath("userData");
    return userDir;
});

ipcMain.handle("ipcCore:getAppPath", () => {
    return app.getAppPath();
});

ipcMain.handle("ipcCore:getDownloadsPath", () => {
    return app.getPath("downloads");
});

ipcMain.handle('ipcCore:showItemInFolder', (_, fullPath: string) => {
    shell.showItemInFolder(fullPath);
});

ipcMain.handle('ipcCore:openExternal', (_, url: string) => {
    shell.openExternal(url);
});

ipcMain.handle('ipcCore:getPlatform', () => { 
    return process.platform;
});