"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GridFilterInternalApi = void 0;
const ApiBase_1 = require("../Implementation/ApiBase");
class GridFilterInternalApi extends ApiBase_1.ApiBase {
    fireGridFilterAppliedEvent() {
        if (this.isAdapTableReady()) {
            const currentGridFilter = this.getGridFilterApi().getCurrentGridFilter();
            const adaptableApi = this.getAdaptableApi();
            const gridFilterAppliedInfo = Object.assign({ gridFilter: currentGridFilter, gridFilterExpressionAST: currentGridFilter
                    ? adaptableApi.expressionApi.getASTForExpression(currentGridFilter === null || currentGridFilter === void 0 ? void 0 : currentGridFilter.Expression)
                    : null }, this.getAdaptableInternalApi().buildBaseContext());
            adaptableApi.eventApi.emit('GridFilterApplied', gridFilterAppliedInfo);
        }
    }
    /**
     * Compares to Grid Filter to see if they are identical
     */
    isGridFilterDifferent(oldFilter, newFilter) {
        if (oldFilter == undefined && newFilter == undefined) {
            return false;
        }
        return (oldFilter === null || oldFilter === void 0 ? void 0 : oldFilter.Expression) !== (newFilter === null || newFilter === void 0 ? void 0 : newFilter.Expression);
    }
}
exports.GridFilterInternalApi = GridFilterInternalApi;
