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

/**
 * Cross-extractor content filtering configuration.
 *
 * Controls whether "furniture" content (headers, footers, page numbers,
 * watermarks, repeating text) is included in or stripped from extraction
 * results. Applies across all extractors (PDF, DOCX, RTF, ODT, HTML, etc.)
 * with format-specific implementation.
 *
 * When {@code None} on {@code ExtractionConfig}, each extractor uses its current
 * default behavior unchanged.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ContentFilterConfig.Builder.class)
public record ContentFilterConfig(
    /**
     * Include running headers in extraction output.
     *
     * - PDF: Disables top-margin furniture stripping and prevents the layout
     *   model from treating {@code PageHeader}-classified regions as furniture.
     * - DOCX: Includes document headers in text output.
     * - RTF/ODT: Headers already included; this is a no-op when true.
     * - HTML/EPUB: Keeps {@code &lt;header&gt;} element content.
     *
     * Default: {@code false} (headers are stripped or excluded).
     */
    @Nullable @JsonProperty("include_headers") Boolean includeHeaders,
    /**
     * Include running footers in extraction output.
     *
     * - PDF: Disables bottom-margin furniture stripping and prevents the layout
     *   model from treating {@code PageFooter}-classified regions as furniture.
     * - DOCX: Includes document footers in text output.
     * - RTF/ODT: Footers already included; this is a no-op when true.
     * - HTML/EPUB: Keeps {@code &lt;footer&gt;} element content.
     *
     * Default: {@code false} (footers are stripped or excluded).
     */
    @Nullable @JsonProperty("include_footers") Boolean includeFooters,
    /**
     * Enable the heuristic cross-page repeating text detector.
     *
     * When {@code true} (default), text that repeats verbatim across a supermajority
     * of pages is classified as furniture and stripped.  Disable this if brand
     * names or repeated headings are being incorrectly removed by the heuristic.
     *
     * Note: when a layout-detection model is active, the model may independently
     * classify page-header / page-footer regions as furniture on a per-page basis.
     * To preserve those regions, set {@code include_headers = true}, {@code include_footers = true},
     * or both, in addition to disabling this flag.
     *
     * Primarily affects PDF extraction.
     *
     * Default: {@code true}.
     */
    @Nullable @JsonProperty("strip_repeating_text") Boolean stripRepeatingText,
    /**
     * Include watermark text in extraction output.
     *
     * - PDF: Keeps watermark artifacts and arXiv identifiers.
     * - Other formats: No effect currently.
     *
     * Default: {@code false} (watermarks are stripped).
     */
    @Nullable @JsonProperty("include_watermarks") Boolean includeWatermarks
) {
    public static Builder builder() {
        return new Builder();
    }

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

        @JsonProperty("include_headers")
private Boolean includeHeaders = null;
        @JsonProperty("include_footers")
private Boolean includeFooters = null;
        @JsonProperty("strip_repeating_text")
private Boolean stripRepeatingText = null;
        @JsonProperty("include_watermarks")
private Boolean includeWatermarks = null;

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

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

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

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

        /** Builds the ContentFilterConfig instance. */
        public ContentFilterConfig build() {
            return new ContentFilterConfig(
                includeHeaders,
                includeFooters,
                stripRepeatingText,
                includeWatermarks
            );
        }
    }
    // CPD-ON
    public static ContentFilterConfig defaultInstance() {
        throw new UnsupportedOperationException("defaultInstance is not yet bridged via JNI; use the Builder instead.");
    }
}
