"use strict";
const helpers = require("../common/helpers");
class ListPlatformsCommand {
    constructor($platformService, $logger) {
        this.$platformService = $platformService;
        this.$logger = $logger;
        this.allowedParameters = [];
    }
    execute(args) {
        return (() => {
            let installedPlatforms = this.$platformService.getInstalledPlatforms().wait();
            if (installedPlatforms.length > 0) {
                let preparedPlatforms = this.$platformService.getPreparedPlatforms().wait();
                if (preparedPlatforms.length > 0) {
                    this.$logger.out("The project is prepared for: ", helpers.formatListOfNames(preparedPlatforms, "and"));
                }
                else {
                    this.$logger.out("The project is not prepared for any platform");
                }
                this.$logger.out("Installed platforms: ", helpers.formatListOfNames(installedPlatforms, "and"));
            }
            else {
                let formattedPlatformsList = helpers.formatListOfNames(this.$platformService.getAvailablePlatforms().wait(), "and");
                this.$logger.out("Available platforms for this OS: ", formattedPlatformsList);
                this.$logger.out("No installed platforms found. Use $ tns platform add");
            }
        }).future()();
    }
}
exports.ListPlatformsCommand = ListPlatformsCommand;
$injector.registerCommand("platform|*list", ListPlatformsCommand);
