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

import com.atlassian.bitbucket.scm.git.command.GitScmCommandBuilder;
import com.atlassian.bitbucket.scm.git.command.config.*;

import javax.annotation.Nonnull;

/**
 * @since 2.0
 */
public class DefaultGitConfig implements GitConfig {

    private final GitScmCommandBuilder builder;

    public DefaultGitConfig(GitScmCommandBuilder builder) {
        this.builder = builder.command("config");
    }

    @Override
    @Nonnull
    public GitConfigGetBuilder get(@Nonnull String name) {
        return new DefaultGitConfigGetBuilder(builder, name);
    }

    @Nonnull
    @Override
    public GitConfigRemoveSectionBuilder removeSection(@Nonnull String name) {
        return new DefaultGitConfigRemoveSectionBuilder(builder, name);
    }

    @Nonnull
    @Override
    public GitConfigRenameSectionBuilder renameSection(@Nonnull String oldSectionName, @Nonnull String newSectionName) {
        return new DefaultGitConfigRenameSectionBuilder(builder, oldSectionName, newSectionName);
    }

    @Override
    @Nonnull
    public GitConfigSetBuilder set(@Nonnull String name, @Nonnull String value) {
        return new DefaultGitConfigSetBuilder(builder, name, value);
    }

    @Nonnull
    @Override
    public GitConfigUnsetBuilder unset(@Nonnull String name) {
        return new DefaultGitConfigUnsetBuilder(builder, name);
    }

    @Nonnull
    @Override
    public GitConfigUnsetAllBuilder unsetAll(@Nonnull String name) {
        return new DefaultGitConfigUnsetAllBuilder(builder, name);
    }

}
