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

/**
 * Enumerates the possible modes for rename detection in {@code git diff-core}.
 */
public enum GitDiffRenames {

    /**
     * Enables {@code --find-copies}. This mode {@link #supportsThreshold() supports a threshold}.
     */
    FIND_COPIES,
    /**
     * Enables {@code --find-copies} <i>and</i> {@code --find-copies-harder}. This mode {@link #supportsThreshold()
     * supports a threshold}.
     */
    FIND_COPIES_HARDER,
    /**
     * Enables {@code --find-renames}. This mode {@link #supportsThreshold() supports a threshold}.
     */
    FIND_RENAMES,
    /**
     * Disables rename and copy detection. This mode <i>does not</i> {@link #supportsThreshold() support a threshold}.
     */
    OFF {

        /**
         * @inheritDoc
         */
        @Override
        public boolean supportsThreshold() {
            return false;
        }
    };

    /**
     * Retrieves a flag indicating whether this mode supports appending a threshold. When supported, the threshold
     * controls the necessary similarity percentage files must have to be marked as copies or renames.
     *
     * @return {@code true} if this mode supports thresholds; otherwise, {@code false}
     */
    public boolean supportsThreshold() {
        return true;
    }
}
