package com.braintree.actions.consignment;

import de.hybris.platform.orderprocessing.events.SendReadyForPickupMessageEvent;
import de.hybris.platform.ordersplitting.model.ConsignmentProcessModel;
import de.hybris.platform.processengine.action.AbstractProceduralAction;
import de.hybris.platform.servicelayer.event.EventService;
import org.apache.log4j.Logger;


public class BrainTreeSendReadyForPickupMessageAction extends AbstractProceduralAction<ConsignmentProcessModel> {

    private static final Logger LOG = Logger.getLogger(BrainTreeSendReadyForPickupMessageAction.class);

    private EventService eventService;

    @Override
    public void executeAction(final ConsignmentProcessModel process) {
        eventService.publishEvent(getEvent(process));
        if (LOG.isInfoEnabled()) {
            LOG.info("Process: " + process.getCode() + " in step " + getClass());
        }
    }

    public void setEventService(final EventService eventService) {
        this.eventService = eventService;
    }

    protected SendReadyForPickupMessageEvent getEvent(final ConsignmentProcessModel process) {
        return new SendReadyForPickupMessageEvent(process);
    }

}
