import { VersionService } from '@zeedhi/core';
import { Password } from '@zeedhi/common';

class StrongPassword extends Password {
    constructor(props) {
        super(props);
        /** password min length */
        this.secureLength = 7;
        /** error class for password count badge */
        this.errorClass = 'zd-strong-password-error';
        /** success class for password count badge */
        this.successClass = 'zd-strong-password-success';
        /** strength-meter class */
        this.strengthMeterClass = 'zd-strong-password-meter';
        /** Hide the Strength Meter if you want to implement your own */
        this.showStrengthMeter = true;
        /** Array of strings that zxcvbn will treat as an extra dictionary */
        this.userInputs = [];
        /** Password strength score */
        this.strengthScore = 0;
        this.instaceType = StrongPassword;
        this.secureLength = this.getInitValue('secureLength', props.secureLength, this.secureLength);
        this.errorClass = this.getInitValue('errorClass', props.errorClass, this.errorClass);
        this.successClass = this.getInitValue('successClass', props.successClass, this.successClass);
        this.strengthMeterClass = this.getInitValue('strengthMeterClass', props.strengthMeterClass, this.strengthMeterClass);
        this.showStrengthMeter = this.getInitValue('showStrengthMeter', props.showStrengthMeter, this.showStrengthMeter);
        this.userInputs = this.getInitValue('userInputs', props.userInputs, this.userInputs);
        this.createAccessors();
    }
}

const packageContent = require('../package.json');
VersionService.addPackageVersion(packageContent.name, packageContent.version);

export { StrongPassword };
