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

/**
 * Individual grid cell with position and span metadata.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = GridCell.Builder.class)
public record GridCell(
    /**
     * Cell text content.
     */
    @JsonProperty("content") String content,
    /**
     * Zero-indexed row position.
     */
    @JsonProperty("row") int row,
    /**
     * Zero-indexed column position.
     */
    @JsonProperty("col") int col,
    /**
     * Number of rows this cell spans.
     */
    @Nullable @JsonProperty("row_span") Integer rowSpan,
    /**
     * Number of columns this cell spans.
     */
    @Nullable @JsonProperty("col_span") Integer colSpan,
    /**
     * Whether this is a header cell.
     */
    @Nullable @JsonProperty("is_header") Boolean isHeader,
    /**
     * Bounding box for this cell (if available).
     */
    @Nullable @JsonProperty("bbox") BoundingBox bbox
) {
    public static Builder builder() {
        return new Builder();
    }

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

private String content = "";
private int row = 0;
private int col = 0;
        @JsonProperty("row_span")
private Integer rowSpan = null;
        @JsonProperty("col_span")
private Integer colSpan = null;
        @JsonProperty("is_header")
private Boolean isHeader = null;
private BoundingBox bbox = null;

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

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

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

        /** Sets the rowSpan field. */
        @JsonProperty("row_span")
        public Builder withRowSpan(final @Nullable Integer value) {
            this.rowSpan = value;
            return this;
        }

        /** Sets the colSpan field. */
        @JsonProperty("col_span")
        public Builder withColSpan(final @Nullable Integer value) {
            this.colSpan = value;
            return this;
        }

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

        /** Sets the bbox field. */
        @JsonProperty("bbox")
        public Builder withBbox(final @Nullable BoundingBox value) {
            this.bbox = value;
            return this;
        }

        /** Builds the GridCell instance. */
        public GridCell build() {
            return new GridCell(
                content,
                row,
                col,
                rowSpan,
                colSpan,
                isHeader,
                bbox
            );
        }
    }
    // CPD-ON
}
