import React from "react";
import InputWithDropDown from "../../../ui/inputs/InputWithDropDown";
import InputRange from "../../../ui/inputs/InputRange";
import { AnalysisPresetsType } from "../../../../types/analysis";

interface InputRendererProps {
  keyName: string;
  presets: AnalysisPresetsType[keyof AnalysisPresetsType];
}

const RenderAnalysisInputs: React.FC<InputRendererProps> = ({
  keyName,
  presets,
}) => {
  return (
    <div key={`main-${keyName}`} className="analysis-inputs">
      {presets.map((preset, index) => {
        if (preset.type === "default") {
          return (
            <InputWithDropDown
              key={index}
              label={preset.inputs.label}
              value=""
              activeOption={preset.inputs.activeOption}
              onChange={() => {}}
            />
          );
        }
        if (preset.type === "range") {
          return (
            <InputRange
              key={index}
              label={preset.inputs.label}
              min={0}
              max={0}
              value={5}
            />
          );
        }
        return null;
      })}
    </div>
  );
};

export default RenderAnalysisInputs;
