"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ListPlatformsCommand = void 0;
const helpers = require("../common/helpers");
const yok_1 = require("../common/yok");
class ListPlatformsCommand {
    constructor($platformCommandHelper, $projectData, $logger) {
        this.$platformCommandHelper = $platformCommandHelper;
        this.$projectData = $projectData;
        this.$logger = $logger;
        this.allowedParameters = [];
        this.$projectData.initializeProjectData();
    }
    execute(args) {
        return __awaiter(this, void 0, void 0, function* () {
            const installedPlatforms = this.$platformCommandHelper.getInstalledPlatforms(this.$projectData);
            if (installedPlatforms.length > 0) {
                const preparedPlatforms = this.$platformCommandHelper.getPreparedPlatforms(this.$projectData);
                if (preparedPlatforms.length > 0) {
                    this.$logger.info("The project is prepared for: ", helpers.formatListOfNames(preparedPlatforms, "and"));
                }
                else {
                    this.$logger.info("The project is not prepared for any platform");
                }
                this.$logger.info("Installed platforms: ", helpers.formatListOfNames(installedPlatforms, "and"));
            }
            else {
                const formattedPlatformsList = helpers.formatListOfNames(this.$platformCommandHelper.getAvailablePlatforms(this.$projectData), "and");
                this.$logger.info("Available platforms for this OS: ", formattedPlatformsList);
                this.$logger.info("No installed platforms found. Use $ ns platform add");
            }
        });
    }
}
exports.ListPlatformsCommand = ListPlatformsCommand;
yok_1.injector.registerCommand("platform|*list", ListPlatformsCommand);
//# sourceMappingURL=list-platforms.js.map