// #region Imports
import { ElementValidatorBase } from './Abstracts/ElementValidatorBase';
import { maxValidator } from './MaxElementValidatorFn';
/**
 * @public
 */
export class MaxElementValidator extends ElementValidatorBase {
    // #region Ctor
    constructor(host, messageResolver) {
        super(host, messageResolver ?? ((params) => `The value must be less than or equal to ${params.max}.`));
    }
    // #endregion
    // #region Properties
    get attributes() {
        return ['max', 'value'];
    }
    // #endregion
    // #region Methods
    validate() {
        const errors = maxValidator(this.host);
        return this.getMessage(errors);
    }
}
/**
 * A factory function for the `MaxElementValidator`.
 *
 * @public
 * @param resolver - A *optional* message resolver to get the error message that will be displayed. When not provided, a default message will be used.
 */
export function maxElementValidator(resolver) {
    return (host) => {
        return new MaxElementValidator(host, resolver);
    };
}
//# sourceMappingURL=MaxElementValidator.js.map