/*
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 { AnchoredCategorySeries } from "./AnchoredCategorySeries";
import { NumericXAxis } from "./NumericXAxis";
import { DependencyProperty } from "igniteui-react-core/ES2015/DependencyProperty";
import { CategoryYAxis } from "./CategoryYAxis";
import { IVerticalAnchoredCategorySeriesInteractionManager_$type } from "./IVerticalAnchoredCategorySeriesInteractionManager";
import { DVContainer } from "igniteui-react-core/ES2015/DVContainer";
import { Type, runOn, typeCast, EnumUtil, markType } from "igniteui-react-core/ES2015/type";
import { Axis } from "./Axis";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-react-core/ES2015/Rect";
import { TrendLineType_$type } from "igniteui-react-core/ES2015/TrendLineType";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { PropertyMetadata } from "igniteui-react-core/ES2015/PropertyMetadata";
import { truncate } from "igniteui-react-core/ES2015/number";
/**
 * @hidden
 */
export class VerticalAnchoredCategorySeries extends AnchoredCategorySeries {
    constructor() {
        super(...arguments);
        this.ps = null;
    }
    hn() {
        super.hn();
        this.xAxis = null;
        this.yAxis = null;
    }
    get pt() {
        if (this.ps == null) {
            this.ps = DVContainer.instance.createInstance(IVerticalAnchoredCategorySeriesInteractionManager_$type, () => this.b2.n);
        }
        return this.ps;
    }
    get_isVertical() {
        return true;
    }
    mz() {
        return this.yAxis;
    }
    nj() {
        return this.xAxis;
    }
    getOffsetValue() {
        return this.m4.r(this.mz(), this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi));
    }
    getCategoryWidth() {
        return this.yAxis.getCategorySize(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi));
    }
    e9(a, b) {
        return this.fa(a, b, this.mz(), runOn(this, this.ny), this.valueColumn);
    }
    fb(a, b) {
        return this.fc(a, b, this.mz(), runOn(this, this.ny), this.valueColumn);
    }
    d6(a, b, c, d, e) {
        if (this.valueColumn == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.d7(a, b, this.yAxis, d, e, this.valueColumn.count, runOn(this, this.ny));
    }
    bd() {
        if (this.be == 0) {
            return 1;
        }
        else {
            return super.bd();
        }
    }
    lp(a) {
        if (!this.hasMarkers || !this.lw()) {
            return Rect.empty;
        }
        return this.pt.e$b(this, this.m0.m, a, runOn(this, this.p1));
    }
    p1(a) {
        return this.or.c5(a);
    }
    dg(a, b) {
        if (this.df(a, b)) {
            return true;
        }
        if (this.lx(a, b)) {
            return true;
        }
        return false;
    }
    ek(a, b, c) {
        if (this.bs == null) {
            return NaN;
        }
        let d = this.getEffectiveViewport1(this.bi);
        let e = this.mz();
        let f = new ScalerParams(0, this.bs.mq, this.bi.br, e.b8, d);
        let g = this.m4.r(e, this.bs.mq, this.bi.br, d);
        return this.em(this.valueColumn, a, e, f, g, runOn(this, this.ny), b, c);
    }
    le(a, b, c) {
        let d = this.mz();
        return this.lg(a, b, c, this.m4.r(d, this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi)), this.nj(), d, null, null, null);
    }
    fetchXAxis() {
        return this.xAxis;
    }
    fetchYAxis() {
        return this.yAxis;
    }
    o9(a) {
        this.xAxis = typeCast(NumericXAxis.$, a);
    }
    pa(a) {
        this.yAxis = typeCast(CategoryYAxis.$, a);
    }
    nu() {
        return this.xAxis != null && this.xAxis.ck();
    }
    mt(a, b) {
        return this.oo(a, b, this.yAxis);
    }
    d8(a) {
        return this.pt.e$a(this, a);
    }
    ny(a) {
        return this.ea(a, this.mz());
    }
    e5(a) {
        return truncate(Math.round(this.d8(a)));
    }
    fm(a) {
        let b = this.e5(a);
        return b >= 0 && this.bz != null && b < this.bz.count ? this.bz.item(b) : null;
    }
    is(a, b, c, d) {
        super.is(a, b, c, d);
        switch (b) {
            case VerticalAnchoredCategorySeries.$$p[0]:
                if (c != d) {
                    this.ht(typeCast(Axis.$, c));
                    this.ix(typeCast(Axis.$, d));
                    this.m8.cn.g(this.er);
                    this.i6(false);
                    this.ic();
                }
                break;
            case VerticalAnchoredCategorySeries.$$p[1]:
                if (c != d) {
                    this.ht(typeCast(Axis.$, c));
                    this.ix(typeCast(Axis.$, d));
                    this.m8.cn.g(this.er);
                    this.nu();
                    this.i6(false);
                    this.ic();
                }
                break;
            case "TrendLineType":
                let e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.or.cy = CategoryTrendLineManagerFactory.a(this.or.cy, this.yAxis, this.jq, this, this.b2);
                }
                break;
        }
    }
    pw(a) {
        if (typeCast(CategoryYAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    pv(a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    get useHighMarkerFidelity() {
        return this.nv;
    }
}
VerticalAnchoredCategorySeries.$t = markType(VerticalAnchoredCategorySeries, 'VerticalAnchoredCategorySeries', AnchoredCategorySeries.$);
Type.dep(DependencyProperty, PropertyMetadata, VerticalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::pz', [NumericXAxis.$, null], 'YAxis::p0', [CategoryYAxis.$, null]]);
