import PropTypes from 'prop-types'
import FormGroup from '@mui/material/FormGroup'
import FormControlLabel from '@mui/material/FormControlLabel'
import Switch from '@mui/material/Switch'

export default function OtomatikSwitch({tradiksyonOtomatik, setTradiksyonOtomatik, disabled}) {
  const handleChange = event => {
    setTradiksyonOtomatik(event.target.checked)
  }

  return (
    <FormGroup sx={{marginTop: 1}}>
      <FormControlLabel
        control={<Switch checked={tradiksyonOtomatik && !disabled} onChange={handleChange} />}
        disabled={disabled}
        label='Traduction du français vers les autres langues (remplir uniquement la traduction française)'
      />
    </FormGroup>
  )
}

OtomatikSwitch.propTypes = {
  tradiksyonOtomatik: PropTypes.bool.isRequired,
  setTradiksyonOtomatik: PropTypes.func.isRequired,
  disabled: PropTypes.bool.isRequired
}
