// This file is auto-generated by alef — DO NOT EDIT.
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
// To regenerate: alef generate
// To verify freshness: alef verify --exit-code
// Issues & docs: https://github.com/kreuzberg-dev/alef
package dev.kreuzberg;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * Type of text chunker to use.
 *
 * # Variants
 *
 * * {@code Text} - Generic text splitter, splits on whitespace and punctuation
 * * {@code Markdown} - Markdown-aware splitter, preserves formatting and structure
 * * {@code Yaml} - YAML-aware splitter, creates one chunk per top-level key
 * * {@code Semantic} - Topic-aware chunker. With an {@code EmbeddingConfig}, splits at
 *   embedding-based topic shifts tuned by {@code topic_threshold} (default 0.75,
 *   lower = more splits). Without an embedding, falls back to a
 *   structural-boundary heuristic (ALL-CAPS headers, numbered sections,
 *   blank-line paragraphs) and merges groups into chunks capped at
 *   {@code max_characters} (default 1000). {@code topic_threshold} has no effect in the
 *   fallback path. For best results, pair with an embedding model.
 */
public enum ChunkerType {
    Text("text"),
    Markdown("markdown"),
    Yaml("yaml"),
    Semantic("semantic");

    /** The string value. */
    private final String value;

    ChunkerType(final String value) {
        this.value = value;
    }

    /** Returns the string value. */
    @JsonValue
    public String getValue() {
        return value;
    }

    /** Creates an instance from a string value. */
    @JsonCreator
    public static ChunkerType fromValue(final String value) {
        for (ChunkerType e : values()) {
            if (e.value.equalsIgnoreCase(value)) {
                return e;
            }
        }
        throw new IllegalArgumentException("Unknown value: " + value);
    }

    /** Returns the wire-format string value (matches JSON serialization). */
    @Override
    public String toString() {
        return value;
    }
}
