"use client";
import { Input } from "@/components/ui/input";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import type { MetadataField } from "@/types/knowledge-base";
import { useI18n } from "@/i18n/i18n-context";
interface MetadataFieldInputProps {
field: MetadataField;
value: string;
onChange: (next: string) => void;
}
/**
* Controlled input for a single KB metadata schema field. Empty string means
* "field unset" — the parent form's converter skips empty values when
* building the request payload.
*/
export function MetadataFieldInput({
field,
value,
onChange,
}: MetadataFieldInputProps) {
const { t } = useI18n();
if (field.type === "boolean") {
return (
);
}
const isList = field.type.endsWith("_list");
const isNumber = field.type === "long" || field.type === "double";
return (
onChange(e.target.value)}
/>
);
}