"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IconSetXform = void 0;
const base_xform_1 = require("../../base-xform.js");
const composite_xform_1 = require("../../composite-xform.js");
const cfvo_xform_1 = require("./cfvo-xform.js");
class IconSetXform extends composite_xform_1.CompositeXform {
    constructor() {
        super();
        this.map = {
            cfvo: (this.cfvoXform = new cfvo_xform_1.CfvoXform())
        };
    }
    get tag() {
        return "iconSet";
    }
    render(xmlStream, model) {
        xmlStream.openNode(this.tag, {
            iconSet: base_xform_1.BaseXform.toStringAttribute(model.iconSet, "3TrafficLights"),
            reverse: base_xform_1.BaseXform.toBoolAttribute(model.reverse, false),
            showValue: base_xform_1.BaseXform.toBoolAttribute(model.showValue, true)
        });
        model.cfvo.forEach((cfvo) => {
            this.cfvoXform.render(xmlStream, cfvo);
        });
        xmlStream.closeNode();
    }
    createNewModel({ attributes }) {
        return {
            iconSet: base_xform_1.BaseXform.toStringValue(attributes.iconSet, "3TrafficLights"),
            reverse: base_xform_1.BaseXform.toBoolValue(attributes.reverse),
            showValue: base_xform_1.BaseXform.toBoolValue(attributes.showValue),
            cfvo: []
        };
    }
    onParserClose(name, parser) {
        this.model[name].push(parser.model);
    }
}
exports.IconSetXform = IconSetXform;
