import * as Yup from 'yup';

export const LoginSchema = Yup.object().shape({
  email: Yup.string().email('Invalid email').required('Required'),
  password: Yup.string().required('Required'),
});

export const SignupSchema = Yup.object().shape({
  email: Yup.string()
    .required('Email is required.')
    .email('Please enter a valid email'),
  firstName: Yup.string().required('First name is required.'),
  lastName: Yup.string().required('Last name is required.'),
  password: Yup.string()
    .required('No password provided.')
    .min(8, 'Password is too short - should be 8 chars minimum.')
    .matches(
      /^.*[!@#$%^&*()_+\-={};':"\\|,.<>/?].*$/,
      'Need one special character'
    ),
});

export const minMaxValidation = Yup.object().shape({
  max: Yup.number(),
  min: Yup.number().lessThan(Yup.ref('max'), 'min should be less than max'),
});

export const ForgotPasswordSchema = Yup.object().shape({
  email: Yup.string().email('Invalid email').required('Required'),
});

export const ResetPasswordSchema = Yup.object().shape({
  password: Yup.string()
    .required('Password is required.')
    .min(8, 'Password is too short - should be 8 chars minimum.')
    .matches(
      /^.*[!@#$%^&*()_+\-={};':"\\|,.<>/?].*$/,
      'Need one special character'
    ),
});
