"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParsedNgTemplate = void 0;
const interface_1 = require("./interface");
class ParsedNgTemplate {
    constructor(node, parent, index) {
        this.node = node;
        this.parent = parent;
        this.index = index;
        this.kind = interface_1.NgNodeKind.Template;
        this.children = [];
    }
    appendNgNodeChild(child) {
        this.children.push(child);
    }
    getTemplateName() {
        if (this.node.references && this.node.references.length) {
            return this.node.references[0].name;
        }
        else {
            return `ngDefault_${this.index}`;
        }
    }
    getNodeMeta() {
        const directive = this.getTemplateName();
        const meta = {
            kind: interface_1.NgNodeKind.Template,
            children: this.children.map((child) => child.getNodeMeta()),
            index: this.index,
            defineTemplateName: directive,
        };
        return meta;
    }
}
exports.ParsedNgTemplate = ParsedNgTemplate;
