// #region Imports
import { ElementValidatorBase } from './Abstracts/ElementValidatorBase';
import { phoneNumberValidator, isPhoneNumberValue as _isPhoneNumberValue } from './PhoneNumberElementValidatorFn';
/**
 * @public
 */
export class PhoneNumberElementValidator extends ElementValidatorBase {
    // #region Ctor
    constructor(host, messageResolver) {
        super(host, messageResolver ?? ((_params) => 'The value is not a valid phone number.'));
    }
    // #endregion
    // #region Properties
    get attributes() {
        return ['value'];
    }
    // #endregion
    // #region Methods
    validate() {
        const errors = phoneNumberValidator(this.host);
        return this.getMessage(errors);
    }
}
(function (PhoneNumberElementValidator) {
    PhoneNumberElementValidator.isPhoneNumberValue = _isPhoneNumberValue;
})(PhoneNumberElementValidator || (PhoneNumberElementValidator = {}));
/**
 * A factory function for the {@link PhoneNumberElementValidator}.
 *
 * @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 phoneNumberElementValidator(messageResolver) {
    const fn = ([host]) => {
        const validator = new PhoneNumberElementValidator(host, messageResolver);
        return validator;
    };
    return fn;
}
//# sourceMappingURL=PhoneNumberElementValidator.js.map