import type { ReactNode } from "react";
import type { SelectProps as MUISelectProps } from "@mui/material/Select";
import { ReactElement } from "react";

import type { IconProps } from "../icon/Icon";
import type { InputProps } from "../input/Input";

export type SelectOption = {
  value: string;
  label: string;
  disabled?: boolean;
  icon?: IconProps["name"] | ReactElement;
  showIconInChip?: boolean;
  groupLabel?: string;
};

export type GroupedSelectOption = {
  label: string;
  options: SelectOption[];
  primary?: boolean;
};

export interface SelectProps extends MUISelectProps {
  label?: string | ReactNode;
  placeholder?: string;
  options: SelectOption[] | GroupedSelectOption[];
  errorText?: string;
  height?: InputProps["height"];
}
