package com.atlassian.bitbucket.mirroring.mirror;

import com.atlassian.bitbucket.repository.Repository;
import com.atlassian.bitbucket.util.NamedLink;

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

/**
 * Represents a mirror server's repository
 *
 * @since 4.3
 */
public interface MirroredRepository {

    /**
     * @return the clone URLs to the {@link Repository repository}
     */
    @Nonnull
    Set<NamedLink> getCloneUrls();

    /**
     * @return the mirror server's name
     */
    @Nonnull
    String getMirrorName();

    /**
     * @return the {@link Date date} the repository was last updated,
     * or an empty {@code Optional} if the initial sync has not completed
     */
    @Nonnull
    Optional<Date> getLastUpdated();

    /**
     * @return the {@link Repository#getId() ID} of the upstream repository
     */
    @Nonnull
    String getRepositoryId();

    /**
     * @return the status of the repository
     */
    @Nonnull
    MirroredRepositoryStatus getStatus();

    /**
     * @return {@code true} if the repository has completed the initial sync, {@link false} otherwise
     */
    boolean isAvailable();
}
