import {
  inject,
  observer,
} from 'mobx-react';
import {
  toJS,
} from 'mobx'
import {
  WeaRadioGroup,
} from 'ecCom'

@inject('hrmApplicant')
@observer
export default class RadioGroup extends React.Component {
  constructor(props) {
    super(props);
  }

  componentDidMount() {
    this.props.hrmApplicant.getRadioGroupDatas();
  }

  componentWillUnmount() {
    this.props.hrmApplicant.resetRadioGroup();
  }

  render() {
    const {
      hrmApplicant
    } = this.props, {
      radioGroup,
      radioGroupCallBack
    } = hrmApplicant, {
      config
    } = radioGroup;

    return (
      <div style={{padding: 16}}>
          {config.length > 0 && <WeaRadioGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaRadioGroup@430qnh`}
              config={ config}
              onChange={params => radioGroupCallBack(params)}
          />}
        </div>
    )
  }
}