import PropTypes from 'prop-types'
import config from '../../../config'
import ObjectSelect from './ObjectSelect'

const propertyOrder = ['country']

const VendorSelect = ({ onChange, filter = {}, useFilter = false, value }) => {
  return (
    <ObjectSelect
      endpoint={`${config.backendUrl}/vendors`}
      propertyOrder={propertyOrder}
      filter={filter}
      useFilter={useFilter}
      value={value}
      onChange={onChange}
      placeholder='Select a vendor'
      type={'vendor'}
    />
  )
}

VendorSelect.propTypes = {
  onChange: PropTypes.func,
  value: PropTypes.object,
  filter: PropTypes.object,
  useFilter: PropTypes.bool
}

export default VendorSelect
