import { connect } from 'react-redux';
import { StoreState } from 'store/rootReducer';

import forms from 'store/forms';
import app from 'store/app';
import List, { StateProps, DispatchProps, OwnProps } from './List';

const mapStateToProps = (state: StoreState): {} => ({
  result: state.forms.result,
  detail: state.forms.detail,
  lg: state.content.lg,
});

const mapDispatchToProps = {
  getForm: forms.actions.detail.request.action,
  dialogShow: app.actions.dialog.show.action,
  dialogHide: app.actions.dialog.hide.action,
  exportPDF: forms.actions.exportFormData.request.action,
};

const Wrapped = connect<StateProps, DispatchProps, OwnProps>(
  mapStateToProps,
  mapDispatchToProps,
)(List);

export default Wrapped;
