import { z } from "zod";

export const workspaceSettingsSchema = z.object({
  companyName: z.string().trim().min(1, "Şirket adı zorunlu.").max(255),
  companyTaxId: z
    .string()
    .trim()
    .max(50)
    .optional()
    .transform((v) => (v ? v : undefined)),
  companyAddress: z
    .string()
    .trim()
    .max(500)
    .optional()
    .transform((v) => (v ? v : undefined)),
  companyEmail: z
    .union([z.string().email("Geçerli bir email girin."), z.literal("")])
    .optional()
    .transform((v) => (v ? v : undefined)),
  companyPhone: z
    .string()
    .trim()
    .max(30)
    .optional()
    .transform((v) => (v ? v : undefined)),
  defaultCurrency: z
    .string()
    .trim()
    .max(8)
    .optional()
    .transform((v) => (v ? v.toUpperCase() : "TRY")),
});

export type WorkspaceSettingsInput = z.infer<typeof workspaceSettingsSchema>;
