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)), defaultVatRate: z .union([z.number(), z.string()]) .optional() .transform((v) => { if (v === undefined || v === "") return 20; const n = typeof v === "string" ? Number(v.replace(",", ".")) : v; return Number.isFinite(n) ? n : 20; }) .pipe(z.number().min(0, "Negatif olamaz.").max(100, "100'den büyük olamaz.")), invoicePrefix: z .string() .trim() .max(10) .optional() .transform((v) => (v ? v.toUpperCase() : "INV")), }); export type WorkspaceSettingsInput = z.infer;