package com.atlassian.bitbucket.scm.git.command;

import com.atlassian.bitbucket.repository.Repository;
import com.atlassian.bitbucket.scm.AsyncCommand;
import com.atlassian.bitbucket.scm.Command;
import com.atlassian.bitbucket.scm.mirror.MirrorSyncCallback;
import com.atlassian.bitbucket.scm.mirror.MirrorSyncCommandParameters;
import com.atlassian.bitbucket.scm.mirror.MirrorUpdateRefsCommandParameters;
import com.atlassian.bitbucket.scm.mirror.PluginMirrorCommandFactory;

import javax.annotation.Nonnull;

/**
 * Overrides methods from the standard {@link PluginMirrorCommandFactory} interface and returns {@link GitCommand}
 * instances instead of simple {@link Command} or {@link AsyncCommand} instances. This allows commands created by this
 * factory to be used synchronously or asynchronously at the caller's discretion, rather than fixing execution to one
 * approach or the other.
 * <p>
 * This interface does <i>not</i> add any commands to the standard interface. It only covariantly adjusts their return
 * types.
 *
 * @since 4.1
 */
public interface GitMirrorCommandFactory extends PluginMirrorCommandFactory {

    /**
     * {@inheritDoc}
     */
    @Nonnull
    @Override
    GitCommand<Void> synchronize(@Nonnull Repository repository, @Nonnull MirrorSyncCommandParameters parameters,
                                 @Nonnull MirrorSyncCallback callback);

    /**
     * {@inheritDoc}
     * @since 4.2
     */
    @Nonnull
    @Override
    GitCommand<Void> updateRefs(@Nonnull Repository repository, @Nonnull MirrorUpdateRefsCommandParameters parameters);
}
