import { z } from "zod"; export const editScanFormSchema = (currentName: string) => z.object({ scanName: z .string() .refine((val) => val === "" || val.length >= 3, { message: "The alias must be empty or have at least 3 characters.", }) .refine((val) => val !== currentName, { message: "The new name must be different from the current one.", }) .optional(), scanId: z.string(), }); export const onDemandScanFormSchema = () => z.object({ providerId: z.string(), scanName: z.string().optional(), scannerArgs: z .object({ checksToExecute: z.array(z.string()), }) .optional(), }); export const scheduleScanFormSchema = () => z.object({ providerId: z.string(), scheduleDate: z.string(), }); export const addProviderFormSchema = z.object({ providerType: z.string(), providerAlias: z.string(), providerId: z.string(), }); export const editProviderFormSchema = (currentAlias: string) => z.object({ alias: z .string() .refine((val) => val === "" || val.length >= 3, { message: "The alias must be empty or have at least 3 characters.", }) .refine((val) => val !== currentAlias, { message: "The new alias must be different from the current one.", }) .optional(), providerId: z.string(), });