"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
const ProjectInfoItem_1 = require("./ProjectInfoItem");
const IProjectItemData_1 = require("../app/IProjectItemData");
const MCWorld_1 = require("../minecraft/MCWorld");
const Log_1 = require("../core/Log");
const IInfoItemData_1 = require("./IInfoItemData");
class WorldItemInfoGenerator {
    constructor() {
        this.id = "WORLD";
        this.title = "World Validation";
    }
    getTopicData(topicId) {
        return {
            title: topicId.toString(),
        };
    }
    summarize(info, infoSet) {
        info.baseGameVersion = infoSet.getFirstStringValue(this.id, 107);
    }
    async generate(projectItem) {
        const items = [];
        if (projectItem.itemType === IProjectItemData_1.ProjectItemType.MCWorld ||
            projectItem.itemType === IProjectItemData_1.ProjectItemType.MCTemplate ||
            projectItem.itemType === IProjectItemData_1.ProjectItemType.worldFolder) {
            let mcworld = await MCWorld_1.default.ensureOnItem(projectItem);
            if (!mcworld) {
                Log_1.default.debugAlert("Could not find respective world.");
                return items;
            }
            await mcworld.load(false);
            items.push(new ProjectInfoItem_1.default(IInfoItemData_1.InfoItemType.info, this.id, 101, "Beta APIs experiment", projectItem, mcworld.betaApisExperiment, mcworld.name));
            items.push(new ProjectInfoItem_1.default(IInfoItemData_1.InfoItemType.info, this.id, 102, "Data Driven Items experiment", projectItem, mcworld.dataDrivenItemsExperiment, mcworld.name));
            items.push(new ProjectInfoItem_1.default(IInfoItemData_1.InfoItemType.info, this.id, 103, "Deferred Technical Preview experiment", projectItem, mcworld.deferredTechnicalPreviewExperiment, mcworld.name));
            if (mcworld.manifest && mcworld.manifest.header && mcworld.manifest.header.base_game_version) {
                let val = mcworld.manifest.header.base_game_version;
                if (val.join) {
                    val = val.join(".");
                }
                val = val.toString();
                items.push(new ProjectInfoItem_1.default(IInfoItemData_1.InfoItemType.info, this.id, 107, "Base game version", projectItem, val, mcworld.name));
                items.push(new ProjectInfoItem_1.default(IInfoItemData_1.InfoItemType.info, "WORLD", 108, "Name", projectItem, mcworld.manifest.header.name, mcworld.name));
                items.push(new ProjectInfoItem_1.default(IInfoItemData_1.InfoItemType.info, "WORLD", 109, "Description", projectItem, mcworld.manifest.header.description, mcworld.name));
            }
        }
        return items;
    }
}
exports.default = WorldItemInfoGenerator;

//# sourceMappingURL=../maps/info/WorldItemInfoGenerator.js.map
