import { object, string } from 'yup'
import { passwordRule } from '@/constants/rules/passwordRule'
import { phoneNumberRule } from '@/constants/rules/phoneNumberRule'
import { passwordConfirmationRule } from '@/constants/rules/passwordConfirmationRule'

export const loginSchema = object().shape({
  phone: phoneNumberRule,
  password: string().required(),
})

export const loginWithCodeSchema = object().shape({
  phone: phoneNumberRule,
})

export const signupSchema = object().shape({
  firstName: string().required().min(3),
  lastName: string().required().min(3),
  phone: phoneNumberRule,
  password: passwordRule,
  passwordConfirmation: passwordConfirmationRule,
})

export const verifyCodeSchema = object().shape({
  code: string().required().length(6),
})

export const resetPasswordSchema = object().shape({
  password: passwordRule,
  passwordConfirmation: passwordConfirmationRule,
})
