package com.atlassian.bitbucket.mesh.repair;

import com.atlassian.bitbucket.mesh.execution.ExecutionContext;
import com.atlassian.bitbucket.mesh.repository.Repository;

import javax.annotation.Nonnull;
import java.time.Duration;

public interface InteractiveRepairHelper {

    /**
     * @param repository the repository
     * @return {@code true} if the provided repository is being repaired in the current {@link ExecutionContext}
     */
    boolean isRepairing(@Nonnull Repository repository);

    /**
     * Initiates an interactive repair of the local replica of the provided repository, which may not exist yet.
     * 
     * @param repositoryId the repository for which repair should be started
     * @param timeout      the maximum time repair is allowed to take
     * @return the interactive repair
     */
    @Nonnull
    InteractiveRepair startRepair(@Nonnull String repositoryId, @Nonnull Duration timeout);
}
