package com.atlassian.bitbucket.mesh.git.builder.remote;

import com.atlassian.bitbucket.mesh.git.builder.AbstractGitProcessBuilder;
import com.atlassian.bitbucket.mesh.git.builder.GitProcess;
import com.atlassian.bitbucket.mesh.git.builder.GitProcessBuilder;

import javax.annotation.Nonnull;

public class DefaultGitRemoteRmBuilder
        extends AbstractGitProcessBuilder<GitRemoteRmBuilder>
        implements GitRemoteRmBuilder {

    private final String name;

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

        this.name = name;
    }

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

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

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