/**
 * penguins-eggs
 * lib: select_user_swap.ts
 * author: Piero Proietti
 * email: piero.proietti@gmail.com
 * license: MIT
 */
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const inquirer = require('inquirer');
// import inquirer  from 'inquirer'
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
async function selectUserSwapChoice() {
    let partitions = {};
    if (node_fs_1.default.existsSync('/etc/calamares/modules/partition.conf')) {
        partitions = js_yaml_1.default.load(node_fs_1.default.readFileSync('/etc/calamares/modules/partition.conf', 'utf-8'));
    }
    else {
        partitions.userSwapChoices = ['none', 'small', 'suspend', 'file'];
        partitions.initialSwapChoice = 'small';
    }
    const questions = [
        {
            type: 'list',
            name: 'userSwapChoices',
            message: 'Select the swap choice',
            choices: partitions.userSwapChoices,
            default: partitions.initialSwapChoice,
        },
    ];
    return new Promise(function (resolve) {
        inquirer.prompt(questions).then(function (options) {
            resolve(options.userSwapChoices);
        });
    });
}
exports.default = selectUserSwapChoice;
