// 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 java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import org.jspecify.annotations.Nullable;

/**
 * Configuration for tree-sitter language pack integration.
 *
 * Controls grammar download behavior and code analysis options.
 *
 * # Example (TOML)
 *
 * {@code }{@code toml}
 * [tree_sitter]
 * languages = ["python", "rust"]
 * groups = ["web"]
 *
 * [tree_sitter.process]
 * structure = true
 * comments = true
 * docstrings = true
 *
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = TreeSitterConfig.Builder.class)
public record TreeSitterConfig(
    /**
     * Enable code intelligence processing (default: true).
     *
     * When {@code false}, tree-sitter analysis is completely skipped even if
     * the config section is present.
     */
    @Nullable @JsonProperty("enabled") Boolean enabled,
    /**
     * Custom cache directory for downloaded grammars.
     *
     * When {@code None}, uses the default: {@code ~/.cache/tree-sitter-language-pack/v{version}/libs/}.
     */
    @JsonProperty("cache_dir") java.nio.file.@Nullable Path cacheDir,
    /**
     * Languages to pre-download on init (e.g., {@code ["python", "rust"]}).
     */
    @Nullable @JsonProperty("languages") List<String> languages,
    /**
     * Language groups to pre-download (e.g., {@code ["web", "systems", "scripting"]}).
     */
    @Nullable @JsonProperty("groups") List<String> groups,
    /**
     * Processing options for code analysis.
     */
    @Nullable @JsonProperty("process") TreeSitterProcessConfig process
) {
    public static Builder builder() {
        return new Builder();
    }

    // CPD-OFF
    @JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
    public static final class Builder {

private Boolean enabled = null;
        @JsonProperty("cache_dir")
private java.nio.file.Path cacheDir = null;
private List<String> languages = null;
private List<String> groups = null;
        @Nullable private TreeSitterProcessConfig process = null;

        /** Sets the enabled field. */
        @JsonProperty("enabled")
        public Builder withEnabled(final @Nullable Boolean value) {
            this.enabled = value;
            return this;
        }

        /** Sets the cacheDir field. */
        @JsonProperty("cache_dir")
        public Builder withCacheDir(final java.nio.file.@Nullable Path value) {
            this.cacheDir = value;
            return this;
        }

        /** Sets the languages field. */
        @JsonProperty("languages")
        public Builder withLanguages(final @Nullable List<String> value) {
            this.languages = value;
            return this;
        }

        /** Sets the groups field. */
        @JsonProperty("groups")
        public Builder withGroups(final @Nullable List<String> value) {
            this.groups = value;
            return this;
        }

        /** Sets the process field. */
        @JsonProperty("process")
        public Builder withProcess(final @Nullable TreeSitterProcessConfig value) {
            this.process = value;
            return this;
        }

        /** Builds the TreeSitterConfig instance. */
        public TreeSitterConfig build() {
            return new TreeSitterConfig(
                enabled,
                cacheDir,
                languages,
                groups,
                process
            );
        }
    }
    // CPD-ON
    public static TreeSitterConfig defaultInstance() {
        throw new UnsupportedOperationException("defaultInstance is not yet bridged via JNI; use the Builder instead.");
    }
}
