import Select, { ISelectProps, ISelectOption } from '@/components/select';
import { EmployType, FULL_EMPLOY_SALARY_OPTIONS, PART_EMPLOY_SALARY_OPTIONS } from '@/constants/job';
import { SalaryRange } from '@/types/job';

interface IProps extends Omit<ISelectProps<SalaryRange>, 'options'> {
  type: EmployType;
}

const PART_OPTIONS: ISelectOption<SalaryRange>[] = PART_EMPLOY_SALARY_OPTIONS;

const FULL_OPTIONS: ISelectOption<SalaryRange>[] = FULL_EMPLOY_SALARY_OPTIONS;

function SalarySelect(props: IProps) {
  const { type, value: selectValue, onSelect } = props;
  const isPart = type === EmployType.Part;
  const options = isPart ? PART_OPTIONS : FULL_OPTIONS;
  return <Select options={options} title={isPart ? '兼职薪资' : '全职薪资'} value={selectValue} onSelect={onSelect} />;
}

export default SalarySelect;
