// 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 java.util.Map;
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;

/**
 * Excel workbook representation.
 *
 * Contains all sheets from an Excel file (.xlsx, .xls, etc.) with
 * extracted content and metadata.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExcelWorkbook.Builder.class)
public record ExcelWorkbook(
    /**
     * All sheets in the workbook
     */
    @JsonProperty("sheets") List<ExcelSheet> sheets,
    /**
     * Workbook-level metadata (author, creation date, etc.)
     */
    @JsonProperty("metadata") Map<String, String> metadata,
    /**
     * Collaborative-edit revision headers from {@code xl/revisions/revisionHeaders.xml}.
     *
     * Populated for legacy shared-workbook {@code .xlsx} files that contain the
     * {@code xl/revisions/} directory. Each {@code &lt;header&gt;} element maps to one
     * {@code DocumentRevision { kind: FormatChange }} carrying the header's {@code guid}
     * (→ {@code revision_id}), {@code userName} (→ {@code author}), and {@code dateTime} (→ {@code timestamp}).
     * {@code anchor} and {@code delta} are {@code None}/empty for v1 (per-cell log parsing is a
     * follow-up). {@code None} when {@code xl/revisions/revisionHeaders.xml} is absent.
     */
    @Nullable @JsonProperty("revisions") List<DocumentRevision> revisions
) {
    public static Builder builder() {
        return new Builder();
    }

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

private List<ExcelSheet> sheets = List.of();
private Map<String, String> metadata = Map.of();
private List<DocumentRevision> revisions = null;

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

        /** Sets the metadata field. */
        @JsonProperty("metadata")
        public Builder withMetadata(final Map<String, String> value) {
            this.metadata = value;
            return this;
        }

        /** Sets the revisions field. */
        @JsonProperty("revisions")
        public Builder withRevisions(final @Nullable List<DocumentRevision> value) {
            this.revisions = value;
            return this;
        }

        /** Builds the ExcelWorkbook instance. */
        public ExcelWorkbook build() {
            return new ExcelWorkbook(
                sheets,
                metadata,
                revisions
            );
        }
    }
    // CPD-ON
}
