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

import event from 'store/event';
import shop from 'store/shop';
import Manage, { StateProps, DispatchProps, OwnProps } from './Manage';

const mapStateToProps = (state: StoreState): {} => ({
  detail: state.event.detail,
});

const mapDispatchToProps = {
  addData: event.actions.add.request.action,
  loadData: event.actions.loadOne.request.action,
  editData: event.actions.edit.request.action,
  searchData: event.actions.search.request.action,
  searchShopData: shop.actions.search.request.action,
};

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

export default Wrapped;
