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

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

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

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

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

    return (config.length > 0 && <WeaRadioGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaRadioGroup@gzntth`}
              config={ config}
              onChange={params => radioGroupCallBack(params)}
            />)
  }
}