// #region Imports
import { ElementValidatorBase } from './Abstracts/ElementValidatorBase';
import { requiredValidator } from './RequiredElementValidatorFn';
/**
 * @public
 */
export class RequiredElementValidator extends ElementValidatorBase {
    // #region Ctor
    constructor(host, messageResolver) {
        super(host, messageResolver ?? ((_params) => 'The value is required.'));
    }
    // #endregion
    // #region Properties
    get attributes() {
        return ['required', 'value'];
    }
    // #endregion
    // #region Methods
    validate() {
        const errors = requiredValidator(this.host);
        return this.getMessage(errors);
    }
}
/**
 * A factory function for the {@link RequiredElementValidator}.
 *
 * @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 requiredElementValidator(messageResolver) {
    const fn = ([host]) => {
        const validator = new RequiredElementValidator(host, messageResolver);
        return validator;
    };
    return fn;
}
//# sourceMappingURL=RequiredElementValidator.js.map