package com.atlassian.stash.internal.scm.git.pull;

import com.atlassian.bitbucket.pull.PullRequestService;
import com.atlassian.bitbucket.pull.PullRequest;
import com.atlassian.bitbucket.pull.PullRequestSupplier;

import javax.annotation.Nonnull;
import java.util.Set;

/**
 * Extends the {@link PullRequestSupplier} with the ability to retrieve the IDs of all {@link #getOpenIds open pull
 * requests}. Using this interface makes the unit tests for the Git plugin easier to maintain, rather than requiring
 * the full {@link PullRequestService PullRequestService} to be either registered or mocked.
 *
 * @since 3.6
 */
public interface GitPullRequestSupplier extends PullRequestSupplier {

    /**
     * Retrieves a set containing the {@link PullRequest#getId() IDs} of all open pull requests for the specified
     * repository, which may be empty but never {@code null}.
     *
     * @param repositoryId the repository to retrieve open pull requests for
     * @return a set containing 0 or more IDs for open pull requests
     */
    @Nonnull
    Set<Long> getOpenIds(int repositoryId);
}
