package com.atlassian.bitbucket.scm.git.ref;

import com.atlassian.bitbucket.scm.ref.AbstractRefCommandParameters;

import javax.annotation.Nonnull;

public class GitDeleteBranchCommandParameters extends AbstractRefCommandParameters {

    private final boolean force;

    private GitDeleteBranchCommandParameters(Builder builder) {
        super(builder);

        force = builder.force;
    }

    /**
     * Retrieves a flag indicating whether a unmerged branch should be deleted or not, defaults to {@code true}.
     *
     * @return {@code true} if the branch should be deleted irrespective of its merged status; otherwise, {@code false}
     */
    public boolean isForce() {
        return force;
    }

    public static class Builder extends AbstractRefBuilder<Builder> {

        private boolean force = true;

        @Nonnull
        public GitDeleteBranchCommandParameters build() {
            validate();

            return new GitDeleteBranchCommandParameters(this);
        }

        @Nonnull
        public Builder force(boolean value) {
            force = value;

            return self();
        }

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