"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 });
const path = require("path");
const yok_1 = require("../../yok");
class Wp8EmulatorServices {
    static get programFilesPath() {
        return process.arch === "x64"
            ? process.env["PROGRAMFILES(X86)"]
            : process.env.ProgramFiles;
    }
    constructor($logger, $childProcess) {
        this.$logger = $logger;
        this.$childProcess = $childProcess;
    }
    getEmulatorId() {
        return __awaiter(this, void 0, void 0, function* () {
            return "";
        });
    }
    getRunningEmulator(image) {
        return __awaiter(this, void 0, void 0, function* () {
            return null;
        });
    }
    getRunningEmulatorImageIdentifier(emulatorId) {
        return __awaiter(this, void 0, void 0, function* () {
            return null;
        });
    }
    getRunningEmulatorIds() {
        return __awaiter(this, void 0, void 0, function* () {
            return [];
        });
    }
    startEmulator() {
        return __awaiter(this, void 0, void 0, function* () {
            return null;
        });
    }
    runApplicationOnEmulator(app, emulatorOptions) {
        return __awaiter(this, void 0, void 0, function* () {
            this.$logger.info("Starting Windows Phone Emulator");
            const emulatorStarter = this.getPathToEmulatorStarter();
            this.$childProcess
                .spawn(emulatorStarter, ["/installlaunch", app, "/targetdevice:xd"], {
                stdio: "ignore",
                detached: true,
            })
                .unref();
        });
    }
    getEmulatorImages() {
        return __awaiter(this, void 0, void 0, function* () {
            return { devices: [], errors: [] };
        });
    }
    getRunningEmulators() {
        return __awaiter(this, void 0, void 0, function* () {
            return [];
        });
    }
    getRunningEmulatorName() {
        return __awaiter(this, void 0, void 0, function* () {
            return "";
        });
    }
    getPathToEmulatorStarter() {
        return path.join(Wp8EmulatorServices.programFilesPath, Wp8EmulatorServices.WP8_LAUNCHER_PATH, Wp8EmulatorServices.WP8_LAUNCHER);
    }
}
Wp8EmulatorServices.WP8_LAUNCHER = "XapDeployCmd.exe";
Wp8EmulatorServices.WP8_LAUNCHER_PATH = "Microsoft SDKs\\Windows Phone\\v8.0\\Tools\\XAP Deployment";
yok_1.injector.register("wp8EmulatorServices", Wp8EmulatorServices);
