import { z } from "zod"

import { _ } from "@/lib/translation"

import { phoneValidator } from "@/utils/phoneValidator"

export const editProfileSchema = z.object({
  "address.country": z
    .string({ required_error: _("Country is required") })
    .min(1, { message: _("Country is required") }),
  "address.city": z.string().optional(),
  "address.streetAddress": z.string().optional(),
  "address.zipCode": z
    .string({ required_error: _("Zip code is required") })
    .min(1, { message: _("Zip code is required") }),
  dateOfBirth: z
    .string({ required_error: _("Date of Birth is required") })
    .min(1, { message: _("Date of Birth is required") }),
  email: z.string().email(),
  phoneNumber: phoneValidator(
    _("Phone is required"),
    _("Please enter a valid phone number")
  ),
})

export type EditProfileSchema = z.infer<typeof editProfileSchema>
