"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tryInstall = exports.remove = void 0;
const tslib_1 = require("tslib");
const pacman_1 = tslib_1.__importDefault(require("../../pacman"));
/**
 *
 * @param distro
 * @returns yaml-string
 */
function remove(distro) {
    const packages = [
        'arco-calamares-git',
        'calamares-eggs',
        'calamares-git',
        'calamares',
    ];
    if (distro.familyId === 'archlinux') {
        packages.push('penguins-eggs');
    }
    if (distro.familyId === 'debian') {
        packages.push('eggs');
    }
    let yaml = '';
    for (const elem of packages) {
        yaml += `  - ${elem.trim()}\n`;
    }
    if (yaml !== '') {
        yaml = '- try_remove:\n' + yaml;
    }
    return yaml;
}
exports.remove = remove;
/**
 *
 * @param distro
 * @returns yaml-string
 */
function tryInstall(distro) {
    let yaml = '';
    /**
     * Depending on the distro
     */
    if (distro.distroLike === 'Ubuntu') {
        yaml += '  - language-pack-$LOCALE\n';
    }
    // Da localizzare se presenti
    if (pacman_1.default.packageIsInstalled('hunspell')) {
        yaml += '  - hunspell-$LOCALE\n';
    }
    if (pacman_1.default.packageIsInstalled('libreoffice-base-core')) {
        yaml += '  - libreoffice-l10n-$LOCALE\n';
        yaml += '  - libreoffice-help-$LOCALE\n';
    }
    if (pacman_1.default.packageIsInstalled('firefox-esr')) {
        yaml += '  - firefox-esr-$LOCALE\n';
    }
    if (pacman_1.default.packageIsInstalled('firefox')) {
        yaml += '  - firefox-$LOCALE\n';
    }
    if (pacman_1.default.packageIsInstalled('thunderbird')) {
        yaml += '  - thunderbird-locale-$LOCALE\n';
    }
    if (yaml !== '') {
        yaml = '- try_install:\n' + yaml;
    }
    return yaml;
}
exports.tryInstall = tryInstall;
