import {} from '../enums/index.js';
import { isColumnDateType } from '../services/utilities.js';
import { getFilterParsedBoolean } from './booleanFilterCondition.js';
import { getFilterParsedDates } from './dateFilterCondition.js';
import { getFilterParsedNumbers } from './numberFilterCondition.js';
import { getFilterParsedObjectResult } from './objectFilterCondition.js';
import { getFilterParsedText } from './stringFilterCondition.js';
/**
 * From our search filter value(s), get their parsed value(s), for example a "dateIso" filter will be parsed as Date object.
 * Then later when we execute the filtering checks, we won't need to re-parse all search value(s) again and again.
 * So this is called only once, for each search filter that is, prior to running the actual filter condition checks on each cell afterward.
 */
export function getParsedSearchTermsByFieldType(inputSearchTerms, inputFilterSearchType) {
    const generalizedType = getVarTypeOfByColumnFieldType(inputFilterSearchType);
    let parsedSearchValues;
    // parse the search value(s), the Date & Numbers could be in a range and so we will return an array for them
    // any other type will return a single search value
    switch (generalizedType) {
        case 'boolean':
            parsedSearchValues = getFilterParsedBoolean(inputSearchTerms);
            break;
        case 'date':
            parsedSearchValues = getFilterParsedDates(inputSearchTerms, inputFilterSearchType);
            break;
        case 'number':
            parsedSearchValues = getFilterParsedNumbers(inputSearchTerms);
            break;
        case 'object':
            parsedSearchValues = getFilterParsedObjectResult(inputSearchTerms);
            break;
        case 'string':
            parsedSearchValues = getFilterParsedText(inputSearchTerms);
            break;
    }
    return parsedSearchValues;
}
/**
 * From a more specific field type, let's return a simple and more general type (boolean, date, number, object, text)
 * @param fieldType - specific field type
 * @returns generalType - general field type
 */
export function getVarTypeOfByColumnFieldType(fieldType) {
    if (isColumnDateType(fieldType)) {
        return 'date';
    }
    // return general field type
    switch (fieldType) {
        case 'boolean':
            return 'boolean';
        case 'integer':
        case 'float':
        case 'number':
            return 'number';
        case 'object':
            return 'object';
        case 'string':
        case 'text':
        case 'password':
        case 'readonly':
        default:
            return 'string';
    }
}
//# sourceMappingURL=filterConditionProcesses.js.map