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.bulk.BulkContentCallback;
import com.atlassian.bitbucket.scm.bulk.BulkContentCommandParameters;
import com.atlassian.bitbucket.scm.bulk.PluginBulkContentCommandFactory;

import javax.annotation.Nonnull;

/**
 * Overrides methods from the standard {@link PluginBulkContentCommandFactory} 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.2
 */
public interface GitBulkContentCommandFactory extends PluginBulkContentCommandFactory {

    /**
     * @param repository the repository to get contents from
     * @param parameters to specify where to get contents from
     * @param callback   to process resulting content
     * @return the command
     */
    @Nonnull
    @Override
    GitCommand<Void> contents(@Nonnull Repository repository, @Nonnull BulkContentCommandParameters parameters,
                              @Nonnull BulkContentCallback callback);
}
