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

import Stats, { StateProps, DispatchProps, OwnProps } from './Stats';

const mapStateToProps = (state: StoreState): Record<string, any> => ({
  statistics: state.stats,
});

const mapDispatchToProps = {
  getAll: stats.actions.getAll.request.action,
  refreshAll: stats.actions.refreshAll.request.action,
};

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

export default Wrapped;
