import { z } from "zod";

import { RiskEnum } from "@/constants/riskEnum";

export const userSchema = z.object({
  firstName: z.string().trim().min(1, "First name is required"),
  lastName: z.string().trim().min(1, "Last name is required"),
  email: z
    .string()
    .trim()
    .min(1, "Email is required")
    .pipe(z.email("Enter a valid email address")),
  title: z.string().trim().min(1, "Title is required"),
  riskStatus: z.enum(RiskEnum).default(RiskEnum.LOW_RISK),
});

export const userSchemaWithId = userSchema.extend({
  id: z.string().optional(),
});

export type UserFormValues = z.input<typeof userSchemaWithId>;
