import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { setEmailOptions } from "../../redux/email/email.actions";
import T from "../../emails/parts-order/parts-order.email";
import { REPORT_QUERY_PARTS_ORDER_BY_PK } from "../../emails/parts-order/parts-order.query";

const mapStateToProps = createStructuredSelector({
  //currentUser: selectCurrentUser
});
const mapDispatchToProps = dispatch => ({
  setEmailOptions: e => dispatch(setEmailOptions(e))
});
export default connect(
  mapStateToProps,
  mapDispatchToProps
)(function Test({ setEmailOptions }) {
  return (
    <button
      onClick={() =>
        setEmailOptions({
          messageOptions: {
            from: { name: "Kavia Autobdoy", address: "noreply@bodyshop.app" },
            to: "patrickwf@gmail.com",
            replyTo: "snaptsoft@gmail.com"
          },
          template: T,
          queryConfig: [
            REPORT_QUERY_PARTS_ORDER_BY_PK,
            { variables: { id: "46f3aa34-c3bd-46c8-83fc-c93b7ce84f46" } }
          ]
        })
      }>
      Set email config.
    </button>
  );
});
