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

import com.atlassian.bitbucket.scm.git.command.GitScmCommandBuilder;
import com.atlassian.bitbucket.scm.git.command.updateref.GitUpdateRefSetBuilder;

import javax.annotation.Nonnull;

/**
 * @since 1.3
 */
public class DefaultGitUpdateRefSetBuilder
        extends AbstractGitUpdateRefBuilder<GitUpdateRefSetBuilder>
        implements GitUpdateRefSetBuilder {

    private final String newValue;

    public DefaultGitUpdateRefSetBuilder(GitScmCommandBuilder builder, String ref, String newValue) {
        super(builder, ref);

        this.newValue = checkNotBlank(newValue, "newValue");
    }

    @Override
    protected void applyRefArguments(String ref) {
        builder.argument(ref)
                .argument(newValue);
    }

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