/*
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.q = 0;
        _this.t = 0;
        _this.r = false;
        _this.s = new Dictionary$2(String_$type, List$1.$.specialize(String_$type), 0);
        _this.q = a;
        return _this;
    }
    Object.defineProperty(DotNetCodeGeneratingComponentRendererModuleEmitter.prototype, "u", {
        get: function () {
            return this.t;
        },
        enumerable: true,
        configurable: true
    });
    DotNetCodeGeneratingComponentRendererModuleEmitter.prototype.p = function () {
        _super.prototype.p.call(this);
        this.t = 0;
    };
    Object.defineProperty(DotNetCodeGeneratingComponentRendererModuleEmitter.prototype, "v", {
        get: function () {
            switch (this.q) {
                case 0: return "Xam";
                case 4: return "Ultra";
                case 5: return "Igb";
            }
            return "";
        },
        enumerable: true,
        configurable: true
    });
    DotNetCodeGeneratingComponentRendererModuleEmitter.prototype.m = function (a, b, c) {
        _super.prototype.m.call(this, a, b, c);
        if (b == "withDescriptions" && this.q != 5) {
            this.r = true;
            return;
        }
        var d = "";
        var e = b.split('/');
        if (e.length == 1) {
            d = e[0];
            this.j.addPackageRef(d);
        }
        else {
            this.j.addPackageRef(e[0]);
            d = e[1];
        }
        if (this.r) {
            if (this.t == 0) {
                this.c.l("private ComponentRenderer _componentRenderer = null;");
                this.c.l("public ComponentRenderer Renderer");
                this.c.l("{");
                this.c.h();
                this.c.l("get");
                this.c.l("{");
                this.c.h();
                this.c.l("if (this._componentRenderer == null)");
                this.c.l("{");
                this.c.h();
                this.c.l("this._componentRenderer = new ComponentRenderer();");
                this.c.l("var context = this._componentRenderer.Context;");
            }
            var f = d;
            if (stringEndsWith(f, "Module")) {
                f = f.substr(0, f.length - ("Module").length);
                f += "DescriptionModule";
            }
            this.c.l(f + ".Register(context);");
        }
        this.t++;
    };
    DotNetCodeGeneratingComponentRendererModuleEmitter.prototype.o = function () {
        _super.prototype.o.call(this);
        if (this.r) {
            this.g.addUsing("using Infragistics.Controls.Description;");
            this.c.f();
            this.c.l("}");
            this.c.f();
            this.c.l("return this._componentRenderer;");
            this.c.l("}");
            this.c.f();
            this.c.l("}");
        }
    };
    DotNetCodeGeneratingComponentRendererModuleEmitter.$t = markType(DotNetCodeGeneratingComponentRendererModuleEmitter, 'DotNetCodeGeneratingComponentRendererModuleEmitter', CodeGeneratingComponentRendererModuleEmitter.$);
    return DotNetCodeGeneratingComponentRendererModuleEmitter;
}(CodeGeneratingComponentRendererModuleEmitter));
export { DotNetCodeGeneratingComponentRendererModuleEmitter };
