import * as tslib_1 from "tslib";
import { delegateCombine, delegateRemove } from "igniteui-react-core/ES5/type";
import { TimeAxisLabelFormatCollection } from "./igr-time-axis-label-format-collection";
import { AxisRangeChangedEventArgs } from "./igr-axis-range-changed-event-args";
import { IgrCategoryXAxis } from "./igr-category-x-axis";
import { OrdinalTimeXAxis } from "./OrdinalTimeXAxis";
import { TimeAxisLabelFormatCollection as TimeAxisLabelFormatCollection_internal } from "./TimeAxisLabelFormatCollection";
import { TimeAxisLabelFormat } from "./TimeAxisLabelFormat";
import { SyncableObservableCollection$1 } from "igniteui-react-core/ES5/SyncableObservableCollection$1";
/**
 * A horizontal axis that uses an ordinal DateTime scale.
 * On an ordinal time axis, datapoints are aligned according to their order in the ItemsSource, like a category axis.
*/
var IgrOrdinalTimeXAxis = /** @class */ (function (_super) {
    tslib_1.__extends(IgrOrdinalTimeXAxis, _super);
    function IgrOrdinalTimeXAxis(props) {
        var _this = _super.call(this, props) || this;
        _this._labelFormats = null;
        _this._actualRangeChanged = null;
        _this._actualRangeChanged_wrapped = null;
        return _this;
    }
    IgrOrdinalTimeXAxis.prototype.createImplementation = function () {
        return new OrdinalTimeXAxis();
    };
    Object.defineProperty(IgrOrdinalTimeXAxis.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrOrdinalTimeXAxis.prototype, "dateTimeMemberPath", {
        get: function () {
            return this.i.lq;
        },
        set: function (v) {
            this.i.lq = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrOrdinalTimeXAxis.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.ld;
                var wasNull = false;
                if (!innerColl) {
                    wasNull = true;
                    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.ld;
            var wasNull = false;
            if (!innerColl) {
                wasNull = true;
                innerColl = new TimeAxisLabelFormatCollection_internal();
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._labelFormats._setSyncTarget(syncColl);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrOrdinalTimeXAxis.prototype, "actualRangeChanged", {
        get: function () {
            return this._actualRangeChanged;
        },
        set: function (ev) {
            var _this = this;
            if (this._actualRangeChanged !== null) {
                this.i.actualRangeChanged = delegateRemove(this.i.actualRangeChanged, this._actualRangeChanged_wrapped);
                this._actualRangeChanged_wrapped = null;
                this._actualRangeChanged = null;
            }
            this._actualRangeChanged = ev;
            this._actualRangeChanged_wrapped = function (o, e) {
                var outerArgs = new AxisRangeChangedEventArgs();
                outerArgs._provideImplementation(e);
                _this._actualRangeChanged(_this, outerArgs);
            };
            this.i.actualRangeChanged = delegateCombine(this.i.actualRangeChanged, this._actualRangeChanged_wrapped);
        },
        enumerable: true,
        configurable: true
    });
    return IgrOrdinalTimeXAxis;
}(IgrCategoryXAxis));
export { IgrOrdinalTimeXAxis };
