import TextField from "@mui/material/TextField";
import MenuItem from "@mui/material/MenuItem";

const maxCpuSupported = 8;
export const cpuOptions = new Array(2 * maxCpuSupported)
  .fill(0)
  .map((v, i) => (i + 1) * 0.5);

export default function CpuOption(props) {
  const { value, onChange } = props;
  return (
    <TextField
      label="CPU"
      onChange={onChange}
      value={value ?? cpuOptions[0]}
      select
      required
      SelectProps={{ MenuProps: { sx: { maxHeight: "20rem" } } }}
      disabled // TODO: Enable on backend support
    >
      {cpuOptions.map((o, i) => (
        <MenuItem value={o} key={i}>{`${o} CPU`}</MenuItem>
      ))}
    </TextField>
  );
}
