import { delegateCombine, delegateRemove } from "igniteui-webcomponents-core";
import { IgcFormatGroupTextEventArgs } from "./igc-format-group-text-event-args";
import { IgcColumnSortDescription } from "./igc-column-sort-description";
import { ColumnGroupDescription as ColumnGroupDescription_internal } from "./ColumnGroupDescription";
import { arrayFindByName } from "igniteui-webcomponents-core";
/**
 * Represents an element in the current grouping applied to a data source or provider. Changes to this object are not observed or expected after it is initially assigned to a collection.
*/
export class IgcColumnGroupDescription extends IgcColumnSortDescription {
    constructor() {
        super();
        this._formatText = null;
        this._formatText_wrapped = null;
    }
    createImplementation() {
        return new ColumnGroupDescription_internal(0);
    }
    /**
                                 * @hidden
                                 */
    get i() {
        return this._implementation;
    }
    /**
     * Gets or sets the format string for the group value.
    */
    get valueFormat() {
        return this.i.x;
    }
    set valueFormat(v) {
        this.i.x = v;
    }
    /**
     * Gets or sets the format specifiers to use with the ValueFormat string.
    */
    get valueFormatSpecifiers() {
        return this.i.j;
    }
    set valueFormatSpecifiers(v) {
        this.i.j = v;
    }
    /**
     * Gets or sets the display format for the group text in the group header.
    */
    get displayFormat() {
        return this.i.u;
    }
    set displayFormat(v) {
        this.i.u = v;
    }
    /**
     * Gets or sets the format specifiers to use with the DisplayFormat string.
    */
    get displayFormatSpecifiers() {
        return this.i.i;
    }
    set displayFormatSpecifiers(v) {
        this.i.i = v;
    }
    /**
     * Gets or sets an INTL.DateTimeFormat or INTL.NumericFormat to use to format the value.
    */
    get formatOverride() {
        return this.i.q;
    }
    set formatOverride(v) {
        this.i.q = v;
    }
    /**
     * Gets or sets the display text for the group name.
    */
    get displayName() {
        return this.i.v;
    }
    set displayName(v) {
        this.i.v = v;
    }
    findByName(name) {
        var baseResult = super.findByName(name);
        if (baseResult) {
            return baseResult;
        }
        if (this.valueFormatSpecifiers != null && arrayFindByName(this.valueFormatSpecifiers, name)) {
            return arrayFindByName(this.valueFormatSpecifiers, name);
        }
        if (this.displayFormatSpecifiers != null && arrayFindByName(this.displayFormatSpecifiers, name)) {
            return arrayFindByName(this.displayFormatSpecifiers, name);
        }
        return null;
    }
    /**
     * Called when the value is being formatted.
    */
    get formatText() {
        return this._formatText;
    }
    set formatText(ev) {
        if (this._formatText_wrapped !== null) {
            this.i.formatText = delegateRemove(this.i.formatText, this._formatText_wrapped);
            this._formatText_wrapped = null;
            this._formatText = null;
        }
        this._formatText = ev;
        this._formatText_wrapped = (o, e) => {
            let outerArgs = new IgcFormatGroupTextEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeFormatText) {
                this.beforeFormatText(this, outerArgs);
            }
            if (this._formatText) {
                this._formatText(this, outerArgs);
            }
        };
        this.i.formatText = delegateCombine(this.i.formatText, this._formatText_wrapped);
    }
}
//# sourceMappingURL=igc-column-group-description.js.map
