/*
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 { Base, String_$type, typeCast, fromEnum, markType } from "./type";
import { JsonDictionaryParser } from "./JsonDictionaryParser";
import { JsonDictionaryItem } from "./JsonDictionaryItem";
import { JsonDictionaryObject } from "./JsonDictionaryObject";
import { JsonDictionaryArray } from "./JsonDictionaryArray";
import { CodeGenerationLibraryItem } from "./CodeGenerationLibraryItem";
import { List$1 } from "./List$1";
import { Dictionary$2 } from "./Dictionary$2";
/**
 * @hidden
 */
export let CodeGenerationLibrary = /*@__PURE__*/ (() => {
    class CodeGenerationLibrary extends Base {
        constructor() {
            super(...arguments);
            this.f = new List$1(CodeGenerationLibraryItem.$, 0);
            this.e = new Dictionary$2(String_$type, CodeGenerationLibraryItem.$, 0);
        }
        static fromJson(a) {
            let b = new JsonDictionaryParser();
            let c = b.parse(a);
            let d = new CodeGenerationLibrary();
            if (typeCast(JsonDictionaryObject.$, c) !== null) {
                let e = c;
                if (e.g("items")) {
                    let f = typeCast(JsonDictionaryArray.$, e.item("items"));
                    if (f != null) {
                        let i = f.items;
                        for (let h = 0; h < i.length; h++) {
                            let g = i[h];
                            let j = CodeGenerationLibraryItem.a(g);
                            d.f.add(j);
                            d.e.addItem(j.name, j);
                        }
                    }
                }
            }
            return d;
        }
        toJson() {
            let a = new JsonDictionaryObject();
            let b = new JsonDictionaryArray();
            a.item("items", b);
            let c = new List$1(JsonDictionaryItem.$, 0);
            for (let d of fromEnum(this.f)) {
                let e = d.g();
                c.add(e);
            }
            b.items = c.toArray();
            return a.b();
        }
        hasItem(a) {
            return this.e.containsKey(a);
        }
        getKeys() {
            let a = new List$1(String_$type, 0);
            for (let b of fromEnum(this.e.keys)) {
                a.add(b);
            }
            return a.toArray();
        }
        getItem(a) {
            return this.e.item(a);
        }
    }
    CodeGenerationLibrary.$t = markType(CodeGenerationLibrary, 'CodeGenerationLibrary');
    return CodeGenerationLibrary;
})();
