/**
 * penguins-eggs
 * lib: select_filesystem_type.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');
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
async function selectFileSystemType() {
    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.defaultFileSystemType = 'ext4';
    }
    const questions = [
        {
            type: 'list',
            name: 'fileSystemChoices',
            message: 'Select file system tyèe',
            choices: ['btrfs', 'ext', 'ext2', 'ext3', 'ext4', 'ReiserFS', 'Reiser4', 'zfs'],
            default: partitions.defaultFileSystemType,
        },
    ];
    return new Promise(function (resolve) {
        inquirer.prompt(questions).then(function (options) {
            resolve(options.fileSystemChoices);
        });
    });
}
exports.default = selectFileSystemType;
