"use strict";
class LivesyncCommand {
    constructor($logger, $usbLiveSyncService, $mobileHelper, $options, $platformService, $errors) {
        this.$logger = $logger;
        this.$usbLiveSyncService = $usbLiveSyncService;
        this.$mobileHelper = $mobileHelper;
        this.$options = $options;
        this.$platformService = $platformService;
        this.$errors = $errors;
        this.allowedParameters = [];
    }
    execute(args) {
        this.$platformService.deployPlatform(args[0]).wait();
        return this.$usbLiveSyncService.liveSync(args[0]);
    }
    canExecute(args) {
        return (() => {
            if (args.length >= 2) {
                this.$errors.fail("Invalid number of arguments.");
            }
            let platform = args[0];
            if (platform) {
                return _.includes(this.$mobileHelper.platformNames, this.$mobileHelper.normalizePlatformName(platform)) && this.$platformService.validateOptions(args[0]).wait();
            }
            else {
                return this.$platformService.validateOptions().wait();
            }
        }).future()();
    }
}
exports.LivesyncCommand = LivesyncCommand;
$injector.registerCommand("livesync", LivesyncCommand);
