import { z } from "zod";

const urlField = (example: string) =>
  z.union([
    z.literal(""),
    z.string().trim().url(`Please enter a valid URL (e.g. ${example})`),
  ]);

export const socialMediaSettingsSchema = z.object({
  facebook: urlField("https://facebook.com/username"),
  instagram: urlField("https://instagram.com/username"),
  twitter: urlField("https://x.com/username"),
  linkedIn: urlField("https://linkedin.com/in/username"),
  youtube: urlField("https://youtube.com/c/channel"),
  customLink: urlField("https://example.com"),
});

export type SocialMediaSettingsFormValues = z.infer<
  typeof socialMediaSettingsSchema
>;
