/*
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 { __extends, __values } from "tslib";
import { Base, fromEnum, markType, EnumUtil } from "./type";
import { List$1 } from "./List$1";
import { JsonDictionaryObject } from "./JsonDictionaryObject";
import { JsonDictionaryArray } from "./JsonDictionaryArray";
import { JsonDictionaryValue } from "./JsonDictionaryValue";
import { TypeDescriptionWellKnownType_$type } from "./TypeDescriptionWellKnownType";
/**
 * @hidden
 */
var ComponentRendererMethodHelperBuilder = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ComponentRendererMethodHelperBuilder, _super);
    function ComponentRendererMethodHelperBuilder(a) {
        var _this = _super.call(this) || this;
        _this.e = null;
        _this.d = new List$1(ComponentRendererMethodHelperArgumentBuilder.$, 0);
        _this.b = null;
        _this.e = a;
        return _this;
    }
    ComponentRendererMethodHelperBuilder.prototype.argument = function () {
        var a = new ComponentRendererMethodHelperArgumentBuilder(this);
        this.d.add(a);
        return a;
    };
    ComponentRendererMethodHelperBuilder.prototype.$return = function () {
        var a = new ComponentRendererMethodHelperReturnBuilder(this);
        this.b = a;
        return a;
    };
    ComponentRendererMethodHelperBuilder.prototype.build = function () {
        var e_1, _a;
        var _this = this;
        var a = new JsonDictionaryObject();
        var b = new JsonDictionaryArray();
        a.item("args", b);
        var c = new Array(this.d.count);
        var d = 0;
        try {
            for (var _b = __values(fromEnum(this.d)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var e = _c.value;
                c[d] = e.r();
                d++;
            }
        }
        catch (e_1_1) {
            e_1 = { error: e_1_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_1)
                    throw e_1.error;
            }
        }
        b.items = c;
        a.item("methodName", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 2;
            $ret.value = _this.e;
            return $ret;
        })()));
        if (this.b == null) {
            this.$return().asVoid();
        }
        a.item("return", this.b.r());
        return a.b();
    };
    ComponentRendererMethodHelperBuilder.$t = markType(ComponentRendererMethodHelperBuilder, 'ComponentRendererMethodHelperBuilder');
    return ComponentRendererMethodHelperBuilder;
}(Base));
export { ComponentRendererMethodHelperBuilder };
/**
 * @hidden
 */
var ComponentRendererMethodHelperArgumentBuilder = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ComponentRendererMethodHelperArgumentBuilder, _super);
    function ComponentRendererMethodHelperArgumentBuilder(a) {
        var _this = _super.call(this) || this;
        _this.o = null;
        _this.s = 0;
        _this.v = null;
        _this.u = null;
        _this.t = null;
        _this.q = null;
        _this.o = a;
        return _this;
    }
    ComponentRendererMethodHelperArgumentBuilder.prototype.argument = function () {
        return this.o.argument();
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.$return = function () {
        return this.o.$return();
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.build = function () {
        return this.o.build();
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.asInt = function (a) {
        this.s = 1;
        this.v = null;
        this.u = "int";
        this.q = ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 0;
            $ret.value = a;
            return $ret;
        })());
        return this;
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.asDouble = function (a) {
        this.s = 1;
        this.v = null;
        this.u = "double";
        this.q = ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 0;
            $ret.value = a;
            return $ret;
        })());
        return this;
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.asShort = function (a) {
        this.s = 1;
        this.v = null;
        this.u = "short";
        this.q = ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 0;
            $ret.value = a;
            return $ret;
        })());
        return this;
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.asLong = function (a) {
        this.s = 1;
        this.v = null;
        this.u = "long";
        this.q = ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 0;
            $ret.value = a;
            return $ret;
        })());
        return this;
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.asFloat = function (a) {
        this.s = 1;
        this.v = null;
        this.u = "float";
        this.q = ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 0;
            $ret.value = a;
            return $ret;
        })());
        return this;
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.asEnum = function (a, b) {
        this.s = 8;
        this.v = a.typeName;
        this.u = "string";
        if (b == null) {
            this.q = ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 3;
                $ret.value = null;
                return $ret;
            })());
        }
        else {
            this.q = ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 2;
                $ret.value = b.toString();
                return $ret;
            })());
        }
        return this;
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.asString = function (a) {
        this.s = 2;
        this.v = null;
        this.u = "string";
        if (a == null) {
            this.q = ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 3;
                $ret.value = null;
                return $ret;
            })());
        }
        else {
            this.q = ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 2;
                $ret.value = a;
                return $ret;
            })());
        }
        return this;
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.asPublicTypeRef = function (a, b) {
        this.s = 8;
        this.v = a;
        this.u = a;
        if (b == null) {
            this.q = ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 3;
                $ret.value = null;
                return $ret;
            })());
        }
        else {
            var c = new JsonDictionaryObject();
            c.item("refType", ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 2;
                $ret.value = "name";
                return $ret;
            })()));
            c.item("id", ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 2;
                $ret.value = b.name;
                return $ret;
            })()));
            this.q = c;
        }
        return this;
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.asPoint = function (a) {
        this.s = 11;
        this.v = null;
        this.u = null;
        var b = new JsonDictionaryObject();
        b.item("x", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 0;
            $ret.value = a.x;
            return $ret;
        })()));
        b.item("y", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 0;
            $ret.value = a.y;
            return $ret;
        })()));
        this.q = b;
        return this;
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.asSize = function (a) {
        this.s = 12;
        this.v = null;
        this.u = null;
        var b = new JsonDictionaryObject();
        b.item("width", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 0;
            $ret.value = a.width;
            return $ret;
        })()));
        b.item("height", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 0;
            $ret.value = a.height;
            return $ret;
        })()));
        this.q = b;
        return this;
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.asRect = function (a) {
        this.s = 14;
        this.v = null;
        this.u = null;
        var b = new JsonDictionaryObject();
        b.item("left", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 0;
            $ret.value = a.left;
            return $ret;
        })()));
        b.item("top", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 0;
            $ret.value = a.top;
            return $ret;
        })()));
        b.item("width", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 0;
            $ret.value = a.width;
            return $ret;
        })()));
        b.item("height", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 0;
            $ret.value = a.height;
            return $ret;
        })()));
        this.q = b;
        return this;
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.asMethodRef = function (a) {
        this.s = 18;
        this.v = null;
        this.u = null;
        var b = new JsonDictionaryObject();
        b.item("refType", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 2;
            $ret.value = "name";
            return $ret;
        })()));
        b.item("id", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 2;
            $ret.value = a;
            return $ret;
        })()));
        this.q = b;
        return this;
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.asBool = function (a) {
        this.s = 2;
        this.v = null;
        this.u = "boolean";
        this.q = ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 1;
            $ret.value = a;
            return $ret;
        })());
        return this;
    };
    ComponentRendererMethodHelperArgumentBuilder.prototype.r = function () {
        var _this = this;
        var a = new JsonDictionaryObject();
        a.item("knownType", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 2;
            $ret.value = EnumUtil.getName(TypeDescriptionWellKnownType_$type, _this.s);
            return $ret;
        })()));
        if (this.v != null) {
            a.item("specificType", ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 2;
                $ret.value = _this.v;
                return $ret;
            })()));
        }
        if (this.u != null) {
            a.item("specificExternalType", ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 2;
                $ret.value = _this.u;
                return $ret;
            })()));
        }
        if (this.t != null) {
            a.item("collectionElementType", ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 2;
                $ret.value = _this.t;
                return $ret;
            })()));
        }
        if (this.q != null) {
            a.item("value", this.q);
        }
        else {
            a.item("value", ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 3;
                return $ret;
            })()));
        }
        return a;
    };
    ComponentRendererMethodHelperArgumentBuilder.$t = markType(ComponentRendererMethodHelperArgumentBuilder, 'ComponentRendererMethodHelperArgumentBuilder');
    return ComponentRendererMethodHelperArgumentBuilder;
}(Base));
export { ComponentRendererMethodHelperArgumentBuilder };
/**
 * @hidden
 */
var ComponentRendererMethodHelperReturnBuilder = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ComponentRendererMethodHelperReturnBuilder, _super);
    function ComponentRendererMethodHelperReturnBuilder(a) {
        var _this = _super.call(this) || this;
        _this.b = null;
        _this.s = 0;
        _this.v = null;
        _this.u = null;
        _this.t = null;
        _this.b = a;
        return _this;
    }
    ComponentRendererMethodHelperReturnBuilder.prototype.argument = function () {
        return this.b.argument();
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.$return = function () {
        return this.b.$return();
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.build = function () {
        return this.b.build();
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asInt = function () {
        this.s = 1;
        this.v = null;
        this.u = "int";
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asDouble = function () {
        this.s = 1;
        this.v = null;
        this.u = "double";
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asShort = function () {
        this.s = 1;
        this.v = null;
        this.u = "short";
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asLong = function () {
        this.s = 1;
        this.v = null;
        this.u = "long";
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asFlout = function () {
        this.s = 1;
        this.v = null;
        this.u = "float";
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asEnum = function (a) {
        this.s = 8;
        this.v = a.typeName;
        this.u = "string";
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asString = function () {
        this.s = 2;
        this.v = null;
        this.u = "string";
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asPublicTypeRef = function (a) {
        this.s = 8;
        this.v = a;
        this.u = a;
        var b = new JsonDictionaryObject();
        b.item("refType", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 2;
            $ret.value = "name";
            return $ret;
        })()));
        b.item("id", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 2;
            $ret.value = "name";
            return $ret;
        })()));
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asPoint = function () {
        this.s = 11;
        this.v = null;
        this.u = null;
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asSize = function () {
        this.s = 12;
        this.v = null;
        this.u = null;
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asRect = function () {
        this.s = 14;
        this.v = null;
        this.u = null;
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asMethodRef = function () {
        this.s = 18;
        this.v = null;
        this.u = null;
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asBool = function () {
        this.s = 7;
        this.v = null;
        this.u = "boolean";
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.r = function () {
        var _this = this;
        var a = new JsonDictionaryObject();
        a.item("knownType", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 2;
            $ret.value = EnumUtil.getName(TypeDescriptionWellKnownType_$type, _this.s);
            return $ret;
        })()));
        if (this.v != null) {
            a.item("specificType", ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 2;
                $ret.value = _this.v;
                return $ret;
            })()));
        }
        if (this.u != null) {
            a.item("specificExternalType", ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 2;
                $ret.value = _this.u;
                return $ret;
            })()));
        }
        if (this.t != null) {
            a.item("collectionElementType", ((function () {
                var $ret = new JsonDictionaryValue();
                $ret.e = 2;
                $ret.value = _this.t;
                return $ret;
            })()));
        }
        return a;
    };
    ComponentRendererMethodHelperReturnBuilder.prototype.asVoid = function () {
        this.s = 0;
        this.v = null;
        this.u = null;
        return this;
    };
    ComponentRendererMethodHelperReturnBuilder.$t = markType(ComponentRendererMethodHelperReturnBuilder, 'ComponentRendererMethodHelperReturnBuilder');
    return ComponentRendererMethodHelperReturnBuilder;
}(Base));
export { ComponentRendererMethodHelperReturnBuilder };
