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

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

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

const mapDispatchToProps = {
  loadData: event.actions.loadOne.request.action,
  publishEvent: event.actions.event.publish.request.action,
  unpublishEvent: event.actions.event.unpublish.request.action,
  dialogShow: app.actions.dialog.show.action,
  dialogHide: app.actions.dialog.hide.action,
  exportParticipant: event.actions.participant.export.request.action,
  exportParticipantPDF: event.actions.participant.exportPDF.request.action,
};

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

export default Wrapped;
