import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { IgrNumericXAxis } from "./igr-numeric-x-axis";
import { IgrNumericYAxis } from "./igr-numeric-y-axis";
import { TrendLineType_$type } from "igniteui-react-core";
import { CollisionAvoidanceType_$type } from "./CollisionAvoidanceType";
import { ScatterItemSearchMode_$type } from "./ScatterItemSearchMode";
import { IgrAssigningScatterStyleEventArgs } from "./igr-assigning-scatter-style-event-args";
import { IgrAssigningScatterMarkerStyleEventArgs } from "./igr-assigning-scatter-marker-style-event-args";
import { IgrMarkerSeries } from "./igr-marker-series";
import { ensureBool, ensureEnum, brushToString, stringToBrush, toPoint, fromRect, fromPoint } from "igniteui-react-core";
/**
 * Represents the base class for all IgxDataChartComponent scatter series
*/
export class IgrScatterBase extends IgrMarkerSeries {
    constructor(props) {
        super(props);
        this._xAxisName = null;
        this._yAxisName = null;
        this._assigningScatterStyle = null;
        this._assigningScatterStyle_wrapped = null;
        this._assigningScatterMarkerStyle = null;
        this._assigningScatterMarkerStyle_wrapped = null;
    }
    /**
                                 * @hidden
                                 */
    get i() {
        return this._implementation;
    }
    /**
     * Checks if this series is a scatter series
    */
    get isScatter() {
        return this.i.dj;
    }
    /**
     * Gets or sets the effective x-axis for the current object.
    */
    get xAxis() {
        if (this.i.xAxis == null) {
            return null;
        }
        if (!this.i.xAxis.externalObject) {
            let e = IgrNumericXAxis._createFromInternal(this.i.xAxis);
            if (e) {
                e._implementation = this.i.xAxis;
            }
            this.i.xAxis.externalObject = e;
        }
        return this.i.xAxis.externalObject;
    }
    set xAxis(v) {
        if (v != null && this._stylingContainer && v._styling)
            v._styling(this._stylingContainer, this, this);
        v == null ? this.i.xAxis = null : this.i.xAxis = v.i;
    }
    /**
    * Gets or sets the name to use to resolve xAxis from markup.
    */
    get xAxisName() {
        return this._xAxisName;
    }
    set xAxisName(v) {
        this._xAxisName = v;
    }
    /**
     * Gets or sets the effective y-axis for the current object.
    */
    get yAxis() {
        if (this.i.yAxis == null) {
            return null;
        }
        if (!this.i.yAxis.externalObject) {
            let e = IgrNumericYAxis._createFromInternal(this.i.yAxis);
            if (e) {
                e._implementation = this.i.yAxis;
            }
            this.i.yAxis.externalObject = e;
        }
        return this.i.yAxis.externalObject;
    }
    set yAxis(v) {
        if (v != null && this._stylingContainer && v._styling)
            v._styling(this._stylingContainer, this, this);
        v == null ? this.i.yAxis = null : this.i.yAxis = v.i;
    }
    /**
    * Gets or sets the name to use to resolve yAxis from markup.
    */
    get yAxisName() {
        return this._yAxisName;
    }
    set yAxisName(v) {
        this._yAxisName = v;
    }
    /**
     * Gets or sets the value mapping property for the current series object.
    */
    get xMemberPath() {
        return this.i.rf;
    }
    set xMemberPath(v) {
        this.i.rf = v;
    }
    /**
     * Gets or sets the value mapping property for the current series object.
    */
    get yMemberPath() {
        return this.i.rj;
    }
    set yMemberPath(v) {
        this.i.rj = v;
    }
    /**
     * Gets or sets the trend type for the current scatter series.
    */
    get trendLineType() {
        return this.i.trendLineType;
    }
    set trendLineType(v) {
        this.i.trendLineType = ensureEnum(TrendLineType_$type, v);
    }
    /**
     * Gets or sets the brush to use to draw the trend line.
    */
    get trendLineBrush() {
        return brushToString(this.i.trendLineBrush);
    }
    set trendLineBrush(v) {
        this.i.trendLineBrush = stringToBrush(v);
    }
    /**
     * Gets the effective TrendLineBrush for this series.
    */
    get actualTrendLineBrush() {
        return brushToString(this.i.sq);
    }
    set actualTrendLineBrush(v) {
        this.i.sq = stringToBrush(v);
    }
    /**
     * Gets or sets the thickness of the current scatter series object's trend line.
    */
    get trendLineThickness() {
        return this.i.trendLineThickness;
    }
    set trendLineThickness(v) {
        this.i.trendLineThickness = +v;
    }
    /**
     * Gets or sets the moving average period for the current scatter series object.
     * The typical, and initial, value for trend line period is 7.
    */
    get trendLinePeriod() {
        return this.i.trendLinePeriod;
    }
    set trendLinePeriod(v) {
        this.i.trendLinePeriod = +v;
    }
    /**
     * The desired behavior for markers in this series which are placed too close together for the current view, resulting in a collision.
    */
    get markerCollisionAvoidance() {
        return this.i.pv;
    }
    set markerCollisionAvoidance(v) {
        this.i.pv = ensureEnum(CollisionAvoidanceType_$type, v);
    }
    /**
     * Gets or sets the Z-Index of the trend line.  Values greater than 1000 will result in the trend line being rendered in front of the series data.
    */
    get trendLineZIndex() {
        return this.i.q4;
    }
    set trendLineZIndex(v) {
        this.i.q4 = +v;
    }
    /**
     * Gets or sets the maximum number of markerItems displayed by the current series.
     * If more than the specified number of markerItems are visible, the series will automatically
     * choose a representative set.
    */
    get maximumMarkers() {
        return this.i.q3;
    }
    set maximumMarkers(v) {
        this.i.q3 = +v;
    }
    /**
     * Gets or sets the mode the series will use to find the closest point to the cursor.
    */
    get itemSearchMode() {
        return this.i.qe;
    }
    set itemSearchMode(v) {
        this.i.qe = ensureEnum(ScatterItemSearchMode_$type, v);
    }
    /**
     * Gets or sets the threshold to use when searching for items using ItemSearchMode.
    */
    get itemSearchThreshold() {
        return this.i.q2;
    }
    set itemSearchThreshold(v) {
        this.i.q2 = +v;
    }
    get actualItemSearchMode() {
        return this.i.qc;
    }
    set actualItemSearchMode(v) {
        this.i.qc = ensureEnum(ScatterItemSearchMode_$type, v);
    }
    /**
     * Gets or sets whether this Scatter series should allow custom style overrides of its individual visuals.
    */
    get isCustomScatterStyleAllowed() {
        return this.i.qp;
    }
    set isCustomScatterStyleAllowed(v) {
        this.i.qp = ensureBool(v);
    }
    /**
     * Gets or sets whether this Scatter series should allow custom style overrides of its individual marker visuals.
    */
    get isCustomScatterMarkerStyleAllowed() {
        return this.i.qo;
    }
    set isCustomScatterMarkerStyleAllowed(v) {
        this.i.qo = ensureBool(v);
    }
    bindAxes(axes) {
        super.bindAxes(axes);
        for (let i = 0; i < axes.length; i++) {
            if (this.xAxisName && this.xAxisName.length > 0 &&
                axes[i].name == this.xAxisName) {
                this.xAxis = axes[i];
            }
        }
        for (let i = 0; i < axes.length; i++) {
            if (this.yAxisName && this.yAxisName.length > 0 &&
                axes[i].name == this.yAxisName) {
                this.yAxis = axes[i];
            }
        }
    }
    findByName(name) {
        var baseResult = super.findByName(name);
        if (baseResult) {
            return baseResult;
        }
        if (this.xAxis && this.xAxis.name && this.xAxis.name == name) {
            return this.xAxis;
        }
        if (this.yAxis && this.yAxis.name && this.yAxis.name == name) {
            return this.yAxis;
        }
        return null;
    }
    _styling(container, component, parent) {
        super._styling(container, component, parent);
        this._inStyling = true;
        if (this.xAxis && this.xAxis._styling) {
            this.xAxis._styling(container, component, this);
        }
        if (this.yAxis && this.yAxis._styling) {
            this.yAxis._styling(container, component, this);
        }
        this._inStyling = false;
    }
    getItemValue(item, memberPathName) {
        let iv = this.i.gt(item, memberPathName);
        return (iv);
    }
    /**
     * If possible, will return the best available value marker bounding box within the series that has the best value match for the world position provided.
    
    * @param world  * The world coordinates for which to get a value marker bounding box for
    */
    getSeriesValueMarkerBoundingBox(world) {
        let iv = this.i.n4(toPoint(world));
        return fromRect(iv);
    }
    /**
     * Determine if object can be used as YAxis
    
    * @param axis  * The object to check
    */
    canUseAsYAxis(axis) {
        let iv = this.i.qn(axis);
        return (iv);
    }
    /**
     * Determine if object can be used as XAxis
    
    * @param axis  * The object to check
    */
    canUseAsXAxis(axis) {
        let iv = this.i.qm(axis);
        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.gq(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.f9(toPoint(world));
        return (iv);
    }
    getExactItemIndex(world) {
        let iv = this.i.e4(toPoint(world));
        return (iv);
    }
    getSeriesValuePosition(world, useInterpolation, skipUnknowns) {
        let iv = this.i.nt(toPoint(world), useInterpolation, skipUnknowns);
        return fromPoint(iv);
    }
    /**
     * Scrolls the series to display the item for the specified data item.
     * The series is scrolled by the minimum amount required to place the specified data item within
     * the central 80% of the visible axis.
    
    * @param item  * The data item (item) to scroll to.
    */
    scrollIntoView(item) {
        let iv = this.i.dq(item);
        return (iv);
    }
    /**
     * Event raised when Assigning Category Style
    */
    get assigningScatterStyle() {
        return this._assigningScatterStyle;
    }
    set assigningScatterStyle(ev) {
        if (this._assigningScatterStyle_wrapped !== null) {
            this.i.assigningScatterStyle = delegateRemove(this.i.assigningScatterStyle, this._assigningScatterStyle_wrapped);
            this._assigningScatterStyle_wrapped = null;
            this._assigningScatterStyle = null;
        }
        this._assigningScatterStyle = ev;
        this._assigningScatterStyle_wrapped = (o, e) => {
            let outerArgs = new IgrAssigningScatterStyleEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeAssigningScatterStyle) {
                this.beforeAssigningScatterStyle(this, outerArgs);
            }
            if (this._assigningScatterStyle) {
                this._assigningScatterStyle(this, outerArgs);
            }
        };
        this.i.assigningScatterStyle = delegateCombine(this.i.assigningScatterStyle, this._assigningScatterStyle_wrapped);
    }
    /**
     * Event raised when Assigning Scatter Marker Style
    */
    get assigningScatterMarkerStyle() {
        return this._assigningScatterMarkerStyle;
    }
    set assigningScatterMarkerStyle(ev) {
        if (this._assigningScatterMarkerStyle_wrapped !== null) {
            this.i.assigningScatterMarkerStyle = delegateRemove(this.i.assigningScatterMarkerStyle, this._assigningScatterMarkerStyle_wrapped);
            this._assigningScatterMarkerStyle_wrapped = null;
            this._assigningScatterMarkerStyle = null;
        }
        this._assigningScatterMarkerStyle = ev;
        this._assigningScatterMarkerStyle_wrapped = (o, e) => {
            let outerArgs = new IgrAssigningScatterMarkerStyleEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeAssigningScatterMarkerStyle) {
                this.beforeAssigningScatterMarkerStyle(this, outerArgs);
            }
            if (this._assigningScatterMarkerStyle) {
                this._assigningScatterMarkerStyle(this, outerArgs);
            }
        };
        this.i.assigningScatterMarkerStyle = delegateCombine(this.i.assigningScatterMarkerStyle, this._assigningScatterMarkerStyle_wrapped);
    }
}
//# sourceMappingURL=igr-scatter-base.js.map
