/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { CodeGeneratingComponentRendererModuleEmitter } from "./CodeGeneratingComponentRendererModuleEmitter";
import { Dictionary$2 } from "./Dictionary$2";
import { List$1 } from "./List$1";
import { String_$type, markType } from "./type";
import { stringEndsWith } from "./string";
/**
 * @hidden
 */
var DotNetCodeGeneratingComponentRendererModuleEmitter = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(DotNetCodeGeneratingComponentRendererModuleEmitter, _super);
    function DotNetCodeGeneratingComponentRendererModuleEmitter(a, b, c) {
        var _this = _super.call(this, b, c) || this;
        _this.p = 0;
        _this.s = 0;
        _this.q = false;
        _this.r = new Dictionary$2(String_$type, List$1.$.specialize(String_$type), 0);
        _this.p = a;
        return _this;
    }
    Object.defineProperty(DotNetCodeGeneratingComponentRendererModuleEmitter.prototype, "t", {
        get: function () {
            return this.s;
        },
        enumerable: true,
        configurable: true
    });
    DotNetCodeGeneratingComponentRendererModuleEmitter.prototype.o = function () {
        _super.prototype.o.call(this);
        this.s = 0;
    };
    Object.defineProperty(DotNetCodeGeneratingComponentRendererModuleEmitter.prototype, "u", {
        get: function () {
            switch (this.p) {
                case 0: return "Xam";
                case 4: return "Ultra";
                case 5: return "Igb";
            }
            return "";
        },
        enumerable: true,
        configurable: true
    });
    DotNetCodeGeneratingComponentRendererModuleEmitter.prototype.l = function (a) {
        _super.prototype.l.call(this, a);
        if (a == "withDescriptions" && this.p != 5) {
            this.q = true;
            return;
        }
        var b = "";
        var c = a.split('/');
        if (c.length == 1) {
            b = c[0];
            this.j.addPackageRef(b);
        }
        else {
            this.j.addPackageRef(c[0]);
            b = c[1];
        }
        if (this.q) {
            if (this.s == 0) {
                this.c.k("private ComponentRenderer _componentRenderer = null;");
                this.c.k("public ComponentRenderer Renderer");
                this.c.k("{");
                this.c.h();
                this.c.k("get");
                this.c.k("{");
                this.c.h();
                this.c.k("if (this._componentRenderer == null)");
                this.c.k("{");
                this.c.h();
                this.c.k("this._componentRenderer = new ComponentRenderer();");
                this.c.k("var context = this._componentRenderer.Context;");
            }
            var d = b;
            if (stringEndsWith(d, "Module")) {
                d = d.substr(0, d.length - ("Module").length);
                d += "DescriptionModule";
            }
            this.c.k(d + ".Register(context);");
        }
        this.s++;
    };
    DotNetCodeGeneratingComponentRendererModuleEmitter.prototype.n = function () {
        _super.prototype.n.call(this);
        if (this.q) {
            this.g.addUsing("using Infragistics.Controls.Description;");
            this.c.f();
            this.c.k("}");
            this.c.f();
            this.c.k("return this._componentRenderer;");
            this.c.k("}");
            this.c.f();
            this.c.k("}");
        }
    };
    DotNetCodeGeneratingComponentRendererModuleEmitter.$t = markType(DotNetCodeGeneratingComponentRendererModuleEmitter, 'DotNetCodeGeneratingComponentRendererModuleEmitter', CodeGeneratingComponentRendererModuleEmitter.$);
    return DotNetCodeGeneratingComponentRendererModuleEmitter;
}(CodeGeneratingComponentRendererModuleEmitter));
export { DotNetCodeGeneratingComponentRendererModuleEmitter };
