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

/**
 * Structured table grid with cell-level metadata.
 *
 * Stores row/column dimensions and a flat list of cells with position info.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = TableGrid.Builder.class)
public record TableGrid(
    /**
     * Number of rows in the table.
     */
    @JsonProperty("rows") int rows,
    /**
     * Number of columns in the table.
     */
    @JsonProperty("cols") int cols,
    /**
     * All cells in row-major order.
     */
    @JsonProperty("cells") List<GridCell> cells
) {
    public static Builder builder() {
        return new Builder();
    }

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

private int rows = 0;
private int cols = 0;
private List<GridCell> cells = List.of();

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

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

        /** Sets the cells field. */
        @JsonProperty("cells")
        public Builder withCells(final List<GridCell> value) {
            this.cells = value;
            return this;
        }

        /** Builds the TableGrid instance. */
        public TableGrid build() {
            return new TableGrid(
                rows,
                cols,
                cells
            );
        }
    }
    // CPD-ON
}
