import * as Yup from 'yup'

export const PersonalInformationValidators = Yup.object({

    Salutation: Yup.string()
      .required('Salutation is required'),
    FirstName: Yup.string()
      .required('First Name is required'),
    LastName: Yup.string()
      .required('Last Name is required'),
    Gender: Yup.string()      
      .required('Gender is required'),
    DOB: Yup.date()
    .required('Birthdate is required'),
    PhoneNo: Yup.string()
      .min(10)
      .max(10)
      .required('Phone number is required')
      .matches(
        /^((\\+[1-9]{1,4}[ \\-]*)|(\\([0-9]{2,3}\\)[ \\-]*)|([0-9]{2,4})[ \\-]*)*?[0-9]{3,4}?[ \\-]*[0-9]{3,4}?$/,
        "Phone number is not valid"
      ),    
    Email: Yup.string().email()
    .required('Email is required'),
    
   
})

export const EducationInformationValidators = Yup.object({
    Qualification: Yup.array().of(
        Yup.object().shape({
            Details: Yup.string()
                .required('Details is required'),
            CompletionYear: Yup.string()
                .required('CompletionYear is required')
        })
        ).min(1, 'Qualification is required'),

        WorkExperience: Yup.array().of(
        Yup.object().shape({
            Details: Yup.string()
                .required('Details is required'),
            FromDate: Yup.string()
                .required('FromDate is required'),
            TillDate: Yup.string()
                .required('Till-Date is required'),
        })
        ).min(1, 'Work experience is required'),

        Certification: Yup.array().of(
        Yup.object().shape({
            Details: Yup.string()
                .required('Details is required'),
            CompletionYear: Yup.string()
                .required('CompletionYear is required')
        })
        ).min(1, 'Certification is required'),

        RegisterReason: Yup.string()
        .required('Register reason is required')

})

  export const AddressInformationValidators = Yup.object({
    City: Yup.string()
      .required('City is required'),
    Street: Yup.string()
      .required('Street is required'),
    State: Yup.string()
      .required('State is required'),
    PinCode: Yup.string()
      .required('Pin code is required')
      .matches(/^[1-9]{1}[0-9]{2}[0-9]{3}$/, "Pin code is invalid"),
    Country: Yup.string()
      .required('Country is required'),
    
  })