import { array, number, object, string } from 'yup' import { passwordRule } from '@/constants/rules/passwordRule' import { phoneNumberRule } from '@/constants/rules/phoneNumberRule' import { nationalCodeRule } from '@/constants/rules/nationalCodeRule' import { passwordConfirmationRule } from '@/constants/rules/passwordConfirmationRule' export const rejectionReasonSchema = object().shape({ reason: string().required(), }) const baseUserShape = { roles: array().of(string().required()).min(1, 'حداقل یک نقش را انتخاب کنید').required(), name: string().required().min(3), phone: phoneNumberRule, nationalCode: nationalCodeRule, birthday: string().nullable().notRequired(), maritalStatus: string().nullable().notRequired(), gender: string().nullable().notRequired(), bio: string().nullable().notRequired(), provinceId: string().nullable().notRequired(), cityId: string().nullable().notRequired(), address: string().nullable().notRequired(), avatarMediaId: number().typeError('شناسه تصویر پروفایل باید عدد باشد').nullable().notRequired(), } export const userAddSchema = object().shape({ ...baseUserShape, password: passwordRule, passwordConfirmation: passwordConfirmationRule, }) export const userEditSchema = object().shape(baseUserShape)