"use client";

import {
  FormControl,
  InputLabel,
  MenuItem,
  OutlinedInput,
  Select,
} from "@mui/material";
function CustomSelect({ column, filterParameters, handleChange }) {
  return (
    <FormControl fullWidth sx={{ marginY: 1 }} size="small">
      <InputLabel id={`label${column.id}`} shrink>
        {column.header}
      </InputLabel>
      <Select
        labelId={`label${column.id}`}
        id={column.id}
        name={`${column.id}.value`}
        value={filterParameters.value}
        input={<OutlinedInput label={column.header} />}
        size="small"
        onChange={(e) =>
          handleChange({ ...filterParameters, value: e.target.value })
        }
        displayEmpty
      >
        {column.columnSelectOption().map((option) => (
          <MenuItem key={option.value} value={option.value}>
            {option.label}
          </MenuItem>
        ))}
      </Select>
    </FormControl>
  );
}

export default CustomSelect;
