"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Templates = void 0;
const tslib_1 = require("tslib");
const fs = (0, tslib_1.__importStar)(require("fs-extra"));
class Templates {
    static getTemplateDescriptor(id) {
        const fileContents = fs.readFileSync(this.templateDir + id + "/tstemplate.json", "utf-8");
        let templateDef = JSON.parse(fileContents);
        if (!templateDef)
            throw new Error("Could not resolve template");
        return templateDef;
    }
    static copyTemplate(id, dest) {
        fs.copySync(this.templateDir + id, dest, { recursive: true });
    }
}
exports.Templates = Templates;
Templates.templateDir = fs.existsSync(__dirname + "/../../static/templates/") ?
    __dirname + "/../../static/templates/" :
    __dirname + "/templates/";
Templates.templatesList = [
    {
        id: "empty",
        name: "Empty Project",
        description: "An empty TokenScript project",
        location: "templates/empty"
    },
    {
        id: "entryToken",
        name: "Entry Token",
        description: "An example of using TokenScript to interact with ioT devices",
        location: "templates/entryToken"
    }
];
