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

import com.atlassian.bitbucket.repository.InvalidAuthorException;
import com.atlassian.bitbucket.repository.Branch;
import com.atlassian.bitbucket.repository.Repository;
import com.atlassian.bitbucket.repository.Tag;
import com.atlassian.bitbucket.scm.git.ref.GitDeleteBranchCommandParameters;
import com.atlassian.bitbucket.scm.git.ref.GitDeleteTagCommandParameters;
import com.atlassian.bitbucket.scm.ref.CreateBranchCommandParameters;
import com.atlassian.bitbucket.scm.ref.CreateTagCommandParameters;
import com.atlassian.bitbucket.scm.ref.PluginRefCommandFactory;

import javax.annotation.Nonnull;

public interface GitRefCommandFactory extends PluginRefCommandFactory {

    @Nonnull
    @Override
    GitCommand<Branch> createBranch(@Nonnull Repository repository, @Nonnull CreateBranchCommandParameters parameters);

    @Nonnull
    @Override
    GitCommand<Tag> createTag(@Nonnull Repository repository, @Nonnull CreateTagCommandParameters parameters);

    /**
     * @param repository the repository containing the branch to delete
     * @param parameters describes the parameters required to delete a branch
     * @return a command which, when called, will delete a branch
     * @throws InvalidAuthorException if an author is not provided and there is no current effective user
     */
    @Nonnull
    GitCommand<Void> deleteBranch(@Nonnull Repository repository, @Nonnull GitDeleteBranchCommandParameters parameters);

    /**
     * @param repository the repository containing the tag to delete
     * @param parameters describes the parameters required to delete a tag
     * @return a command which, when called, will delete a tag
     * @throws InvalidAuthorException if an author is not provided and there is no current effective user
     */
    @Nonnull
    GitCommand<Void> deleteTag(@Nonnull Repository repository, @Nonnull GitDeleteTagCommandParameters parameters);
}
