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

const FilamentStockSelect = ({
  onChange,
  filter = {},
  useFilter = false,
  value,
  disabled = false
}) => {
  return (
    <ObjectSelect
      endpoint={`${config.backendUrl}/filamentstocks`}
      propertyOrder={['tags']}
      filter={filter}
      useFilter={useFilter}
      value={value}
      onChange={onChange}
      disabled={disabled}
      placeholder='Select a filament stock'
      type='filamentstock'
    />
  )
}

FilamentStockSelect.propTypes = {
  onChange: PropTypes.func.isRequired,
  value: PropTypes.object,
  filter: PropTypes.object,
  useFilter: PropTypes.bool,
  disabled: PropTypes.bool
}

export default FilamentStockSelect
