import { executeBooleanFilterCondition } from './booleanFilterCondition.js';
import { executeCollectionSearchFilterCondition } from './collectionSearchFilterCondition.js';
import { executeDateFilterCondition } from './dateFilterCondition.js';
import { getVarTypeOfByColumnFieldType } from './filterConditionProcesses.js';
import { isCollectionOperator } from './filterUtilities.js';
import { executeNumberFilterCondition } from './numberFilterCondition.js';
import { executeObjectFilterCondition } from './objectFilterCondition.js';
import { executeStringFilterCondition } from './stringFilterCondition.js';
/** Execute mapped condition (per field type) for each cell in the grid */
export const executeFilterConditionTest = ((options, parsedSearchTerms) => {
    // when using a multi-select ('IN' operator) we will not use the field type but instead go directly with a collection search
    if (isCollectionOperator(options.operator)) {
        return executeCollectionSearchFilterCondition(options);
    }
    // From a more specific field type (dateIso, dateEuro, text, readonly, ...), get the more generalized type (boolean, date, number, object, text)
    const generalizedType = getVarTypeOfByColumnFieldType(options.filterSearchType || options.fieldType);
    // execute the mapped type, or default to String condition check
    switch (generalizedType) {
        case 'boolean':
            // the parsedSearchTerms should be single value (result came from getFilterParsedBoolean() method)
            return executeBooleanFilterCondition(options, parsedSearchTerms);
        case 'date':
            return executeDateFilterCondition(options, (parsedSearchTerms || []));
        case 'number':
            return executeNumberFilterCondition(options, (parsedSearchTerms || []));
        case 'object':
            // the parsedSearchTerms should be single value (result came from getFilterParsedObjectResult() method)
            return executeObjectFilterCondition(options, parsedSearchTerms);
        case 'string':
        default:
            // the parsedSearchTerms should be single value (result came from getFilterParsedText() method)
            return executeStringFilterCondition(options, (parsedSearchTerms || []));
    }
});
export const FilterConditions = {
    executeFilterConditionTest: executeFilterConditionTest,
    booleanFilter: executeBooleanFilterCondition,
    collectionSearchFilter: executeCollectionSearchFilterCondition,
    numberFilter: executeNumberFilterCondition,
    stringFilter: executeStringFilterCondition,
};
//# sourceMappingURL=filterConditions.index.js.map