"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstallExtensionCommand = void 0;
const yok_1 = require("../../common/yok");
class InstallExtensionCommand {
    constructor($extensibilityService, $stringParameterBuilder, $logger) {
        this.$extensibilityService = $extensibilityService;
        this.$stringParameterBuilder = $stringParameterBuilder;
        this.$logger = $logger;
        this.allowedParameters = [
            this.$stringParameterBuilder.createMandatoryParameter("You have to provide a valid name for extension that you want to install."),
        ];
    }
    async execute(args) {
        const extensionData = await this.$extensibilityService.installExtension(args[0]);
        this.$logger.info(`Successfully installed extension ${extensionData.extensionName}.`);
        await this.$extensibilityService.loadExtension(extensionData.extensionName);
        this.$logger.info(`Successfully loaded extension ${extensionData.extensionName}.`);
    }
}
exports.InstallExtensionCommand = InstallExtensionCommand;
yok_1.injector.registerCommand("extension|install", InstallExtensionCommand);
