package com.atlassian.bitbucket.notification.pull;

import com.atlassian.bitbucket.comment.Comment;
import com.atlassian.bitbucket.comment.DiffCommentAnchor;
import com.atlassian.bitbucket.pull.PullRequest;
import com.atlassian.bitbucket.user.ApplicationUser;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Date;

public class CommentAddedPullRequestNotification extends AbstractPullRequestNotification implements PullRequestCommentNotification {

    private final Comment comment;
    private final DiffCommentAnchor anchor;

    public CommentAddedPullRequestNotification(@Nonnull PullRequest pullRequest,
                                               @Nonnull Date whenActivityPerformed,
                                               @Nullable ApplicationUser activityPerformer,
                                               @Nonnull Comment comment,
                                               @Nullable DiffCommentAnchor anchor) {
        super(pullRequest, whenActivityPerformed, activityPerformer);
        this.comment = comment;
        this.anchor = anchor;
    }

    @Override
    @Nonnull
    public Comment getComment() {
        return comment;
    }

    @Nullable
    public DiffCommentAnchor getAnchor() {
        return anchor;
    }

    @Override
    public String toString() {
        return "GeneralCommentAddedNotification{" +
                super.toString() +
                ", comment=" + comment +
                '}';
    }
}
