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

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

import javax.annotation.Nonnull;

public class DefaultGitNotesRemoveBuilder
        extends AbstractGitNotesBuilder<GitNotesRemoveBuilder>
        implements GitNotesRemoveBuilder {

    private boolean ignoreMissing;
    private boolean stdIn;

    public DefaultGitNotesRemoveBuilder(GitProcessBuilder builder, String object) {
        super(builder, object, "remove");
    }

    @Nonnull
    @Override
    public GitNotesRemoveBuilder ignoreMissing(boolean value) {
        ignoreMissing = value;

        return self();
    }

    @Nonnull
    @Override
    public GitNotesRemoveBuilder stdin(boolean value) {
        stdIn = value;

        return self();
    }

    @Override
    protected void applyOptions() {
        if (ignoreMissing) {
            builder.argument("--ignore-missing");
        }
        if (stdIn) {
            builder.argument("--stdin");
        }
    }

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