"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MigrateCommand = void 0;
const yok_1 = require("../common/yok");
class MigrateCommand {
    constructor($devicePlatformsConstants, $migrateController, $staticConfig, $projectData, $logger) {
        this.$devicePlatformsConstants = $devicePlatformsConstants;
        this.$migrateController = $migrateController;
        this.$staticConfig = $staticConfig;
        this.$projectData = $projectData;
        this.$logger = $logger;
        this.allowedParameters = [];
        this.$projectData.initializeProjectData();
    }
    async execute(args) {
        const migrationData = {
            projectDir: this.$projectData.projectDir,
            platforms: [
                this.$devicePlatformsConstants.Android,
                this.$devicePlatformsConstants.iOS,
            ],
        };
        const shouldMigrateResult = await this.$migrateController.shouldMigrate(migrationData);
        if (!shouldMigrateResult) {
            const cliVersion = this.$staticConfig.version;
            this.$logger.printMarkdown(`__Project is compatible with NativeScript \`v${cliVersion}\`__`);
            return;
        }
        await this.$migrateController.migrate(migrationData);
    }
}
exports.MigrateCommand = MigrateCommand;
yok_1.injector.registerCommand("migrate", MigrateCommand);
