import { Nullable } from '../../../types/general';
import { FormFieldStatusMeta, FormFieldValidationRule } from '../rules/form-field-validation-rule';
import { EvaluateResult } from '../rules/validation-rule';
export declare type ValidationResult = EvaluateResult & {
  shouldShowError: boolean;
};
export declare type RuleHandlerChainResultType = {
  validationResult: Nullable<ValidationResult>;
  shouldSkip: boolean;
};
export declare type ValidationCallBack = (showError: boolean | 'rule', validationResult: Nullable<ValidationResult>) => boolean;
/** The `FormFieldValidationRuleHandlerChain` class is responsible for handling a chain of form field validation rule handlers and processing the validation rules for a given input. */
export declare class FormFieldValidationRuleHandlerChain<T> {
  private handlers;
  private processId;
  /**
   * The function checks if there is an async rule handler that can be evaluated for a given input and form field status.
   *
   * @param {unknown} input - The input parameter represents the value that needs to be validated.
   * @param {FormFieldStatusMeta} status - It represents the current status of a form field.
   * @param {(keyof FormFieldStatusMeta)[]} triggerStatus - It represents the status values that can trigger the validation rule handler.
   * @returns {boolean} a boolean value. It returns true if there is an async rule handler found in the `handlers` array, and false otherwise.
   */
  checkIncludesAsyncRuleHandler(input: T, status: FormFieldStatusMeta, triggerStatus: (keyof FormFieldStatusMeta)[]): boolean;
  /**
   * The function initializes form field validation rule handlers based on the provided rules.
   *
   * @param {FormFieldValidationRule<unknown>[]} rules - An array of FormFieldValidationRule objects.
   */
  setHandlersByRules(rules: FormFieldValidationRule<T>[]): void;
  /**
   * iterates through a list of handlers to evaluate and handle the input, returning a validation result and call the callback method
   *
   * @param {unknown} input - The input parameter represents the data that needs to be processed.
   * @param {FormFieldStatusMeta} status - It represents the current status of a form field.
   * @param {(keyof FormFieldStatusMeta)[]} triggerStatus - These keys represent the fields that have triggered a change in status.
   * @param {boolean | 'rule'} showError - A boolean or string rule form method call, It's a param of callback.
   * @param {ValidationCallBack} callback - The method should be call when validation result is not valid.
   * @returns {Promise<EvaluateResult>} validate result.
   */
  process(input: T, status: FormFieldStatusMeta, triggerStatus: (keyof FormFieldStatusMeta)[], showError: boolean | 'rule', callback: ValidationCallBack): Promise<EvaluateResult>;
  /**
   * sets the processId to the UUID
   *
   * @returns {string} the UUID (string)
   */
  private preProcess;
  /**
   * call the method after get the validation result, such as send validation result to form, show or hide field error message
   *
   * @param {string} UUID the validate id
   * @param {boolean | 'rule'} showError boolean value to show or not the error message
   * @param {Nullable<ValidationResult>} validationResult the validation result
   * @param {ValidationCallBack} callback the method need to call to handle the result
   */
  private postProcess;
}
