// 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;
import org.jspecify.annotations.Nullable;

/**
 * Single Excel worksheet.
 *
 * Represents one sheet from an Excel workbook with its content
 * converted to Markdown format and dimensional statistics.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExcelSheet.Builder.class)
public record ExcelSheet(
    /**
     * Sheet name as it appears in Excel
     */
    @JsonProperty("name") String name,
    /**
     * Sheet content converted to Markdown tables
     */
    @JsonProperty("markdown") String markdown,
    /**
     * Number of rows
     */
    @JsonProperty("row_count") long rowCount,
    /**
     * Number of columns
     */
    @JsonProperty("col_count") long colCount,
    /**
     * Total number of non-empty cells
     */
    @JsonProperty("cell_count") long cellCount,
    /**
     * Pre-extracted table cells (2D vector of cell values)
     * Populated during markdown generation to avoid re-parsing markdown.
     * null for empty sheets.
     */
    @Nullable @JsonProperty("table_cells") List<List<String>> tableCells
) {
    public static Builder builder() {
        return new Builder();
    }

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

private String name = "";
private String markdown = "";
        @JsonProperty("row_count")
private long rowCount = 0;
        @JsonProperty("col_count")
private long colCount = 0;
        @JsonProperty("cell_count")
private long cellCount = 0;
        @JsonProperty("table_cells")
private List<List<String>> tableCells = null;

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

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

        /** Sets the rowCount field. */
        @JsonProperty("row_count")
        public Builder withRowCount(final long value) {
            this.rowCount = value;
            return this;
        }

        /** Sets the colCount field. */
        @JsonProperty("col_count")
        public Builder withColCount(final long value) {
            this.colCount = value;
            return this;
        }

        /** Sets the cellCount field. */
        @JsonProperty("cell_count")
        public Builder withCellCount(final long value) {
            this.cellCount = value;
            return this;
        }

        /** Sets the tableCells field. */
        @JsonProperty("table_cells")
        public Builder withTableCells(final @Nullable List<List<String>> value) {
            this.tableCells = value;
            return this;
        }

        /** Builds the ExcelSheet instance. */
        public ExcelSheet build() {
            return new ExcelSheet(
                name,
                markdown,
                rowCount,
                colCount,
                cellCount,
                tableCells
            );
        }
    }
    // CPD-ON
}
