import { type RegisterOptions } from 'react-hook-form'

const PasswordConstraints = {
  required: true,
  minLength: 2,
  validate: {
    hasLowerCase: (value: string) => { return /[a-z]/.test(value) },
    hasUpperCase: (value: string) => { return /[A-Z]/.test(value) },
    hasNumber: (value: string) => { return /[0-9]/.test(value) },
    hasSpecial: (value: string) => { return /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]+/.test(value) }
  }
}

const PasswordErrorMessages = {
  minLength: 'Password must be at least 2 characters.',
  hasLowerCase: 'Must have at least one lowercase letter.',
  hasUpperCase: 'Must have at least one uppercase letter.',
  hasNumber: 'Must have at least one number.',
  hasSpecial: 'Must have at least one special character.'
}

export default {
  PasswordConstraints,
  PasswordErrorMessages
}
