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