import { z } from "zod";

export const loginSchema = z.object({
  email: z.string().email(),
  password: z.string().min(1)
});

const uniqueUuidArraySchema = z.array(z.string().uuid()).transform((values) => Array.from(new Set(values)));

export const preferencesPatchSchema = z
  .object({
    equipmentCategoryOrder: uniqueUuidArraySchema.optional(),
    equipmentItemOrder: uniqueUuidArraySchema.optional()
  })
  .refine((value) => Object.keys(value).length > 0, {
    message: "At least one preference field must be provided"
  });
