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/ES2015/SyncableObservableCollection$1";
/**
 * A horizontal axis that uses a DateTime scale.
*/
export class IgrTimeXAxis extends IgrTimeAxisBase {
    constructor(props) {
        super(props);
        this._breaks = null;
    }
    createImplementation() {
        return new TimeXAxis();
    }
    get i() {
        return this._implementation;
    }
    /**
     * TimeAxisBreaks to apply to this axis, representing spans of time to omit, such as weekends.
    */
    get breaks() {
        if (this._breaks === null) {
            let coll = new TimeAxisBreakCollection();
            let innerColl = this.i.lw;
            let wasNull = false;
            if (!innerColl) {
                wasNull = true;
                innerColl = new TimeAxisBreakCollection_internal();
            }
            this._breaks = coll._fromInner(innerColl);
        }
        return this._breaks;
    }
    set breaks(v) {
        if (this._breaks !== null) {
            this._breaks._setSyncTarget(null);
            this._breaks = null;
        }
        let coll = new TimeAxisBreakCollection();
        this._breaks = coll._fromOuter(v);
        let syncColl = new SyncableObservableCollection$1(TimeAxisBreak.$type);
        let innerColl = this.i.lw;
        let wasNull = false;
        if (!innerColl) {
            wasNull = true;
            innerColl = new TimeAxisBreakCollection_internal();
        }
        syncColl._inner = innerColl;
        syncColl.clear();
        this._breaks._setSyncTarget(syncColl);
    }
    get isCategoryDateTime() {
        return this.i.b3;
    }
    /**
     * Gets the index of the data item with the value nearest the given value.
    
    * @param unscaledValue  * The value to find a value close to.
    */
    getIndexClosestToUnscaledValue(unscaledValue) {
        let iv = this.i.i$f(unscaledValue);
        return (iv);
    }
}
