import SelectGroup, { SelectOption } from './SelectGroup';
import { SelectGroupPropsHelper } from './SelectGroupPropsHelper';

const booleanOptions: SelectOption<boolean>[] = [
  {
    label: 'Yes',
    value: true,
  },
  {
    label: 'No',
    value: false,
  },
];

export interface BooleanSelectGroupProps
  extends Omit<SelectGroupPropsHelper<boolean | undefined | null>, 'options'> {
  options?: SelectOption<boolean>[];
}
/** A `<SelectGroup/>` dropdown with two options. Default options are 'Yes' and 'No' with values of `true` and `false`. */
export function BooleanSelectGroup(props: BooleanSelectGroupProps) {
  return (
    <SelectGroup
      multiple={false}
      {...props}
      options={props.options ?? booleanOptions}
    />
  );
}
