import type { FieldRendererProps } from "./types";
import { DateFieldRenderer } from "./date-field-renderer";
import { MultiTextFieldRenderer } from "./multi-text-field-renderer";
import { NumberFieldRenderer } from "./number-field-renderer";
import { SelectFieldRenderer } from "./select-field-renderer";
import { TextFieldRenderer } from "./text-field-renderer";

export function FieldRendererRegistry(props: FieldRendererProps) {
  if (props.card.valueType === "NUMBER") {
    return <NumberFieldRenderer {...props} />;
  }

  if (props.card.valueType === "TEXT") {
    return <TextFieldRenderer {...props} />;
  }

  if (props.card.valueType === "SELECT") {
    return <SelectFieldRenderer {...props} />;
  }

  if (props.card.valueType === "MULTI_TEXT") {
    return <MultiTextFieldRenderer {...props} />;
  }

  if (props.card.valueType === "DATE") {
    return <DateFieldRenderer {...props} />;
  }

  return null;
}
