import { delegateCombine, delegateRemove } from "igniteui-webcomponents-core";
import { IgcResponsiveStateEnteringEventArgs } from "./igc-responsive-state-entering-event-args";
import { IgcResponsiveStateEnteredEventArgs } from "./igc-responsive-state-entered-event-args";
import { IgcResponsiveStateExitedEventArgs } from "./igc-responsive-state-exited-event-args";
import { ResponsiveState as ResponsiveState_internal } from "./ResponsiveState";
import { ensureBool } from "igniteui-webcomponents-core";
/**
 * Describes a state that the grid can enter based on a set of responsive conditions.
*/
export class IgcResponsiveState {
    constructor() {
        this._stateEntering = null;
        this._stateEntering_wrapped = null;
        this._stateEntered = null;
        this._stateEntered_wrapped = null;
        this._stateExited = null;
        this._stateExited_wrapped = null;
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    createImplementation() {
        return new ResponsiveState_internal();
    }
    /**
     * @hidden
     */
    get i() {
        return this._implementation;
    }
    onImplementationCreated() {
    }
    _provideImplementation(i) {
        this._implementation = i;
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    /**
     * The name of the responsive state
    */
    get name() {
        return this.i.n;
    }
    set name(v) {
        this.i.n = v;
    }
    /**
     * Gets or sets the minimum width for which this state is active.
    */
    get minimumWidth() {
        return this.i.k;
    }
    set minimumWidth(v) {
        this.i.k = +v;
    }
    /**
     * Gets or sets the maximum width for which this state is active.
    */
    get maximumWidth() {
        return this.i.j;
    }
    set maximumWidth(v) {
        this.i.j = +v;
    }
    /**
     * Configures this responsive state to only be manually actived
    */
    get isManualState() {
        return this.i.i;
    }
    set isManualState(v) {
        this.i.i = ensureBool(v);
    }
    findByName(name) {
        return null;
    }
    /**
     * Adds a responsive phase to the state.
    
    * @param phase  * The phase to add.
    */
    addResponsivePhase(phase) {
        let iv = this.i.d((phase == null ? null : phase.i));
        return (iv == null ? null : iv.externalObject);
    }
    /**
     * Adds a responsive phase to the state and returns it.
    
    */
    responsivePhase() {
        let iv = this.i.a();
        return (iv == null ? null : iv.externalObject);
    }
    /**
     * Called when a state is being entered.
    */
    get stateEntering() {
        return this._stateEntering;
    }
    set stateEntering(ev) {
        if (this._stateEntering_wrapped !== null) {
            this.i.stateEntering = delegateRemove(this.i.stateEntering, this._stateEntering_wrapped);
            this._stateEntering_wrapped = null;
            this._stateEntering = null;
        }
        this._stateEntering = ev;
        this._stateEntering_wrapped = (o, e) => {
            let outerArgs = new IgcResponsiveStateEnteringEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeStateEntering) {
                this.beforeStateEntering(this, outerArgs);
            }
            if (this._stateEntering) {
                this._stateEntering(this, outerArgs);
            }
        };
        this.i.stateEntering = delegateCombine(this.i.stateEntering, this._stateEntering_wrapped);
    }
    /**
     * Called when a state is entered.
    */
    get stateEntered() {
        return this._stateEntered;
    }
    set stateEntered(ev) {
        if (this._stateEntered_wrapped !== null) {
            this.i.stateEntered = delegateRemove(this.i.stateEntered, this._stateEntered_wrapped);
            this._stateEntered_wrapped = null;
            this._stateEntered = null;
        }
        this._stateEntered = ev;
        this._stateEntered_wrapped = (o, e) => {
            let outerArgs = new IgcResponsiveStateEnteredEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeStateEntered) {
                this.beforeStateEntered(this, outerArgs);
            }
            if (this._stateEntered) {
                this._stateEntered(this, outerArgs);
            }
        };
        this.i.stateEntered = delegateCombine(this.i.stateEntered, this._stateEntered_wrapped);
    }
    /**
     * Called when a state is exited.
    */
    get stateExited() {
        return this._stateExited;
    }
    set stateExited(ev) {
        if (this._stateExited_wrapped !== null) {
            this.i.stateExited = delegateRemove(this.i.stateExited, this._stateExited_wrapped);
            this._stateExited_wrapped = null;
            this._stateExited = null;
        }
        this._stateExited = ev;
        this._stateExited_wrapped = (o, e) => {
            let outerArgs = new IgcResponsiveStateExitedEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeStateExited) {
                this.beforeStateExited(this, outerArgs);
            }
            if (this._stateExited) {
                this._stateExited(this, outerArgs);
            }
        };
        this.i.stateExited = delegateCombine(this.i.stateExited, this._stateExited_wrapped);
    }
}
//# sourceMappingURL=igc-responsive-state.js.map
