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

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

import javax.annotation.Nonnull;

public class DefaultGitUpdateRefSetBuilder
        extends AbstractGitUpdateRefBuilder<GitUpdateRefSetBuilder>
        implements GitUpdateRefSetBuilder {

    private final String newValue;

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

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

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

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