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

import event from 'store/event';
import app from 'store/app';
import Participant, { StateProps, DispatchProps, OwnProps } from './Participant';

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

const mapDispatchToProps = {
  load: event.actions.participant.load.request.action,
  deleteParticipant: event.actions.participant.remove.request.action,
  addParticipant: event.actions.participant.add.request.action,
  showSideMenu: app.actions.sideMenu.show.action,
  dialogShow: app.actions.dialog.show.action,
  exportAttestation: event.actions.participant.exportAttestationPDF.request.action,
  markAsParticipated: event.actions.participant.markAsParticipate.request.action,
  sendAttestation: event.actions.participant.sendAttestation.request.action,
  cancelParticipation: event.actions.participant.cancelParticipation.request.action,
};

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

export default Wrapped;
