package com.atlassian.bitbucket.mirroring.mirror;

import com.atlassian.bitbucket.repository.NoSuchRepositoryException;
import com.atlassian.bitbucket.repository.Repository;
import com.atlassian.bitbucket.server.IncompatibleApplicationModeException;

import javax.annotation.Nonnull;

/**
 * A service to provide rudimentary repository information from the mirror to users.
 *
 * @since 4.3
 */
public interface MirroredRepositoryService {

    /**
     * @param upstreamId the ID of the upstream {@link Repository repository}
     * @param externalId the external ID of the repository to return clone URLs for
     * @return the {@link MirroredRepository repository information}
     * @throws IncompatibleApplicationModeException if the application is not in mirroring mode
     * @throws NoSuchRepositoryException if the repository could not be found
     */
    @Nonnull
    MirroredRepository getRepository(@Nonnull String upstreamId, @Nonnull String externalId);

    /**
     * @param repository the repository
     * @return the status of the local repository with respect to mirroring
     */
    @Nonnull
    MirroredRepositoryStatus getStatus(@Nonnull Repository repository);
}
