/*
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 { InformationBase } from "./InformationBase";
import { Dictionary$2 } from "igniteui-angular-core";
import { UserDefinedPropertyType_$type } from "./UserDefinedPropertyType";
import { Base, String_$type, fromEnum, typeCast, markType, Number_$type, Boolean_$type, Array_$type, getInstanceType } from "igniteui-angular-core";
import { DocCoreUtils } from "./DocCoreUtils";
import { List$1 } from "igniteui-angular-core";
import { StringUtilities } from "./StringUtilities";
import { InformationBase_PropertySectionDefinition } from "./InformationBase_PropertySectionDefinition";
import { Guid } from "igniteui-angular-core";
import { InformationBase_PropertyDefinition } from "./InformationBase_PropertyDefinition";
import { VariantUtilities } from "./VariantUtilities";
import { intSToU } from "igniteui-angular-core";
import { arrayGetRank } from "igniteui-angular-core";
/**
 * @hidden
 */
export class DocumentSummaryInformation extends InformationBase {
    constructor() {
        super();
        this.s = null;
        this.u = null;
        this.x = null;
        this.w = null;
        this.ab = DocCoreUtils.ad;
        this.x = new List$1(String_$type, 0);
        this.w = new Dictionary$2(String_$type, Base.$, 2, StringUtilities.f);
        this.u = new Dictionary$2(UserDefinedPropertyType_$type, Base.$, 0);
    }
    get_f() {
        return "d5cdd5022e9c101b939708002b2cf9ae";
    }
    get f() {
        return this.get_f();
    }
    l(a) {
        super.l(a);
        if (this.w.count > 0) {
            let b = new InformationBase_PropertySectionDefinition();
            b.b = new Guid(3, "d5cdd5052e9c101b939708002b2cf9ae");
            a.add(b);
        }
    }
    n(a, b) {
        let c = b.b.toString2("N");
        if (c == "d5cdd5052e9c101b939708002b2cf9ae") {
            this.ab = this.i(a, b);
            for (let d = 0; d < b.d; d++) {
                let e = b.a._inner[d];
                if (e.b != 1) {
                    this.ac(a, e);
                }
            }
        }
        else {
            super.n(a, b);
        }
    }
    p() {
        super.p();
        let a = new List$1(String_$type, 0);
        for (let b of fromEnum(this.w.keys)) {
            a.add(b);
        }
        for (let c of fromEnum(this.w.values)) {
            let d = typeCast(String_$type, c);
            if (d != null) {
                a.add(d);
            }
        }
        this.ab = InformationBase.h(a);
    }
    r(a, b) {
        let c = b.b.toString2("N");
        if (c == "d5cdd5052e9c101b939708002b2cf9ae") {
            b.d = this.w.count + 3;
            b.a = new List$1(InformationBase_PropertyDefinition.$, 0);
            a.c.position += b.d * 8;
            let d = new InformationBase_PropertyDefinition();
            d.a = a.c.position;
            d.b = 0;
            this.ad(a, d);
            b.a.add(d);
            let e = new InformationBase_PropertyDefinition();
            e.a = a.c.position;
            e.b = 1;
            VariantUtilities.f(a, this.ab, DocCoreUtils.q(this.ab));
            b.a.add(e);
            let f = new InformationBase_PropertyDefinition();
            f.a = a.c.position;
            f.b = -2147483648;
            this.ad(a, f);
            b.a.add(f);
            for (let g of fromEnum(this.v)) {
                let h = new InformationBase_PropertyDefinition();
                h.a = a.c.position;
                h.b = g.key;
                VariantUtilities.f(a, this.ab, g.value);
                b.a.add(h);
            }
            for (let i = 0; i < this.x.count; i++) {
                let j = new InformationBase_PropertyDefinition();
                j.a = a.c.position;
                j.b = i + 2;
                this.ad(a, j);
                b.a.add(j);
            }
        }
        else {
            super.r(a, b);
        }
    }
    ac(a, b) {
        a.baseStream.position = b.a;
        switch (b.b) {
            case 0:
                {
                    let c = a.readInt32();
                    this.x = new List$1(String_$type, 2, c);
                    this.w = new Dictionary$2(String_$type, Base.$, 4, c, StringUtilities.f);
                    for (let d = 0; d < this.x.h; d++) {
                        this.x.add(null);
                    }
                    for (let e = 0; e < c; e++) {
                        let f = a.readInt32();
                        this.x._inner[f - 2] = VariantUtilities.c(a, 30, this.ab);
                    }
                    break;
                }
            case 16777218:
            case 16777220:
                this.v.addItem(b.b, VariantUtilities.b(a, this.ab));
                break;
            case -2147483648:
                {
                    VariantUtilities.b(a, this.ab);
                    break;
                }
            default:
                {
                    if ((b.b & 16777216) == 16777216) {
                        this.v.addItem(b.b, VariantUtilities.b(a, this.ab));
                    }
                    else if (b.b - 2 >= 0 && b.b - 2 < this.x.count) {
                        this.w.addItem(this.x._inner[b.b - 2], VariantUtilities.b(a, this.ab));
                    }
                    break;
                }
        }
    }
    ad(a, b) {
        if (b.b == -2147483648) {
            VariantUtilities.g(a, this.ab, intSToU(DocCoreUtils.p), true);
        }
        else if (b.b == 0) {
            a.q(this.x.count);
            for (let c = 0; c < this.x.count; c++) {
                a.q(c + 2);
                VariantUtilities.h(a, 30, this.ab, this.x._inner[c], false);
            }
        }
        else {
            let d = this.w.item(this.x._inner[b.b - 2]);
            VariantUtilities.f(a, this.ab, d);
        }
    }
    get t() {
        if (this.s == null) {
            this.s = new DocumentSummaryInformation_DocumentSummaryInformationProperties(this);
        }
        return this.s;
    }
    get v() {
        return this.u;
    }
}
DocumentSummaryInformation.$t = markType(DocumentSummaryInformation, 'DocumentSummaryInformation', InformationBase.$);
/**
 * @hidden
 */
export class DocumentSummaryInformation_DocumentSummaryInformationProperties extends Base {
    constructor(a) {
        super();
        this.a = null;
        this.a = a;
    }
    static b(a, b) {
        if (1 == a) {
            return false;
        }
        switch (a) {
            case 2:
            case 3:
            case 14:
            case 15: return b == String_$type;
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10: return b == Number_$type;
            case 11:
            case 16: return b == Boolean_$type;
            case 12: return b == Array_$type;
            case 13: return b == Array_$type;
            default: return true;
        }
    }
    static c(a, b) {
        if (1 == a) {
            return false;
        }
        switch (a) {
            case 16777218: return b == String_$type;
            case 16777220: return true;
            default: return true;
        }
    }
    item(a, b) {
        if (arguments.length === 2) {
            let c = a;
            let d = typeCast(Array_$type, b);
            if (DocCoreUtils.e(b) || (d != null && d.length == 0)) {
                if (this.a.b.containsKey(c)) {
                    this.a.b.removeItem(c);
                }
            }
            else {
                if (DocumentSummaryInformation_DocumentSummaryInformationProperties.b(a, getInstanceType(b)) == false) {
                    return;
                }
                if (d != null && arrayGetRank(d) != 1) {
                    return;
                }
                if (this.a.b.containsKey(c)) {
                    this.a.b.item(c, b);
                }
                else {
                    this.a.b.addItem(c, b);
                }
            }
            return b;
        }
        else {
            let b = a;
            if (this.a.b.containsKey(b) == false) {
                return null;
            }
            return this.a.b.item(b);
        }
    }
    item1(a, b) {
        if (arguments.length === 2) {
            let c = typeCast(Array_$type, b);
            if (DocCoreUtils.e(b) || (c != null && c.length == 0)) {
                if (this.a.v.containsKey(a)) {
                    this.a.v.removeItem(a);
                }
            }
            else {
                if (DocumentSummaryInformation_DocumentSummaryInformationProperties.c(a, getInstanceType(b)) == false) {
                    return;
                }
                if (c != null && arrayGetRank(c) != 1) {
                    return;
                }
                this.a.v.item(a, b);
            }
            return b;
        }
        else {
            if (this.a.v.containsKey(a) == false) {
                return null;
            }
            return this.a.v.item(a);
        }
    }
}
DocumentSummaryInformation_DocumentSummaryInformationProperties.$t = markType(DocumentSummaryInformation_DocumentSummaryInformationProperties, 'DocumentSummaryInformation_DocumentSummaryInformationProperties');
//# sourceMappingURL=DocumentSummaryInformation_combined.js.map