package com.atlassian.bitbucket.scm.git.command.diff;

import com.atlassian.bitbucket.scm.git.command.GitCommandBuilderSupport;

import javax.annotation.Nonnull;

public interface GitDiffCoreBuilder<B extends GitDiffCoreBuilder<B>> extends GitCommandBuilderSupport<B> {

    @Nonnull
    B ancestor(String value);

    @Nonnull
    B clearPaths();

    /**
     * Sets the {@link GitDiffColor color} mode for the diff.
     *
     * @param value the {@link GitDiffColor color} mode
     * @return {@code this}
     * @throws NullPointerException if the provided {@code value} is {@code null}
     */
    @Nonnull
    B color(@Nonnull GitDiffColor value);

    /**
     * Sets a flag indicating whether {@code git diff} should output full 40-byte hashes for the content IDs on the
     * {@link GitDiffHeader#INDEX index header}. By default, shortened hashes are shown.
     *
     * @param value {@code true} to display full 40-byte hashes on the index header; otherwise, {@code false} to
     *              display short hashes
     * @return {@code this}
     */
    @Nonnull
    B fullIndex(boolean value);

    @Nonnull
    B path(String value);

    @Nonnull
    B paths(String value, String... values);

    @Nonnull
    B paths(Iterable<String> values);

    /**
     * Sets the {@link GitDiffRenames rename detection} mode for the diff. If the specified mode
     * {@link GitDiffRenames#supportsThreshold() supports a threshold}, the default value is used.
     *
     * @param value the {@link GitDiffRenames rename detection} mode
     * @return {@code this}
     * @throws NullPointerException if the provided {@code value} is {@code null}
     */
    @Nonnull
    B renames(@Nonnull GitDiffRenames value);

    /**
     * Sets the {@link GitDiffRenames rename detection} mode for the diff. If the specified mode
     * {@link GitDiffRenames#supportsThreshold() supports a threshold}, the provided threshold
     * will be used. Otherwise, the provided threshold is ignored.
     * <p>
     * Note: {@code git diff} and {@code git diff-tree} will <i>not</i> allow setting the similarity
     * threshold to 100%; running a command like {@code git diff-tree -C100} ignores the threshold
     * and applies the default 50% threshold instead. As a result, this builder limits the threshold
     * provided to be between 1 and 99, inclusive.
     *
     * @param renames   the {@link GitDiffRenames rename detection} mode
     * @param threshold a similarity threshold between 1% and 99%, or {@code null} to use the default threshold
     * @return {@code this}
     * @throws IllegalArgumentException if the provided threshold is negative, 0 or greater than 99
     * @throws NullPointerException if the provided {@code renames} is {@code null}
     */
    @Nonnull
    B renames(@Nonnull GitDiffRenames renames, Integer threshold);

    @Nonnull
    B rev(String value);
}
