import { DataSource, FilesSource, Rules, ResolvedRules, DataValue, ErrorBag, Data } from './@types';
import Validator from './Validator';
import DBChecker from './DBChecker';
import Model from './Model';
export default class Handler<F extends string = string, Exports = Data<F>> {
    /**
     * supported database models
     */
    static DB_MODELS: {
        NOSQL: number;
        RELATIONAL: number;
    };
    /**
     * supported database field case styles
     */
    static DB_MODEL_CASE_STYLES: {
        NONE: number;
        CAMEL_CASE: number;
        SNAKE_CASE: number;
    };
    /**
     * globally sets the database model to use
     * @param dbModel
     */
    static setDBModel(dbModel: number): void;
    /**
     * globally sets the database model field case style to use
     * @param dbCaseStyle
     */
    static setDBCaseStyle(dbCaseStyle: number): void;
    private dataSource;
    private filesSource;
    private addedFields;
    private rules;
    private resolvedRules;
    private executed;
    private requiredFields;
    private optionalFields;
    private validator;
    private dbChecker;
    private dbModel;
    private dbCaseStyle;
    private dataTypeToMethod;
    private DBCheckTypesToMethod;
    private customData;
    data: Data<F>;
    errors: ErrorBag<F>;
    constructor(dataSource?: DataSource, filesSource?: FilesSource, rules?: Rules<F>, validator?: Validator<F>, dbChecker?: DBChecker<F>);
    /**
     * returns true if value is falsy
     */
    private valueIsFalsy;
    /**
     * returns true if the given data type is a file data type
     */
    private isFileDataType;
    /**
     * returns true if the given field's type is a file data type
     */
    private isFileField;
    /**
     * run post processes
     */
    private runPostProcesses;
    /**
     * runs db check
     */
    private runDBCheck;
    /**
     * performs database integrity checks
     *
     * @param fields array of fields
     * @param required boolean indicating if fields are required
     */
    private validateDBChecks;
    /**
     * carries out data validation
     */
    private runValidation;
    /**
     * performs data validation
     *
     * @param fields array of fields
     * @param required boolean indicating if fields are required
     */
    private validateFields;
    /**
     * retrieves fields' data
     */
    private getFields;
    /**
     * returns true if field is missing
     */
    private fieldIsMissing;
    /**
     * checks for missing required fields
     */
    private checkMissingFields;
    /**
     * resolves an option
     */
    private resolveOption;
    /**
     * resolves the specific target objects within all resolved rules
     */
    private resolveOptions;
    /**
     * extracts required fields and optional fields.
     * @param rules
     */
    private categorizeRules;
    private filterRules;
    /**
     * strips html tags from the given value
     */
    private stripTags;
    /**
     * runs defined filters on the given value and returns the result
     */
    private filterValue;
    /**
     * performs the conditional if resolution
     * @param conditionalIf
     */
    private resolveConditionalIf;
    /**
     * resolves all overrideIf conditional rule
     */
    private resolveOverrideIf;
    /**
     * resolves all requiredIf conditional rule
     */
    private resolveRequiredIf;
    /**
     * resolves the rule and returns the result
     */
    private resolveRule;
    /**
     * resolves the given rules
     */
    private resolveRules;
    /**
     * checks if the handler should be executed
     */
    private shouldExecute;
    /**
     * sets the data source object if given
     */
    setDataSource(dataSource?: DataSource): this;
    /**
     * sets the files source object if given
     */
    setFilesSource(filesSource?: FilesSource): this;
    /**
     * set rules
     */
    setRules(rules?: Rules<F>): this;
    /**
     * sets the validator instance to use
     */
    setValidator(validator: Validator<F>): this;
    /**
     * sets the db checker instance to use
     * @param dbChecker
     */
    setDBChecker(dbChecker: DBChecker<F>): this;
    /**
     * sets the instance database model to use
     * @param dbModel
     */
    setDBModel(dbModel: number): void;
    /**
     * sets the instance database model field case style to use
     * @param dbCaseStyle
     */
    setDBCaseStyle(dbCaseStyle: number): void;
    /**
     * sets the error message
     */
    setError(field: string, errorMessage: string): this;
    /**
     *
     * @param field
     * @param value
     */
    addField(field: string, value: DataValue): this;
    /**
     * add extra fields to the data to be validated
     * @param fields object of field value pairs
     */
    addFields(fields: {
        [field: string]: DataValue;
    }): this;
    /**
     * asynchronously executes the handler instance
     *
     * @param validateOnDemand boolean value indicating if it should only pick and validate
     * fields that were sent and whose rules are defined. perfect when performing data updates
     * @param requiredFields field or array of fields that must be included when validating on
     * demand, even if they were not sent.
     */
    execute(validateOnDemand?: boolean, requiredFields?: string[] | string): Promise<boolean>;
    /**
     * returns true if the handler has been executed and no errors were found
     */
    succeeds(): boolean;
    /**
     * return true if handler has not been executed or if it has been executed but there are
     * some errors found
     */
    fails(): boolean;
    /**
     * returns the resolved rule, only useful for testing
     */
    getResolvedRules(): ResolvedRules<F>;
    /**
     * gets the instance current database model in use
     */
    getDBModel(): number;
    /**
     * gets the instance current database model field case style in use
     */
    getDBCaseStyle(): number;
    /**
     * creates and returns a model instance, that can be exported
     */
    model(): Model<F, Exports>;
    /**
     * sets custom data by the given name
     * @param name custom data name
     * @param value custom data value
     */
    setCustomData(name: string, value: any): this;
    /**
     * gets an already set custom data
     * @param name custom data name
     */
    getCustomData<T = any>(name: string): T;
}
