import * as tslib_1 from "tslib";
import { TimeAxisBreakCollection } from "./igr-time-axis-break-collection";
import { TimeAxisLabelFormatCollection } from "./igr-time-axis-label-format-collection";
import { TimeAxisIntervalCollection } from "./igr-time-axis-interval-collection";
import { IgrTimeAxisBase } from "./igr-time-axis-base";
import { TimeXAxis } from "./TimeXAxis";
import { TimeAxisBreakCollection as TimeAxisBreakCollection_internal } from "./TimeAxisBreakCollection";
import { TimeAxisBreak } from "./TimeAxisBreak";
import { SyncableObservableCollection$1 } from "igniteui-react-core/ES5/SyncableObservableCollection$1";
import { TimeAxisLabelFormatCollection as TimeAxisLabelFormatCollection_internal } from "./TimeAxisLabelFormatCollection";
import { TimeAxisLabelFormat } from "./TimeAxisLabelFormat";
import { TimeAxisIntervalCollection as TimeAxisIntervalCollection_internal } from "./TimeAxisIntervalCollection";
import { TimeAxisInterval } from "./TimeAxisInterval";
/**
 * A horizontal axis that uses a DateTime scale.
*
* The `IgrTimeXAxis` is a horizontal axis that uses a DateTime scale.
*
* ```ts
*   <IgrDataChart
*     dataSource={this.state.dataSource}
*     width="700px"
*     height="500px">
*     <IgrTimeXAxis name="xAxis" label="Date"
* 			dateTimeMemberPath="Date" />
*  </IgrDataChart>
* ```
*/
var IgrTimeXAxis = /** @class */ (function (_super) {
    tslib_1.__extends(IgrTimeXAxis, _super);
    function IgrTimeXAxis(props) {
        var _this = _super.call(this, props) || this;
        _this._breaks = null;
        _this._labelFormats = null;
        _this._intervals = null;
        return _this;
    }
    IgrTimeXAxis.prototype.createImplementation = function () {
        return new TimeXAxis();
    };
    Object.defineProperty(IgrTimeXAxis.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrTimeXAxis.prototype, "breaks", {
        /**
         * TimeAxisBreaks to apply to this axis, representing spans of time to omit, such as weekends.
        *
        * The `breaks` to apply to this axis, representing spans of time to omit, such as weekends.
        *
        * ```ts
        *   <IgrDataChart
        *     dataSource={this.state.dataSource}
        *     width="700px"
        *     height="500px">
        *     <IgrTimeXAxis name="xAxis" label="Date"
        * 			dateTimeMemberPath="Date" >
        *  </IgrTimeXAxis>
        *  </IgrDataChart>
        * ```
        */
        get: function () {
            if (this._breaks === null) {
                var coll = new TimeAxisBreakCollection();
                var innerColl = this.i.breaks;
                if (!innerColl) {
                    innerColl = new TimeAxisBreakCollection_internal();
                }
                this._breaks = coll._fromInner(innerColl);
            }
            return this._breaks;
        },
        set: function (v) {
            if (this._breaks !== null) {
                this._breaks._setSyncTarget(null);
                this._breaks = null;
            }
            var coll = new TimeAxisBreakCollection();
            this._breaks = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(TimeAxisBreak.$type);
            var innerColl = this.i.breaks;
            if (!innerColl) {
                innerColl = new TimeAxisBreakCollection_internal();
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._breaks._setSyncTarget(syncColl);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrTimeXAxis.prototype, "labelFormats", {
        /**
         * A list of axis label formats to apply, which are selected according to the visible axis range.
         * The label format selected will be the one with the largest range smaller than the visible range of the axis.
        */
        get: function () {
            if (this._labelFormats === null) {
                var coll = new TimeAxisLabelFormatCollection();
                var innerColl = this.i.labelFormats;
                if (!innerColl) {
                    innerColl = new TimeAxisLabelFormatCollection_internal();
                }
                this._labelFormats = coll._fromInner(innerColl);
            }
            return this._labelFormats;
        },
        set: function (v) {
            if (this._labelFormats !== null) {
                this._labelFormats._setSyncTarget(null);
                this._labelFormats = null;
            }
            var coll = new TimeAxisLabelFormatCollection();
            this._labelFormats = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(TimeAxisLabelFormat.$type);
            var innerColl = this.i.labelFormats;
            if (!innerColl) {
                innerColl = new TimeAxisLabelFormatCollection_internal();
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._labelFormats._setSyncTarget(syncColl);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrTimeXAxis.prototype, "intervals", {
        /**
         * A list of axis label intervals to apply, which are selected according to the visible axis range.
         * The interval selected will be the one with the largest range smaller than the visible range of the axis.
        */
        get: function () {
            if (this._intervals === null) {
                var coll = new TimeAxisIntervalCollection();
                var innerColl = this.i.intervals;
                if (!innerColl) {
                    innerColl = new TimeAxisIntervalCollection_internal();
                }
                this._intervals = coll._fromInner(innerColl);
            }
            return this._intervals;
        },
        set: function (v) {
            if (this._intervals !== null) {
                this._intervals._setSyncTarget(null);
                this._intervals = null;
            }
            var coll = new TimeAxisIntervalCollection();
            this._intervals = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(TimeAxisInterval.$type);
            var innerColl = this.i.intervals;
            if (!innerColl) {
                innerColl = new TimeAxisIntervalCollection_internal();
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._intervals._setSyncTarget(syncColl);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrTimeXAxis.prototype, "isCategoryDateTime", {
        /**
         * Gets if the current axis is of category date time axis type
        */
        get: function () {
            return this.i.b3;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Gets the index of the data item with the value nearest the given value.
    
    * @param unscaledValue  * The value to find a value close to.
    */
    IgrTimeXAxis.prototype.getIndexClosestToUnscaledValue = function (unscaledValue) {
        var iv = this.i.i$f(unscaledValue);
        return (iv);
    };
    return IgrTimeXAxis;
}(IgrTimeAxisBase));
export { IgrTimeXAxis };
