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

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 DefaultGitTagDeleteBuilder
        extends AbstractGitProcessBuilder<GitTagDeleteBuilder>
        implements GitTagDeleteBuilder {

    private final String name;

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

        this.name = requireNonBlank(name, "name");
    }

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

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

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