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

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

import javax.annotation.Nonnull;

import static java.util.Objects.requireNonNull;

public class DefaultGitCatFileBatchBuilder
        extends AbstractGitProcessBuilder<GitCatFileBatchBuilder>
        implements GitCatFileBatchBuilder {

    private final CatFileFormat format;

    protected DefaultGitCatFileBatchBuilder(GitProcessBuilder builder, CatFileFormat format) {
        super(builder);
        this.format = requireNonNull(format, "format");
    }

    @Override
    protected void applyArguments() {
        builder.argument(format.getFlag());
    }

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