import { delegateCombine, delegateRemove } from "igniteui-react-core/ES2015/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/ES2015/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.
*/
export class IgrOrdinalTimeXAxis extends IgrCategoryXAxis {
    constructor(props) {
        super(props);
        this._labelFormats = null;
        this._actualRangeChanged = null;
        this._actualRangeChanged_wrapped = null;
    }
    createImplementation() {
        return new OrdinalTimeXAxis();
    }
    get i() {
        return this._implementation;
    }
    get dateTimeMemberPath() {
        return this.i.lq;
    }
    set dateTimeMemberPath(v) {
        this.i.lq = v;
    }
    /**
     * 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 labelFormats() {
        if (this._labelFormats === null) {
            let coll = new TimeAxisLabelFormatCollection();
            let innerColl = this.i.ld;
            let wasNull = false;
            if (!innerColl) {
                wasNull = true;
                innerColl = new TimeAxisLabelFormatCollection_internal();
            }
            this._labelFormats = coll._fromInner(innerColl);
        }
        return this._labelFormats;
    }
    set labelFormats(v) {
        if (this._labelFormats !== null) {
            this._labelFormats._setSyncTarget(null);
            this._labelFormats = null;
        }
        let coll = new TimeAxisLabelFormatCollection();
        this._labelFormats = coll._fromOuter(v);
        let syncColl = new SyncableObservableCollection$1(TimeAxisLabelFormat.$type);
        let innerColl = this.i.ld;
        let wasNull = false;
        if (!innerColl) {
            wasNull = true;
            innerColl = new TimeAxisLabelFormatCollection_internal();
        }
        syncColl._inner = innerColl;
        syncColl.clear();
        this._labelFormats._setSyncTarget(syncColl);
    }
    get actualRangeChanged() {
        return this._actualRangeChanged;
    }
    set actualRangeChanged(ev) {
        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 = (o, e) => {
            let outerArgs = new AxisRangeChangedEventArgs();
            outerArgs._provideImplementation(e);
            this._actualRangeChanged(this, outerArgs);
        };
        this.i.actualRangeChanged = delegateCombine(this.i.actualRangeChanged, this._actualRangeChanged_wrapped);
    }
}
