import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";

interface FreeTextInputProps {
  questionId: string;
  value: string;
  onChange: (value: string) => void;
  multiline?: boolean;
  placeholder?: string;
}

export function FreeTextInput({
  questionId,
  value,
  onChange,
  multiline = false,
  placeholder,
}: FreeTextInputProps) {
  if (multiline) {
    return (
      <Textarea
        id={questionId}
        value={value}
        onChange={(e) => onChange(e.target.value)}
        placeholder={placeholder ?? "Type your answer..."}
        className="min-h-[80px]"
      />
    );
  }

  return (
    <Input
      id={questionId}
      value={value}
      onChange={(e) => onChange(e.target.value)}
      placeholder={placeholder ?? "Type your answer..."}
    />
  );
}
