/*
    ! /startup/index.js — Central Bootloader Module
    ? Main entry point for initializing the application (with splash screen)
*/

module.exports = async () => {

    // $ create splash screen
    // ?? Usage: "splash.update(processINT, messageSTRING, staticBOOLEAN)" to update the splash screen and "splash.close()" to close the splash screen
    const splash = await require('./screen/init')(); // execute electron initialization script
    splash.update(0, "Starting"); // update splash screen via ipc
    await new Promise(resolve => setTimeout(resolve, 3500)); // set 3.5 second waiting timer

    // % load node dependencies
    // ?? Usage: "npm.packageName" (e.g. npm.express)
    splash.update(0, "Loading Packages"); // update splash screen via ipc
    const npm = require('./modules/nodeDependencies'); // execute nodejs initialization script
    await new Promise(resolve => setTimeout(resolve, 1500)); // set 1.5 second waiting timer

    // % load directories
    // ?? Usage: "dir.dirName" (e.g. dir.coreDir)
    splash.update(0, "Loading Directories"); // update splash screen via ipc
    await new Promise(resolve => setTimeout(resolve, 1500)); // set 1.5 second waiting timer
    const dir = await require('./modules/directoryDependencies')(splash, npm); // execute directory initialization script

};
