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

const propertyOrder = [
  'filament.diameter',
  'filament.type',
  'filament.vendor.name'
]

const GCodeFileSelect = ({ onChange, filter, useFilter = false, style }) => {
  return (
    <ObjectSelect
      endpoint={`${config.backendUrl}/gcodefiles/properties`}
      propertyOrder={propertyOrder}
      filter={filter}
      useFilter={useFilter}
      onChange={onChange}
      showSearch={true}
      style={style}
      placeholder='Select GCode File'
      type='gcodeFile'
    />
  )
}

GCodeFileSelect.propTypes = {
  onChange: PropTypes.func,
  filter: PropTypes.object,
  useFilter: PropTypes.bool,
  style: PropTypes.object
}

export default GCodeFileSelect
