package com.atlassian.stash.internal.scm.git.command.remote;

import com.atlassian.stash.internal.scm.git.command.AbstractGitCommandBuilder;
import com.atlassian.bitbucket.scm.git.command.GitCommand;
import com.atlassian.bitbucket.scm.git.command.GitScmCommandBuilder;
import com.atlassian.bitbucket.scm.git.command.remote.GitRemoteRmBuilder;

import javax.annotation.Nonnull;

/**
 * @since 1.2
 */
public class DefaultGitRemoteRmBuilder
        extends AbstractGitCommandBuilder<GitRemoteRmBuilder>
        implements GitRemoteRmBuilder {

    private final String name;

    public DefaultGitRemoteRmBuilder(GitScmCommandBuilder builder, String name) {
        super(builder);

        this.name = name;
    }

    @Nonnull
    @Override
    public GitCommand<Void> build() {
        return buildWithLoggingHandler();
    }

    @Override
    protected void applyArguments() {
        builder.argument("rm")
                .argument(name);
    }

    @Nonnull
    @Override
    protected GitRemoteRmBuilder self() {
        return this;
    }
}
