package com.atlassian.bitbucket.notification.pull;

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

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

import static java.util.Objects.requireNonNull;

/**
 * @since 4.8
 */
public class CommitCommentRepliedPullRequestNotification extends CommentRepliedPullRequestNotification {

    private final String since;
    private final String until;

    public CommitCommentRepliedPullRequestNotification(@Nonnull PullRequest pullRequest,
                                                       @Nonnull Date whenActivityPerformed,
                                                       @Nonnull ApplicationUser activityPerformer,
                                                       @Nonnull Comment comment,
                                                       @Nonnull Comment parent,
                                                       @Nullable String since,
                                                       @Nonnull String until) {
        super(pullRequest, whenActivityPerformed, activityPerformer, comment, parent);

        this.since = since;
        this.until = requireNonNull(until, "until");
    }

    /**
     * @return the since hash for the pull request commit diff on which the comment was made
     */
    @Nullable
    public String getSince() {
        return since;
    }

    /**
     * @return the until hash for the pull request commit diff on which the comment was made
     */
    @Nonnull
    public String getUntil() {
        return until;
    }
}
