"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActionsTerminalUI = void 0;
//#region imports
const lib_1 = require("tnp-core/lib");
const lib_2 = require("tnp-helpers/lib");
//#endregion
class ActionsTerminalUI extends lib_2.BaseCliWorkerTerminalUI {
    async headerText() {
        return 'Actions Worker';
    }
    textHeaderStyle() {
        return 'block';
    }
    getWorkerTerminalActions(options) {
        //#region @backendFunc
        const myActions = {
            getStuffFromBackend: {
                name: 'Get stuff from backend',
                action: async () => {
                    lib_1.Helpers.info(`Stuff from backend will be fetched`);
                    const ctrl = await this.worker.getControllerForRemoteConnection();
                    const list = (await ctrl.getEntities().request())?.body.json || [];
                    console.log(list.map(c => `- ${c.id} ${c.description}`).join('\n'));
                    lib_1.Helpers.info(`Fetched ${list.length} entities`);
                    await lib_1.UtilsTerminal.pressAnyKeyToContinueAsync({
                        message: 'Press any key to go back to main menu',
                    });
                },
            },
        };
        return {
            ...this.chooseAction,
            ...myActions,
            ...super.getWorkerTerminalActions({ ...options, chooseAction: false }),
        };
        //#endregion
    }
}
exports.ActionsTerminalUI = ActionsTerminalUI;
//# sourceMappingURL=actions.terminal-ui.js.map