import { z } from 'zod'; export const headerNavItemSchema = z.object({ id: z.string().min(1), label: z.string().min(1).max(50), path: z.string().min(1).max(500) .refine( (v) => !/^(javascript|data|vbscript):/i.test(v), 'Dangerous URL scheme not allowed', ), icon: z.string().max(50).optional(), enabled: z.boolean(), order: z.number().int().min(0), type: z.enum(['builtin', 'custom']), openInNewTab: z.boolean().optional(), }); export const headerStyleSchema = z.object({ backgroundColor: z.string().max(500), textColor: z.string().regex(/^#[0-9a-fA-F]{6}$/, 'Must be a hex color'), hoverColor: z.string().max(100), height: z.string().regex(/^\d+px$/, 'Must be in px format'), }); export const headerConfigSchema = z.object({ enabled: z.boolean(), items: z.array(headerNavItemSchema).max(20), style: headerStyleSchema, }); export type HeaderNavItem = z.infer; export type HeaderStyle = z.infer; export type HeaderConfig = z.infer;