import { z } from 'zod';

export const CreateUserSchema = z.object({
  personalCode: z
    .string()
    .regex(/^[1-6]\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}\d$/, {
      message: 'Invalid Estonian personal code format',
    }),
  email: z.string().email({ message: 'Please enter a valid email address' }),
  password: z
    .string()
    .min(8, { message: 'Password must be at least 8 characters' }),
  emailConfirm: z.boolean().default(false).optional(),
});

export type CreateUserSchemaType = z.infer<typeof CreateUserSchema>;
