import React from 'react'; import { Label } from '@/components/ui/label'; import { Input } from '@/components/ui/input'; import { Textarea } from '@/components/ui/textarea'; import { Switch } from '@/components/ui/switch'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Checkbox } from '@/components/ui/checkbox'; export interface FieldSchema { type: 'text' | 'textarea' | 'email' | 'url' | 'number' | 'toggle' | 'checkbox' | 'select' | 'multiselect'; label: string; description?: string; placeholder?: string; required?: boolean; default?: any; options?: Record; min?: number; max?: number; disabled?: boolean; } interface SchemaFieldProps { name: string; schema: FieldSchema; value: any; onChange: (value: any) => void; error?: string; } export function SchemaField({ name, schema, value, onChange, error }: SchemaFieldProps) { const renderField = () => { switch (schema.type) { case 'text': case 'email': case 'url': return ( onChange(e.target.value)} placeholder={schema.placeholder} required={schema.required} /> ); case 'number': return ( onChange(e.target.value === '' ? 0 : parseFloat(e.target.value))} placeholder={schema.placeholder} required={schema.required} min={schema.min} max={schema.max} /> ); case 'textarea': return (