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

/**
 * A single changed cell within a table.
 *
 * Defined here (rather than only in {@code crate.diff}) so {@code RevisionDelta} can
 * reference it unconditionally, without requiring the {@code diff} Cargo feature.
 * {@code crate.diff} re-exports this type verbatim.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = CellChange.Builder.class)
public record CellChange(
    /**
     * Zero-based row index.
     */
    @JsonProperty("row") long row,
    /**
     * Zero-based column index.
     */
    @JsonProperty("col") long col,
    /**
     * Value before the change.
     */
    @JsonProperty("from") String from,
    /**
     * Value after the change.
     */
    @JsonProperty("to") String to
) {
    public static Builder builder() {
        return new Builder();
    }

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

private long row = 0;
private long col = 0;
private String from = "";
private String to = "";

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

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

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

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

        /** Builds the CellChange instance. */
        public CellChange build() {
            return new CellChange(
                row,
                col,
                from,
                to
            );
        }
    }
    // CPD-ON
}
