import { __extends } from "tslib";
import { IgrCategoryAxisBase } from "./igr-category-axis-base";
import { IgrNumericYAxis } from "./igr-numeric-y-axis";
import { IgrStackedSeriesBase } from "./igr-stacked-series-base";
/**
 * Base class for stacked series with a category x-axis and a numeric y-axis.
*/
var IgrHorizontalStackedSeriesBase = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(IgrHorizontalStackedSeriesBase, _super);
    function IgrHorizontalStackedSeriesBase(props) {
        var _this = _super.call(this, props) || this;
        _this._xAxisName = null;
        _this._yAxisName = null;
        return _this;
    }
    Object.defineProperty(IgrHorizontalStackedSeriesBase.prototype, "i", {
        /**
                                     * @hidden
                                     */
        get: function () {
            return this._implementation;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrHorizontalStackedSeriesBase.prototype, "xAxis", {
        /**
         * Gets or sets the effective x-axis for this series.
        */
        get: function () {
            var r = this.i.xAxis;
            if (r == null) {
                return null;
            }
            if (!r.externalObject) {
                var e = IgrCategoryAxisBase._createFromInternal(r);
                if (e) {
                    e._implementation = r;
                }
                r.externalObject = e;
            }
            return r.externalObject;
        },
        set: function (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;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrHorizontalStackedSeriesBase.prototype, "xAxisName", {
        /**
        * Gets or sets the name to use to resolve xAxis from markup.
        */
        get: function () {
            return this._xAxisName;
        },
        set: function (v) {
            this._xAxisName = v;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrHorizontalStackedSeriesBase.prototype, "hasValueAxis", {
        get: function () {
            return this.i.d0;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrHorizontalStackedSeriesBase.prototype, "isValueAxisInverted", {
        get: function () {
            return this.i.fj;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrHorizontalStackedSeriesBase.prototype, "yAxis", {
        /**
         * Gets or sets the effective y-axis for this series.
        */
        get: function () {
            var r = this.i.yAxis;
            if (r == null) {
                return null;
            }
            if (!r.externalObject) {
                var e = IgrNumericYAxis._createFromInternal(r);
                if (e) {
                    e._implementation = r;
                }
                r.externalObject = e;
            }
            return r.externalObject;
        },
        set: function (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;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrHorizontalStackedSeriesBase.prototype, "yAxisName", {
        /**
        * Gets or sets the name to use to resolve yAxis from markup.
        */
        get: function () {
            return this._yAxisName;
        },
        set: function (v) {
            this._yAxisName = v;
        },
        enumerable: false,
        configurable: true
    });
    IgrHorizontalStackedSeriesBase.prototype.bindAxes = function (axes) {
        _super.prototype.bindAxes.call(this, axes);
        for (var i = 0; i < axes.length; i++) {
            if (this.xAxisName && this.xAxisName.length > 0 &&
                axes[i].name == this.xAxisName) {
                this.xAxis = axes[i];
            }
        }
        for (var i = 0; i < axes.length; i++) {
            if (this.yAxisName && this.yAxisName.length > 0 &&
                axes[i].name == this.yAxisName) {
                this.yAxis = axes[i];
            }
        }
    };
    IgrHorizontalStackedSeriesBase.prototype.findByName = function (name) {
        var baseResult = _super.prototype.findByName.call(this, 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;
    };
    IgrHorizontalStackedSeriesBase.prototype._styling = function (container, component, parent) {
        _super.prototype._styling.call(this, 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;
    };
    /**
     * Returns the offset value for this series if grouped on a category axis.
    
    */
    IgrHorizontalStackedSeriesBase.prototype.getOffsetValue = function () {
        var iv = this.i.getOffsetValue();
        return (iv);
    };
    /**
     * Returns the width of the category grouping this series is in.
    
    */
    IgrHorizontalStackedSeriesBase.prototype.getCategoryWidth = function () {
        var iv = this.i.getCategoryWidth();
        return (iv);
    };
    /**
     * Determine if object can be used as YAxis
    
    * @param axis  * The object to check
    */
    IgrHorizontalStackedSeriesBase.prototype.canUseAsYAxis = function (axis) {
        var iv = this.i.yh(axis);
        return (iv);
    };
    /**
     * Determine if object can be used as XAxis
    
    * @param axis  * The object to check
    */
    IgrHorizontalStackedSeriesBase.prototype.canUseAsXAxis = function (axis) {
        var iv = this.i.yg(axis);
        return (iv);
    };
    return IgrHorizontalStackedSeriesBase;
}(IgrStackedSeriesBase));
export { IgrHorizontalStackedSeriesBase };
