import * as tslib_1 from "tslib";
import { TimeAxisBreakCollection } from "./igr-time-axis-break-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";
/**
 * A horizontal axis that uses a DateTime scale.
*/
var IgrTimeXAxis = /** @class */ (function (_super) {
    tslib_1.__extends(IgrTimeXAxis, _super);
    function IgrTimeXAxis(props) {
        var _this = _super.call(this, props) || this;
        _this._breaks = 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.
        */
        get: function () {
            if (this._breaks === null) {
                var coll = new TimeAxisBreakCollection();
                var innerColl = this.i.lw;
                var wasNull = false;
                if (!innerColl) {
                    wasNull = true;
                    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.lw;
            var wasNull = false;
            if (!innerColl) {
                wasNull = true;
                innerColl = new TimeAxisBreakCollection_internal();
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._breaks._setSyncTarget(syncColl);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrTimeXAxis.prototype, "isCategoryDateTime", {
        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 };
