package com.atlassian.bitbucket.notification.commit;

import com.atlassian.bitbucket.commit.CommitDiscussion;
import com.atlassian.bitbucket.notification.AbstractNotification;
import com.atlassian.bitbucket.user.ApplicationUser;

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

import static java.util.Objects.requireNonNull;

public class AbstractCommitDiscussionNotification extends AbstractNotification implements CommitDiscussionNotification{
    private final CommitDiscussion commitDiscussion;

    public AbstractCommitDiscussionNotification(@Nullable ApplicationUser user,
                                                @Nonnull Date date,
                                                @Nonnull CommitDiscussion commitDiscussion) {
        super(user, date);
        this.commitDiscussion = requireNonNull(commitDiscussion, "commitDiscussion");
    }

    @Nonnull
    @Override
    public CommitDiscussion getCommitDiscussion() {
        return commitDiscussion;
    }

    @Override
    public String toString() {
        return super.toString() + "," +
                "commitDiscussion=" + commitDiscussion.getCommitId();
    }
}
