/*
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 { Base, typeCast, EnumUtil, markType } from "./type";
import { CodeGenerationLibraryItemPlatform_$type } from "./CodeGenerationLibraryItemPlatform";
import { CodeGenerationLibraryItemContentLocation_$type } from "./CodeGenerationLibraryItemContentLocation";
import { JsonDictionaryObject } from "./JsonDictionaryObject";
import { JsonDictionaryValue } from "./JsonDictionaryValue";
import { JsonDictionaryArray } from "./JsonDictionaryArray";
/**
 * @hidden
 */
var CodeGenerationLibraryItemContentConfiguration = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(CodeGenerationLibraryItemContentConfiguration, _super);
    function CodeGenerationLibraryItemContentConfiguration() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this._platform = 0;
        _this._location = 0;
        return _this;
    }
    Object.defineProperty(CodeGenerationLibraryItemContentConfiguration.prototype, "platform", {
        get: function () {
            return this._platform;
        },
        set: function (a) {
            this._platform = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CodeGenerationLibraryItemContentConfiguration.prototype, "location", {
        get: function () {
            return this._location;
        },
        set: function (a) {
            this._location = a;
        },
        enumerable: true,
        configurable: true
    });
    CodeGenerationLibraryItemContentConfiguration.a = function (a) {
        var b = typeCast(JsonDictionaryObject.$, a);
        if (b == null) {
            return null;
        }
        var c = new CodeGenerationLibraryItemContentConfiguration();
        c.platform = 10;
        if (b.g("platform")) {
            var d = b.item("platform");
            c.platform = CodeGenerationLibraryItemContent.c(d);
        }
        c.location = 0;
        if (b.g("location")) {
            var e = b.item("location");
            c.location = CodeGenerationLibraryItemContentConfiguration.c(e);
        }
        return c;
    };
    CodeGenerationLibraryItemContentConfiguration.c = function (a) {
        var b = a.value;
        var c;
        if (((function () { var d = EnumUtil.tryParse$1(CodeGenerationLibraryItemContentLocation_$type, b, true, c); c = d.p2; return d.ret; })())) {
            return c;
        }
        return 0;
    };
    CodeGenerationLibraryItemContentConfiguration.prototype.e = function () {
        var _this = this;
        var a = new JsonDictionaryObject();
        a.item("platform", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 2;
            $ret.value = EnumUtil.getName(CodeGenerationLibraryItemPlatform_$type, _this.platform);
            return $ret;
        })()));
        a.item("location", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 2;
            $ret.value = EnumUtil.getName(CodeGenerationLibraryItemContentLocation_$type, _this.location);
            return $ret;
        })()));
        return a;
    };
    CodeGenerationLibraryItemContentConfiguration.$t = markType(CodeGenerationLibraryItemContentConfiguration, 'CodeGenerationLibraryItemContentConfiguration');
    return CodeGenerationLibraryItemContentConfiguration;
}(Base));
export { CodeGenerationLibraryItemContentConfiguration };
/**
 * @hidden
 */
var CodeGenerationLibraryItemContent = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(CodeGenerationLibraryItemContent, _super);
    function CodeGenerationLibraryItemContent() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this._platform = 0;
        _this._content = null;
        _this._isJson = false;
        _this._isAsync = false;
        _this._configs = null;
        return _this;
    }
    Object.defineProperty(CodeGenerationLibraryItemContent.prototype, "platform", {
        get: function () {
            return this._platform;
        },
        set: function (a) {
            this._platform = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CodeGenerationLibraryItemContent.prototype, "content", {
        get: function () {
            return this._content;
        },
        set: function (a) {
            this._content = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CodeGenerationLibraryItemContent.prototype, "isJson", {
        get: function () {
            return this._isJson;
        },
        set: function (a) {
            this._isJson = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CodeGenerationLibraryItemContent.prototype, "isAsync", {
        get: function () {
            return this._isAsync;
        },
        set: function (a) {
            this._isAsync = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CodeGenerationLibraryItemContent.prototype, "configs", {
        get: function () {
            return this._configs;
        },
        set: function (a) {
            this._configs = a;
        },
        enumerable: true,
        configurable: true
    });
    CodeGenerationLibraryItemContent.b = function (a) {
        var b = new CodeGenerationLibraryItemContent();
        if (typeCast(JsonDictionaryObject.$, a) !== null) {
            var c = a;
            if (c.g("platform")) {
                var d = c.item("platform");
                b.platform = CodeGenerationLibraryItemContent.c(d);
            }
            if (c.g("content")) {
                var e = c.item("content");
                b.content = e.value;
            }
            if (c.g("isJson")) {
                var f = c.item("isJson");
                b.isJson = f.value;
            }
            if (c.g("isAsync")) {
                var g = c.item("isAsync");
                b.isAsync = g.value;
            }
            if (c.g("configs")) {
                var h = c.item("configs");
                if (h != null && h.items != null && h.items.length > 0) {
                    var i = new Array(h.items.length);
                    for (var j = 0; j < h.items.length; j++) {
                        var k = h.items[j];
                        if (k != null) {
                            var l = CodeGenerationLibraryItemContentConfiguration.a(k);
                            i[j] = l;
                        }
                    }
                    b.configs = i;
                }
            }
        }
        return b;
    };
    CodeGenerationLibraryItemContent.prototype.e = function () {
        var _this = this;
        var a = new JsonDictionaryObject();
        a.item("platform", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 2;
            $ret.value = EnumUtil.getName(CodeGenerationLibraryItemPlatform_$type, _this.platform);
            return $ret;
        })()));
        a.item("content", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 2;
            $ret.value = _this.content;
            return $ret;
        })()));
        a.item("isJson", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 1;
            $ret.value = _this.isJson;
            return $ret;
        })()));
        a.item("isAsync", ((function () {
            var $ret = new JsonDictionaryValue();
            $ret.e = 1;
            $ret.value = _this.isAsync;
            return $ret;
        })()));
        if (this.configs != null && this.configs.length > 0) {
            a.item("configs", new JsonDictionaryArray());
            var b = new Array(this.configs.length);
            for (var c = 0; c < this.configs.length; c++) {
                var d = this.configs[c].e();
                b[c] = d;
            }
            a.item("configs").items = b;
        }
        return a;
    };
    CodeGenerationLibraryItemContent.c = function (a) {
        var b = a.value;
        var c;
        if (((function () { var d = EnumUtil.tryParse$1(CodeGenerationLibraryItemPlatform_$type, b, true, c); c = d.p2; return d.ret; })())) {
            return c;
        }
        return 12;
    };
    CodeGenerationLibraryItemContent.$t = markType(CodeGenerationLibraryItemContent, 'CodeGenerationLibraryItemContent');
    return CodeGenerationLibraryItemContent;
}(Base));
export { CodeGenerationLibraryItemContent };
