import { delegateCombine, delegateRemove } from "igniteui-webcomponents-core";
import { SummaryOperand_$type } from "igniteui-webcomponents-core";
import { IgcFormatSummaryTextEventArgs } from "./igc-format-summary-text-event-args";
import { IgcProvideCalculatorEventArgs } from "igniteui-webcomponents-core";
import { ColumnSummaryDescription as ColumnSummaryDescription_internal } from "./ColumnSummaryDescription";
import { ensureEnum, arrayFindByName } from "igniteui-webcomponents-core";
/**
 * Represents a summary that is applied to a datasource. Changes to this object are not observed or expected after it is initially assigned to a collection.
*/
var IgcColumnSummaryDescription = /** @class */ /*@__PURE__*/ (function () {
    function IgcColumnSummaryDescription() {
        this._formatText = null;
        this._formatText_wrapped = null;
        this._provideCalculator = null;
        this._provideCalculator_wrapped = null;
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    IgcColumnSummaryDescription.prototype.createImplementation = function () {
        return new ColumnSummaryDescription_internal(0);
    };
    Object.defineProperty(IgcColumnSummaryDescription.prototype, "i", {
        /**
         * @hidden
         */
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    IgcColumnSummaryDescription.prototype.onImplementationCreated = function () {
    };
    IgcColumnSummaryDescription.prototype._provideImplementation = function (i) {
        this._implementation = i;
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    };
    Object.defineProperty(IgcColumnSummaryDescription.prototype, "field", {
        get: function () {
            return this.i.af;
        },
        set: function (v) {
            this.i.af = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcColumnSummaryDescription.prototype, "operand", {
        get: function () {
            return this.i.n;
        },
        set: function (v) {
            this.i.n = ensureEnum(SummaryOperand_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcColumnSummaryDescription.prototype, "calculatorDisplayName", {
        /**
         * Gets or sets the name to use when displaying the calculator name.
        */
        get: function () {
            return this.i.ac;
        },
        set: function (v) {
            this.i.ac = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcColumnSummaryDescription.prototype, "displayName", {
        /**
         * Gets or sets the display name for the summary.
        */
        get: function () {
            return this.i.ae;
        },
        set: function (v) {
            this.i.ae = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcColumnSummaryDescription.prototype, "valueFormat", {
        /**
         * Gets or sets the format string for the summary value.
        */
        get: function () {
            return this.i.ag;
        },
        set: function (v) {
            this.i.ag = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcColumnSummaryDescription.prototype, "valueFormatSpecifiers", {
        /**
         * Gets or sets the format specifiers to use with the ValueFormat string.
        */
        get: function () {
            return this.i.d;
        },
        set: function (v) {
            this.i.d = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcColumnSummaryDescription.prototype, "displayFormat", {
        /**
         * Gets or sets the display format for the summary when in list display mode.
        */
        get: function () {
            return this.i.ad;
        },
        set: function (v) {
            this.i.ad = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcColumnSummaryDescription.prototype, "displayFormatSpecifiers", {
        /**
         * Gets or sets the format specifiers to use with the DisplayFormat string.
        */
        get: function () {
            return this.i.c;
        },
        set: function (v) {
            this.i.c = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcColumnSummaryDescription.prototype, "formatOverride", {
        /**
         * Gets or sets an INTL.DateTimeFormat or INTL.NumericFormat to use to format the value.
        */
        get: function () {
            return this.i.w;
        },
        set: function (v) {
            this.i.w = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcColumnSummaryDescription.prototype, "maxFractionDigits", {
        /**
         * Gets or sets the minimum fraction digits. If FormatOverride is specificied this value is ignored.
        */
        get: function () {
            return this.i.u;
        },
        set: function (v) {
            this.i.u = +v;
        },
        enumerable: true,
        configurable: true
    });
    IgcColumnSummaryDescription.prototype.findByName = function (name) {
        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;
    };
    IgcColumnSummaryDescription.prototype.equals = function (other) {
        var iv = this.i.equals(other);
        return (iv);
    };
    Object.defineProperty(IgcColumnSummaryDescription.prototype, "formatText", {
        /**
         * Called when the value is being formatted.
        */
        get: function () {
            return this._formatText;
        },
        set: function (ev) {
            var _this = this;
            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 = function (o, e) {
                var outerArgs = new IgcFormatSummaryTextEventArgs();
                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);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcColumnSummaryDescription.prototype, "provideCalculator", {
        /**
         * Called when the summary calculator is required.
        */
        get: function () {
            return this._provideCalculator;
        },
        set: function (ev) {
            var _this = this;
            if (this._provideCalculator_wrapped !== null) {
                this.i.provideCalculator = delegateRemove(this.i.provideCalculator, this._provideCalculator_wrapped);
                this._provideCalculator_wrapped = null;
                this._provideCalculator = null;
            }
            this._provideCalculator = ev;
            this._provideCalculator_wrapped = function (o, e) {
                var outerArgs = new IgcProvideCalculatorEventArgs();
                outerArgs._provideImplementation(e);
                if (_this.beforeProvideCalculator) {
                    _this.beforeProvideCalculator(_this, outerArgs);
                }
                if (_this._provideCalculator) {
                    _this._provideCalculator(_this, outerArgs);
                }
            };
            this.i.provideCalculator = delegateCombine(this.i.provideCalculator, this._provideCalculator_wrapped);
        },
        enumerable: true,
        configurable: true
    });
    return IgcColumnSummaryDescription;
}());
export { IgcColumnSummaryDescription };
//# sourceMappingURL=igc-column-summary-description.js.map
