"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ProjectUtilities_1 = require("../app/ProjectUtilities");
const Utilities_1 = require("../core/Utilities");
const IProjectInfoData_1 = require("./IProjectInfoData");
const ProjectInfoSet_1 = require("./ProjectInfoSet");
class ProjectInfoUtilities {
    static getTitleFromEnum(categoryEnum, topicId) {
        if (categoryEnum[topicId]) {
            return Utilities_1.default.humanifyJsName(categoryEnum[topicId]);
        }
        if (topicId === 0) {
            return "Test Failure";
        }
        else if (topicId === 1) {
            return "Test Success";
        }
        else if (topicId === 2) {
            return "Test Not Applicable";
        }
        return "General Item " + topicId;
    }
    static async getDerivedStates(project, pisData) {
        const isAddon = await ProjectUtilities_1.default.getIsAddon(project);
        const derivedStates = [];
        if (isAddon) {
            const pisAddon = new ProjectInfoSet_1.default(project, IProjectInfoData_1.ProjectInfoSuite.cooperativeAddOn);
            await pisAddon.generateForProject();
            const projectSet = {
                projectContainerName: project.containerName,
                projectPath: project.projectFolder?.storageRelativePath,
                projectName: project.name,
                projectTitle: project.title,
                infoSetData: pisAddon.getDataObject(),
                suite: IProjectInfoData_1.ProjectInfoSuite.cooperativeAddOn,
            };
            derivedStates.push(projectSet);
        }
        const pisSharing = new ProjectInfoSet_1.default(project, IProjectInfoData_1.ProjectInfoSuite.sharing);
        await pisSharing.generateForProject();
        const sharing = {
            projectContainerName: project.containerName,
            projectPath: project.projectFolder?.storageRelativePath,
            projectName: project.name,
            projectTitle: project.title,
            infoSetData: pisSharing.getDataObject(),
            suite: IProjectInfoData_1.ProjectInfoSuite.cooperativeAddOn,
        };
        derivedStates.push(sharing);
        const shouldRunPlatformVersion = pisData.info["CWave"] !== undefined;
        if (shouldRunPlatformVersion) {
            const pisPlatforMVersion = new ProjectInfoSet_1.default(project, IProjectInfoData_1.ProjectInfoSuite.currentPlatformVersions);
            await pisPlatforMVersion.generateForProject();
            const projectSet = {
                projectContainerName: project.containerName,
                projectPath: project.projectFolder?.storageRelativePath,
                projectName: project.name,
                projectTitle: project.title,
                infoSetData: pisPlatforMVersion.getDataObject(),
                suite: IProjectInfoData_1.ProjectInfoSuite.currentPlatformVersions,
            };
            derivedStates.push(projectSet);
        }
        return derivedStates;
    }
}
exports.default = ProjectInfoUtilities;

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