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

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

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

const mapDispatchToProps = {
  loadData: shop.actions.load.request.action,
  deleteItem: shop.actions.delete.request.action,
  loadOneData: shop.actions.loadOne.request.action,

  // Orders
  orderMarkPaid: shop.actions.order.markPaid.request.action,
  orderMarkUnPain: shop.actions.order.markUnPaid.request.action,
  orderCancel: shop.actions.order.cancel.request.action,
  orderReimburse: shop.actions.order.reimburse.request.action,
};

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

export default Wrapped;
