import { Select } from '../../reusable/Select';

export function SelectField({
  label,
  required,
  value,
  options,
  onChange,
}: {
  label: string;
  required?: boolean;
  value: string;
  options: any[];
  onChange: (val: string) => void;
}) {
  return (
    <Select
      label={label}
      required={required}
      value={value ?? ''}
      onChange={(e) => onChange(e.target.value)}
      options={[{ value: '', label: 'Select...' }, ...options.map((o: any) => ({ value: String(o.value), label: o.label }))]}
    />
  );
}
