"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MultiTemplateComponent = void 0;
class MultiTemplateComponent {
    get templates() {
        // TODO: prop-full
        const templates = [];
        this.templatesMap.forEach((value, key, map) => {
            templates.push(this.getTemplate(key));
        });
        return templates;
    }
    constructor(testType, templatesMap) {
        this.testType = testType;
        this.templatesMap = templatesMap;
        this.groupPriority = 0;
    }
    create(c) {
        return new c();
    }
    /**
     * Create a Template for a specific editor
     * @param template Template id/type to use from mapping, e.g. "text-editor"
     */
    makeTemplate(template) {
        let mapItem;
        let result;
        if (this.templatesMap.has(template)) {
            mapItem = this.templatesMap.get(template);
            result = this.create(this.testType);
            result.id = template;
            result.name = mapItem.name;
            result.description = mapItem.widget + " template";
            //result["widget"] = mapItem.widget;
            result["mapItem"] = mapItem;
        }
        return result;
    }
    getTemplate(id) {
        return this.makeTemplate(id);
    }
}
exports.MultiTemplateComponent = MultiTemplateComponent;
