"use strict";
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();
    }
    async execute(args) {
        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);
