import { delegateCombine, delegateRemove } from "igniteui-react-core/ES2015/type";
import { IgrNumericYAxis } from "./igr-numeric-y-axis";
import { CategoryTransitionInMode_$type } from "./CategoryTransitionInMode";
import { AssigningCategoryStyleEventArgs } from "./igr-assigning-category-style-event-args";
import { FinancialEventArgs } from "./igr-financial-event-args";
import { IgrSeries } from "./igr-series";
import { ensureBool, brushToString, stringToBrush, ensureEnum, toPoint, fromPoint } from "igniteui-react-core/ES2015/componentUtil";
/**
 * Represents the base class for all financial indicator and overlay series.
*/
export class IgrFinancialSeries extends IgrSeries {
    constructor(props) {
        super(props);
        this._assigningCategoryStyle = null;
        this._assigningCategoryStyle_wrapped = null;
        this._typical = null;
        this._typical_wrapped = null;
        this._typicalBasedOn = null;
        this._typicalBasedOn_wrapped = null;
    }
    get i() {
        return this._implementation;
    }
    /**
     * Gets whether the current series is a financial type series.
    */
    get isFinancial() {
        return this.i.cr;
    }
    /**
     * Gets or sets the brush to use for negative portions of the series.
    */
    get negativeBrush() {
        return brushToString(this.i.o5);
    }
    set negativeBrush(v) {
        this.i.o5 = stringToBrush(v);
    }
    /**
     * Gets or sets the effective x-axis for the current FinancialSeries object.
    */
    get xAxis() {
        if (this.i.lz == null) {
            return null;
        }
        return this.i.lz.externalObject;
    }
    set xAxis(v) {
        v == null ? this.i.lz = null : this.i.lz = v.i;
    }
    /**
     * Gets or sets the effective y-axis for the current FinancialSeries object.
    */
    get yAxis() {
        if (this.i.mk == null) {
            return null;
        }
        if (!this.i.mk.externalObject) {
            let e = new IgrNumericYAxis(null);
            e._implementation = this.i.mk;
            this.i.mk.externalObject = e;
        }
        return this.i.mk.externalObject;
    }
    set yAxis(v) {
        v == null ? this.i.mk = null : this.i.mk = v.i;
    }
    /**
     * Gets or sets the open mapping property for the current series object.
    */
    get openMemberPath() {
        return this.i.of;
    }
    set openMemberPath(v) {
        this.i.of = v;
    }
    /**
     * Gets or sets the high mapping property for the current series object.
    */
    get highMemberPath() {
        return this.i.n6;
    }
    set highMemberPath(v) {
        this.i.n6 = v;
    }
    /**
     * Gets or sets the low mapping property for the current series object.
    */
    get lowMemberPath() {
        return this.i.ob;
    }
    set lowMemberPath(v) {
        this.i.ob = v;
    }
    /**
     * Gets or sets the close mapping property for the current series object.
    */
    get closeMemberPath() {
        return this.i.n3;
    }
    set closeMemberPath(v) {
        this.i.n3 = v;
    }
    /**
     * Gets or sets the volume mapping property for the current series object.
    */
    get volumeMemberPath() {
        return this.i.oj;
    }
    set volumeMemberPath(v) {
        this.i.oj = v;
    }
    /**
     * Gets or sets whether this category series should allow custom style overrides of its individual visuals.
    */
    get isCustomCategoryStyleAllowed() {
        return this.i.m5;
    }
    set isCustomCategoryStyleAllowed(v) {
        this.i.m5 = ensureBool(v);
    }
    /**
     * Gets or sets the method by which to animate the data into the chart when the chart data source is swapped.
     * Note: Transitions are not currently supported for stacked series.
    */
    get transitionInMode() {
        return this.i.l9;
    }
    set transitionInMode(v) {
        this.i.l9 = ensureEnum(CategoryTransitionInMode_$type, v);
    }
    /**
     * Gets or sets whether the series should transition into the plot area when a new data source is assigned.
     * Note: Transitions are not currently supported for stacked series.
    */
    get isTransitionInEnabled() {
        return this.i.m6;
    }
    set isTransitionInEnabled(v) {
        this.i.m6 = ensureBool(v);
    }
    /**
     * Overridden by derived series classes to indicate when negative colors are supported or not.
    */
    get isNegativeColorSupported() {
        return this.i.cz;
    }
    getPreviousOrExactIndex(world, skipUnknowns) {
        let iv = this.i.fa(toPoint(world), skipUnknowns);
        return (iv);
    }
    getNextOrExactIndex(world, skipUnknowns) {
        let iv = this.i.e8(toPoint(world), skipUnknowns);
        return (iv);
    }
    /**
     * Returns the offset value for this series if grouped on a category axis.
    
    */
    getOffsetValue() {
        let iv = this.i.getOffsetValue();
        return (iv);
    }
    /**
     * Returns the width of the category grouping this series is in.
    
    */
    getCategoryWidth() {
        let iv = this.i.getCategoryWidth();
        return (iv);
    }
    getSeriesValuePosition(world, useInterpolation, skipUnknowns) {
        let iv = this.i.lc(toPoint(world), useInterpolation, skipUnknowns);
        return fromPoint(iv);
    }
    getSeriesValue(world, useInterpolation, skipUnknowns) {
        let iv = this.i.ej(toPoint(world), useInterpolation, skipUnknowns);
        return (iv);
    }
    getSeriesHighValue(world, useInterpolation, skipUnknowns) {
        let iv = this.i.ef(toPoint(world), useInterpolation, skipUnknowns);
        return (iv);
    }
    getSeriesLowValue(world, useInterpolation, skipUnknowns) {
        let iv = this.i.eh(toPoint(world), useInterpolation, skipUnknowns);
        return (iv);
    }
    getSeriesCloseValue(world, useInterpolation, skipUnknowns) {
        let iv = this.i.nr(toPoint(world), useInterpolation, skipUnknowns);
        return (iv);
    }
    getSeriesOpenValue(world, useInterpolation, skipUnknowns) {
        let iv = this.i.ns(toPoint(world), useInterpolation, skipUnknowns);
        return (iv);
    }
    getSeriesVolumeValue(world, useInterpolation, skipUnknowns) {
        let iv = this.i.nt(toPoint(world), useInterpolation, skipUnknowns);
        return (iv);
    }
    getSeriesHighValuePosition(world, useInterpolation, skipUnknowns) {
        let iv = this.i.k8(toPoint(world), useInterpolation, skipUnknowns);
        return fromPoint(iv);
    }
    getSeriesLowValuePosition(world, useInterpolation, skipUnknowns) {
        let iv = this.i.la(toPoint(world), useInterpolation, skipUnknowns);
        return fromPoint(iv);
    }
    getSeriesOpenValuePosition(world, useInterpolation, skipUnknowns) {
        let iv = this.i.o7(toPoint(world), useInterpolation, skipUnknowns);
        return fromPoint(iv);
    }
    getSeriesCloseValuePosition(world, useInterpolation, skipUnknowns) {
        let iv = this.i.o6(toPoint(world), useInterpolation, skipUnknowns);
        return fromPoint(iv);
    }
    getSeriesVolumeValuePosition(world, useInterpolation, skipUnknowns) {
        let iv = this.i.o8(toPoint(world), useInterpolation, skipUnknowns);
        return fromPoint(iv);
    }
    /**
     * Determine if object can be used as YAxis
    
    * @param axis  * The object to check
    */
    canUseAsYAxis(axis) {
        let iv = this.i.m1(axis);
        return (iv);
    }
    /**
     * Determine if object can be used as XAxis
    
    * @param axis  * The object to check
    */
    canUseAsXAxis(axis) {
        let iv = this.i.m0(axis);
        return (iv);
    }
    /**
     * Gets the precise item index, if possible, based on the closeness to the previous or next whole integer. If the series cannot provide this information, GetExactItemIndex will return the same integer value as GetItemIndex.
    
    * @param world  * The world position for which to return the index.
    */
    getExactItemIndex(world) {
        let iv = this.i.d7(toPoint(world));
        return (iv);
    }
    /**
     * Gets the index of the item that resides at the provided world coordinates.
    
    * @param world  * The world coordinates of the requested item.
    */
    getItemIndex(world) {
        let iv = this.i.e4(toPoint(world));
        return (iv);
    }
    /**
     * Gets the item that is the best match for the specified world coordinates.
    
    * @param world  * The world coordinates to use.
    */
    getItem(world) {
        let iv = this.i.fl(toPoint(world));
        return (iv);
    }
    setNegativeColors(negativeBrush, negativeOutline) {
        this.i.i9(stringToBrush(negativeBrush), stringToBrush(negativeOutline));
    }
    /**
     * Event raised when Assigning Category Style
    */
    get assigningCategoryStyle() {
        return this._assigningCategoryStyle;
    }
    set assigningCategoryStyle(ev) {
        if (this._assigningCategoryStyle_wrapped !== null) {
            this.i.assigningCategoryStyle = delegateRemove(this.i.assigningCategoryStyle, this._assigningCategoryStyle_wrapped);
            this._assigningCategoryStyle_wrapped = null;
            this._assigningCategoryStyle = null;
        }
        this._assigningCategoryStyle = ev;
        this._assigningCategoryStyle_wrapped = (o, e) => {
            let outerArgs = new AssigningCategoryStyleEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeAssigningCategoryStyle) {
                this.beforeAssigningCategoryStyle(this, outerArgs);
            }
            if (this._assigningCategoryStyle) {
                this._assigningCategoryStyle(this, outerArgs);
            }
        };
        this.i.assigningCategoryStyle = delegateCombine(this.i.assigningCategoryStyle, this._assigningCategoryStyle_wrapped);
    }
    /**
     * Handle this event in order to perform a custom typical price calculation.
    */
    get typical() {
        return this._typical;
    }
    set typical(ev) {
        if (this._typical_wrapped !== null) {
            this.i.typical = delegateRemove(this.i.typical, this._typical_wrapped);
            this._typical_wrapped = null;
            this._typical = null;
        }
        this._typical = ev;
        this._typical_wrapped = (o, e) => {
            let outerArgs = new FinancialEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeTypical) {
                this.beforeTypical(this, outerArgs);
            }
            if (this._typical) {
                this._typical(this, outerArgs);
            }
        };
        this.i.typical = delegateCombine(this.i.typical, this._typical_wrapped);
    }
    /**
     * Handle this event in order to specify which columns the Typical price calculation is based on.
    */
    get typicalBasedOn() {
        return this._typicalBasedOn;
    }
    set typicalBasedOn(ev) {
        if (this._typicalBasedOn_wrapped !== null) {
            this.i.typicalBasedOn = delegateRemove(this.i.typicalBasedOn, this._typicalBasedOn_wrapped);
            this._typicalBasedOn_wrapped = null;
            this._typicalBasedOn = null;
        }
        this._typicalBasedOn = ev;
        this._typicalBasedOn_wrapped = (o, e) => {
            let outerArgs = new FinancialEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeTypicalBasedOn) {
                this.beforeTypicalBasedOn(this, outerArgs);
            }
            if (this._typicalBasedOn) {
                this._typicalBasedOn(this, outerArgs);
            }
        };
        this.i.typicalBasedOn = delegateCombine(this.i.typicalBasedOn, this._typicalBasedOn_wrapped);
    }
}
