// 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.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;

/**
 * Page extraction and tracking configuration.
 *
 * Controls how pages are extracted, tracked, and represented in the extraction results.
 * When {@code None}, page tracking is disabled.
 *
 * Page range tracking in chunk metadata (first_page/last_page) is automatically enabled
 * when page boundaries are available and chunking is configured.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = PageConfig.Builder.class)
public record PageConfig(
    /**
     * Extract pages as separate array (ExtractionResult.pages)
     */
    @Nullable @JsonProperty("extract_pages") Boolean extractPages,
    /**
     * Insert page markers in main content string
     */
    @Nullable @JsonProperty("insert_page_markers") Boolean insertPageMarkers,
    /**
     * Page marker format (use {page_num} placeholder)
     * Default: "\n\n&lt;!-- PAGE {page_num} --&gt;\n\n"
     */
    @Nullable @JsonProperty("marker_format") String markerFormat
) {
    public static Builder builder() {
        return new Builder();
    }

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

        @JsonProperty("extract_pages")
private Boolean extractPages = null;
        @JsonProperty("insert_page_markers")
private Boolean insertPageMarkers = null;
        @JsonProperty("marker_format")
private String markerFormat = null;

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

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

        /** Sets the markerFormat field. */
        @JsonProperty("marker_format")
        public Builder withMarkerFormat(final @Nullable String value) {
            this.markerFormat = value;
            return this;
        }

        /** Builds the PageConfig instance. */
        public PageConfig build() {
            return new PageConfig(
                extractPages,
                insertPageMarkers,
                markerFormat
            );
        }
    }
    // CPD-ON
    public static PageConfig defaultInstance() {
        throw new UnsupportedOperationException("defaultInstance is not yet bridged via JNI; use the Builder instead.");
    }
}
