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

/**
 * Inline text annotation — byte-range based formatting and links.
 *
 * Annotations reference byte offsets into the node's text content,
 * enabling precise identification of formatted regions.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = TextAnnotation.Builder.class)
public record TextAnnotation(
    /**
     * Start byte offset in the node's text content (inclusive).
     */
    @JsonProperty("start") int start,
    /**
     * End byte offset in the node's text content (exclusive).
     */
    @JsonProperty("end") int end,
    /**
     * Annotation type.
     */
    @JsonProperty("kind") AnnotationKind kind
) {
    public static Builder builder() {
        return new Builder();
    }

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

private int start = 0;
private int end = 0;
private AnnotationKind kind = null;

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

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

        /** Sets the kind field. */
        @JsonProperty("kind")
        public Builder withKind(final AnnotationKind value) {
            this.kind = value;
            return this;
        }

        /** Builds the TextAnnotation instance. */
        public TextAnnotation build() {
            return new TextAnnotation(
                start,
                end,
                kind
            );
        }
    }
    // CPD-ON
}
