import { Controller } from "react-hook-form";
import FilterField from "./FilterField";

const FilterController = ({ item, control, reset, errors }) => {
  return (
    <Controller
      name={`${item.id}`}
      control={control}
      render={({ field: { value, onBlur, onChange } }) => {
        return (
          <FilterField
            item={item}
            filterParameters={value}
            handleChange={onChange}
            handleBlur={onBlur}
            dependencyFieldValue={null}
            resetForm={() => reset()}
            errors={errors}
          />
        );
      }}
    />
  );
};
export default FilterController;
