import '../../assert/js/assert.js';
import '../../globals.js';
/**
 * The definition file for "validators" used to validate values. This file holds associated logic that validates the
 * schema of the "validator" object, as well as testing if a value adheres to the restrictions provided by a validator.
 * See validate.js for usage with assertions to check that values are valid.
 *
 * Examples:
 *
 * A Validator that only accepts number values:
 * { valueType: 'number' }
 *
 * A Validator that only accepts the numbers "2" or "3":
 * { valueType: 'number', validValues: [ 2, 3 ] }
 *
 * A Validator that accepts any Object:
 * { valueType: Object }
 *
 * A Validator that accepts EnumerationDeprecated values (NOTE! This is deprecated, use the new class-based enumeration pattern as the valueType):
 * { valueType: MyEnumeration }
 * and/or
 * { validValues: MyEnumeration.VALUES }
 *
 * A Validator that accepts a string or a number greater than 2:
 * { isValidValue: value => { typeof value === 'string' || (typeof value === 'number' && value > 2)} }
 *
 * A Validator for a number that should be an even number greater than 10
 * { valueType: 'number', validators: [ { isValidValue: v => v > 10 }, { isValidValue: v => v%2 === 0 }] }
 *
 * @author Sam Reid (PhET Interactive Simulations)
 * @author Michael Kauzmann (PhET Interactive Simulations)
 */
import EnumerationDeprecated from '../../phet-core/js/EnumerationDeprecated.js';
import IntentionalAny from '../../phet-core/js/types/IntentionalAny.js';
import type IOType from '../../tandem/js/types/IOType.js';
export type IsValidValueOptions = {
    validateValidator?: boolean;
};
type ValueType = string | EnumerationDeprecated | null | ValueType[] | Function;
type CustomValueComparisonMethodHolder<T> = {
    customValueComparison(a: T, b: T): boolean;
};
/**
 * The way that two values can be compared for equality:
 * "reference" - uses triple equals comparison (most often the default)
 * "equalsFunction" - asserts that the two values have an `equals()` function that can used to compare (see "ComparableObject" type)
 * "lodashDeep" - uses _.isEqual() for comparison
 * custom function - define any function that returns if the two provided values are equal.
 */
export type ValueComparisonStrategy<T> = 'equalsFunction' | 'reference' | 'lodashDeep' | CustomValueComparisonMethodHolder<T>['customValueComparison'];
export type ValidationMessage = string | (() => string);
export type Validator<T = unknown> = {
    valueType?: ValueType | ValueType[];
    validValues?: readonly T[];
    valueComparisonStrategy?: ValueComparisonStrategy<T>;
    isValidValue?: (v: T) => boolean;
    phetioType?: IOType;
    validationMessage?: ValidationMessage;
    validators?: Validator<T>[];
};
export default class Validation {
    /**
     * @returns an error string if incorrect, otherwise null if valid
     */
    static getValidatorValidationError<T>(validator: Validator<T>): string | null;
    /**
     * Validate that the valueType is of the expected format. Does not add validationMessage to any error it reports.
     * @returns - null if valid
     */
    private static getValueTypeValidatorValidationError;
    static validateValidator<T>(validator: Validator<T>): void;
    /**
     * @param validator - object which may or may not contain validation keys
     */
    static containsValidatorKey(validator: IntentionalAny): boolean;
    private static combineErrorMessages;
    static isValueValid<T>(value: T, validator: Validator<T>, providedOptions?: IsValidValueOptions): boolean;
    /**
     * Determines whether a value is valid (returning a boolean value), returning the problem as a string if invalid,
     * otherwise returning null when valid.
     */
    static getValidationError<T>(value: IntentionalAny, validator: Validator<T>, providedOptions?: IsValidValueOptions): string | null;
    private static getValueTypeValidationError;
    /**
     * Validate a type that can be a type, or an array of multiple types. Does not add validationMessage to any error
     * it reports
     */
    private static getValueOrElementTypeValidationError;
    /**
     * Compare the two provided values for equality using the valueComparisonStrategy provided, see
     * ValueComparisonStrategy type.
     */
    static equalsForValidationStrategy<T>(a: T, b: T, valueComparisonStrategy?: ValueComparisonStrategy<T>): boolean;
    static readonly VALIDATOR_KEYS: (keyof Validator<unknown>)[];
    /**
     * General validator for validating that a string doesn't have template variables in it.
     */
    static readonly STRING_WITHOUT_TEMPLATE_VARS_VALIDATOR: Validator<string>;
}
export {};
//# sourceMappingURL=Validation.d.ts.map