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

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

const mapStateToProps = (state: StoreState): {} => ({
  forms: state.forms.list,
});

const mapDispatchToProps = {
  getAllForms: forms.actions.list.request.action,
  deleteOneForm: forms.actions.delete.request.action,
  sideMenuShow: app.actions.sideMenu.show.action,
  sideMenuHide: app.actions.sideMenu.hide.action,
  dialogShow: app.actions.dialog.show.action,
};

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

export default Wrapped;
