package com.atlassian.stash.internal.notification.commit.handlers;

import com.atlassian.bitbucket.commit.CommitService;
import com.atlassian.bitbucket.notification.commit.CommitDiscussionCommentAddedNotification;
import com.atlassian.stash.internal.notification.handlers.NotificationHelper;
import com.atlassian.stash.internal.notification.util.AnchorUtils;

import java.util.Map;

public class CommitDiscussionCommentAddedNotificationHandler
        extends AbstractCommitDiscussionNotificationHandler<CommitDiscussionCommentAddedNotification> {

    protected static final String TEMPLATE = "bitbucket.internal.notification.email.commitDiscussion.comment";

    public CommitDiscussionCommentAddedNotificationHandler(NotificationHelper helper, CommitService commitService) {
        super(helper, commitService, TEMPLATE);
    }

    @Override
    protected Map<String, Object> getContext(CommitDiscussionCommentAddedNotification notification) {
        Map<String, Object> context = super.getContext(notification);
        context.put("comment", notification.getComment());

        AnchorUtils.addLocationInfo(notification.getAnchor(), context);

        return context;
    }
}
