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

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

import javax.annotation.Nonnull;

public class DefaultGitConfig implements GitConfig {

    private final GitProcessBuilder builder;

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

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

    @Nonnull
    @Override
    public GitConfigGetAllBuilder getAll(@Nonnull String name) {
        return new DefaultGitConfigGetAllBuilder(builder, name);
    }

    @Nonnull
    @Override
    public GitConfigListBuilder list() {
        return new DefaultGitConfigListBuilder(builder);
    }

    @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);
    }
}
