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

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

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

const mapDispatchToProps = {
  loadData: settings.actions.load.request.action,
  deleteItem: settings.actions.delete.request.action,

  loadACField: settings.actions.acFieldInfo.request.action,

  dialogShow: app.actions.dialog.show.action,
};

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

export default Wrapped;
