import { z } from "zod";

const requiredString = (requiredMessage: string) =>
  z.preprocess(
    (value) => value ?? "",
    z.string().trim().min(1, requiredMessage),
  );

export const sightEngineSettingsSchema = z.object({
  apiUser: requiredString("Sightengine API user is required."),

  apiSecret: requiredString("Sightengine API secret is required."),

  imageDetection: z.boolean(),
});

export type SightEngineSettingsFormValues = z.infer<
  typeof sightEngineSettingsSchema
>;
