"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
const BlockCube_1 = require("../minecraft/BlockCube");
const Structure_1 = require("../minecraft/Structure");
class ProjectContent {
    static getItemName(name) {
        name = name.trim();
        name = name.replace(/ /gi, "");
        if (name.length > 3 && name.charAt(0) >= "A" && name.charAt(0) <= "Z") {
            name = name[0].toLowerCase() + name.substring(1, name.length);
        }
        return name;
    }
    static getDefaultTestJavaScript(projectName, testName) {
        let content = ProjectContent.defaultTestJavaScript;
        content = this.replaceCommonItems(content, projectName);
        content = content.replace(/basicTest/gi, ProjectContent.getItemName(testName));
        return content;
    }
    static getDefaultTestTypeScript(projectName, testName) {
        let content = ProjectContent.defaultTestJavaScript;
        content = content.replace("(test)", "(test : gt.Test)");
        content = this.replaceCommonItems(content, projectName);
        content = content.replace(/basicTest/gi, ProjectContent.getItemName(testName));
        return content;
    }
    static getEmptyTestJavaScript(projectName, testName) {
        let content = ProjectContent.emptyTestJavaScript;
        content = this.replaceCommonItems(content, projectName);
        content = content.replace(/basicTest/gi, ProjectContent.getItemName(testName));
        return content;
    }
    static getEmptyTestTypeScript(projectName, testName) {
        let content = ProjectContent.emptyTestJavaScript;
        content = content.replace("(test)", "(test : gt.Helper)");
        content = this.replaceCommonItems(content, projectName);
        content = content.replace(/basicTest/gi, ProjectContent.getItemName(testName));
        return content;
    }
    static replaceCommonItems(content, projectName) {
        return content.replace('"MyProject"', '"' + ProjectContent.getItemName(projectName) + '"');
    }
    static getEmptyActionSet(projectName, testName) {
        const content = ProjectContent.emptyActionSet;
        return content;
    }
    static getEmptyWorldTest(projectName, testName) {
        const content = ProjectContent.emptyActionSet;
        return content;
    }
    static getEmptyJavaScript(projectName, testName) {
        let content = ProjectContent.emptyJavaScript;
        content = content.replace("myFunction", ProjectContent.getItemName(projectName) + "Action");
        return content;
    }
    static getEmptyTypeScript(projectName, testName) {
        return this.getEmptyJavaScript(projectName, testName);
    }
    static generateDefaultStructure() {
        const structure = new Structure_1.default();
        const cube = new BlockCube_1.default();
        cube.setMaxDimensions(8, 8, 8);
        structure.cube = cube;
        cube.fillY("minecraft:dirt", 0);
        cube.fillEmpty("minecraft:glass", 0, 1, 0, 7, 7, 7);
        return structure.getMCStructureBytes();
    }
}
exports.default = ProjectContent;
ProjectContent.defaultTestJavaScript = `import { Test } from "@minecraft/server-gametest";
import { world, system } from "@minecraft/server";
        
function basicTest(test) {
    const zoglinEntityType = "zoglin";
    const skeletonEntityType = "skeleton";
        
    test.spawn(zoglinEntityType, { x: 2, y: 2, z: 3});
    test.spawn(skeletonEntityType, { x: 5, y: 2, z: 3});
    
    test.succeedWhen( ()=> {
            test.assertEntityPresentInArea(skeletonEntityType, false);
        }
    );
}
        
gt.register("MyProject", "basicTest", basicTest).structureName("gametests:basic");     
`;
ProjectContent.emptyTestJavaScript = `import { Test } from "@minecraft/server-gametest";
import { world, system } from "@minecraft/server";
        
function basicTest(test) {

}
        
gt.register("MyProject", "basicTest", basicTest).structureName("gametests:basic");     
`;
ProjectContent.emptyJavaScript = `import { world, system } from "@minecraft/server";
        
function myFunction() 
{

}
`;
ProjectContent.emptyActionSet = `{
}
`;
ProjectContent.emptyWorldTest = `{
}
`;

//# sourceMappingURL=../maps/app/ProjectContent.js.map
