import { z } from "zod";

export const projectSchema = z
  .object({
    projectName: z.string().min(1, "Project name is required"),

    projectDescription
: z.string("Description is required"),
    projectStatus: z.string(),

   projectManager: z
  .string("Invalid"),


    projectTeam: z
      .array(z.string())
      .min(1, "Select at least one team member"),

    contractedStartDate: z.string().min(1, "Start date is required"),

    contractedEndDate: z.string().min(1, "End date is required"),

    source: z.string("manual").optional(),

    productType: z.string().optional(),
  })
  .refine(
    (data) =>
      new Date(data.contractedEndDate) >=
      new Date(data.contractedStartDate),
    {
      message: "End date must be after start date",
      path: ["contractedEndDate"],
    }
  );

export type ProjectFormData = z.infer<typeof projectSchema>;
