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

/**
 * OCR processing metadata.
 *
 * Captures information about OCR processing configuration and results.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = OcrMetadata.Builder.class)
public record OcrMetadata(
    /**
     * OCR language code(s) used
     */
    @JsonProperty("language") String language,
    /**
     * Tesseract Page Segmentation Mode (PSM)
     */
    @JsonProperty("psm") int psm,
    /**
     * Output format (e.g., "text", "hocr")
     */
    @JsonProperty("output_format") String outputFormat,
    /**
     * Number of tables detected
     */
    @JsonProperty("table_count") int tableCount,
    @Nullable @JsonProperty("table_rows") Integer tableRows,
    @Nullable @JsonProperty("table_cols") Integer tableCols
) {
    public static Builder builder() {
        return new Builder();
    }

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

private String language = "";
private int psm = 0;
        @JsonProperty("output_format")
private String outputFormat = "";
        @JsonProperty("table_count")
private int tableCount = 0;
        @JsonProperty("table_rows")
private Integer tableRows = null;
        @JsonProperty("table_cols")
private Integer tableCols = null;

        /** Sets the language field. */
        @JsonProperty("language")
        public Builder withLanguage(final String value) {
            this.language = value;
            return this;
        }

        /** Sets the psm field. */
        @JsonProperty("psm")
        public Builder withPsm(final int value) {
            this.psm = value;
            return this;
        }

        /** Sets the outputFormat field. */
        @JsonProperty("output_format")
        public Builder withOutputFormat(final String value) {
            this.outputFormat = value;
            return this;
        }

        /** Sets the tableCount field. */
        @JsonProperty("table_count")
        public Builder withTableCount(final int value) {
            this.tableCount = value;
            return this;
        }

        /** Sets the tableRows field. */
        @JsonProperty("table_rows")
        public Builder withTableRows(final @Nullable int value) {
            this.tableRows = value;
            return this;
        }

        /** Sets the tableCols field. */
        @JsonProperty("table_cols")
        public Builder withTableCols(final @Nullable int value) {
            this.tableCols = value;
            return this;
        }

        /** Builds the OcrMetadata instance. */
        public OcrMetadata build() {
            return new OcrMetadata(
                language,
                psm,
                outputFormat,
                tableCount,
                tableRows,
                tableCols
            );
        }
    }
    // CPD-ON
}
