"use strict";
class DeployOnDeviceCommand {
    constructor($platformService, $platformCommandParameter, $options, $errors, $mobileHelper) {
        this.$platformService = $platformService;
        this.$platformCommandParameter = $platformCommandParameter;
        this.$options = $options;
        this.$errors = $errors;
        this.$mobileHelper = $mobileHelper;
        this.allowedParameters = [];
    }
    execute(args) {
        return this.$platformService.deployPlatform(args[0]);
    }
    canExecute(args) {
        return (() => {
            if (!args || !args.length || args.length > 1) {
                return false;
            }
            if (!this.$platformCommandParameter.validate(args[0]).wait()) {
                return false;
            }
            if (this.$mobileHelper.isAndroidPlatform(args[0]) && this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) {
                this.$errors.fail("When producing a release build, you need to specify all --key-store-* options.");
            }
            return true;
        }).future()();
    }
}
exports.DeployOnDeviceCommand = DeployOnDeviceCommand;
$injector.registerCommand("deploy", DeployOnDeviceCommand);
