import { createHandlerChainRunner, Handler } from "@insite/client-framework/HandlerCreator";

type HandlerType = Handler<{
    isBillingAddressTheSameAsShipping: boolean;
}>;

export const DispatchSetIsBillingAddressTheSameAsShipping: HandlerType = props => {
    props.dispatch({
        type: "Pages/OnePageCheckout/SetIsBillingAddressTheSameAsShipping",
        isBillingAddressTheSameAsShipping: props.parameter.isBillingAddressTheSameAsShipping,
    });
};

export const chain = [DispatchSetIsBillingAddressTheSameAsShipping];

const setIsBillingAddressTheSameAsShipping = createHandlerChainRunner(chain, "SetIsBillingAddressTheSameAsShipping");
export default setIsBillingAddressTheSameAsShipping;
