package com.atlassian.bitbucket.mesh.git.pull;

import com.atlassian.bitbucket.mesh.git.commit.Commit;

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

/**
 * @see PullRequestManager#rescope(BatchRescopePullRequestsParameters, PullRequestRescopeCallback)
 */
public interface PullRequestRescopeCallback {

    /**
     * Callback method that is called the rescope analysis concludes that the pull request has been declined.
     *
     * @param rescope the rescope that was analyzed
     */
    void onDeclined(@Nonnull PullRequestRescope rescope);

    /**
     * Callback method that is called the rescope analysis concludes that the pull request has been merged.
     *
     * @param rescope   the rescope that was analyzed
     * @param mergeCommit the merge commit, if it could be determined
     */
    void onMerged(@Nonnull PullRequestRescope rescope, @Nullable String mergeCommit);

    /**
     * Callback method that is called the rescope analysis could not determine how the pull request is affected by the
     * scope change described by {@code rescope}.
     *
     * @param rescope the rescope that was analyzed
     */
    void onUnknown(@Nonnull PullRequestRescope rescope);

    /**
     * Callback method that is called the rescope analysis concludes that the pull request remains open.
     *
     * @param rescope         the rescope that was analyzed
     * @param addedCommits    the commits that have been added to the pull request scope (possibly truncated)
     * @param totalAdded      the total number of commits that were added to the pull request scope
     * @param removedCommits  the commits that have been removed from the pull request scope (possibly truncated)
     * @param totalRemoved    the total number of commit that were removed from the pull request scope
     */
    void onUpdated(@Nonnull PullRequestRescope rescope, @Nonnull List<Commit> addedCommits, int totalAdded,
                   @Nonnull List<Commit> removedCommits, int totalRemoved);
}
