import { useState, useRef, useCallback, useEffect } from 'react' import { Send, Terminal, UserPlus, HardDrive, RotateCcw } from 'lucide-react' import type { LucideIcon } from 'lucide-react' import { cn } from '@/lib/utils' const SUGGESTIONS: { icon: LucideIcon; label: string }[] = [ { icon: UserPlus, label: 'Create a new AD user' }, { icon: HardDrive, label: 'Check disk space on all servers' }, { icon: RotateCcw, label: 'Restart a Windows service' }, { icon: Terminal, label: 'Reset MFA for a user' }, ] interface ScriptBuilderInputProps { onSend: (content: string) => void disabled: boolean placeholder?: string showSuggestions?: boolean } export function ScriptBuilderInput({ onSend, disabled, placeholder = 'Describe the script you need...', showSuggestions = false, }: ScriptBuilderInputProps) { const [value, setValue] = useState('') const textareaRef = useRef(null) const adjustHeight = useCallback(() => { const textarea = textareaRef.current if (!textarea) return textarea.style.height = 'auto' textarea.style.height = `${Math.min(textarea.scrollHeight, 120)}px` }, []) useEffect(() => { adjustHeight() }, [value, adjustHeight]) const handleSend = () => { const trimmed = value.trim() if (!trimmed || disabled) return onSend(trimmed) setValue('') } const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault() handleSend() } } const canSend = value.trim().length > 0 && !disabled return (