package com.agilex.healthcare.schedulingmanager.notification.appointmentrequest;

import com.agilex.messaging.core.MessageHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Created with IntelliJ IDEA.
 * User: clarkee
 * Date: 2/25/13
 * Time: 10:37 AM
 * To change this template use File | Settings | File Templates.
 */
public class MockEmailNotificationMessageHandler implements MessageHandler<EmailNotificationMessage> {
    private final static Log logger = LogFactory.getLog(MockEmailNotificationMessageHandler.class);

    private int handledMessageCount = 0;

    public MockEmailNotificationMessageHandler(){
        logger.debug(this.getClass().getName() + " ctor");
    }
    @Override
    public void handle(EmailNotificationMessage message) {
        handledMessageCount++;

        logger.debug("Received " + message.getClass().getName());
        logger.info(this.getClass().getName() + ": Sending email");
        logger.info("To: " + message.getEmailAddress());
        logger.info("Body: " + message.getMessageBody());
        logger.info(this.getClass().getName() + ": Email Send Complete");
    }

    public int getHandledMessageCount() {
        return handledMessageCount;
    }

    public void clearHandledMessageCount(){
        handledMessageCount = 0;
    }
}

