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

/**
 * The content changes that make up a single revision.
 *
 * For insertions and deletions the {@code content} field carries the added/removed
 * lines as {@code DiffLine.Added} / {@code DiffLine.Removed} entries. For format
 * changes, {@code content} is empty — the property diff is left as a TODO for a
 * later enrichment pass.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = RevisionDelta.Builder.class)
public record RevisionDelta(
    /**
     * Line-level content changes for this revision.
     */
    @JsonProperty("content") List<DiffLine> content,
    /**
     * Cell-level table changes for this revision.
     */
    @JsonProperty("table_changes") List<CellChange> tableChanges
) {
    public static Builder builder() {
        return new Builder();
    }

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

private List<DiffLine> content = List.of();
        @JsonProperty("table_changes")
private List<CellChange> tableChanges = List.of();

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

        /** Sets the tableChanges field. */
        @JsonProperty("table_changes")
        public Builder withTableChanges(final List<CellChange> value) {
            this.tableChanges = value;
            return this;
        }

        /** Builds the RevisionDelta instance. */
        public RevisionDelta build() {
            return new RevisionDelta(
                content,
                tableChanges
            );
        }
    }
    // CPD-ON
}
