// GCodeFileSelect.js
import PropTypes from 'prop-types'
import React from 'react'
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`}
      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
