var BaseValidator = require('libresignage/ui/validator/BaseValidator');

/**
* @typedef {object} BlacklistValidatorSettings
*
* @property {array|function} bl The blacklist to use.
*
* @memberof module:libresignage/ui/validator
* @alias    BlacklistValidatorSettings
*/

/**
* Class for validating inputs against a blacklist.
*
* @memberof module:libresignage/ui/validator
*/
class BlacklistValidator extends BaseValidator {
	/**
	* Construct a new BlacklistValidator object.
	*
	* @param {BlacklistValidatorSettings} settings
	* @param {string}                     msg
	* @param {boolean}                    nostyle
	*
	* @see {@link module:libresignage/ui/validator.BaseValidator} Parent class.
	*/
	constructor(...args) {
		super(...args);
		this.chk_settings(['bl']);
	}

	validate(element) {
		return !this.settings.bl.includes(element.value);
	}
}
module.exports = BlacklistValidator;
