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

/**
 * A PDF annotation extracted from a document page.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = PdfAnnotation.Builder.class)
public record PdfAnnotation(
    /**
     * The type of annotation.
     */
    @JsonProperty("annotation_type") PdfAnnotationType annotationType,
    /**
     * Text content of the annotation (e.g., comment text, link URL).
     */
    @Nullable @JsonProperty("content") String content,
    /**
     * Page number where the annotation appears (1-indexed).
     */
    @JsonProperty("page_number") int pageNumber,
    /**
     * Bounding box of the annotation on the page.
     */
    @Nullable @JsonProperty("bounding_box") BoundingBox boundingBox
) {
    public static Builder builder() {
        return new Builder();
    }

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

        @JsonProperty("annotation_type")
private PdfAnnotationType annotationType = null;
private String content = null;
        @JsonProperty("page_number")
private int pageNumber = 0;
        @JsonProperty("bounding_box")
private BoundingBox boundingBox = null;

        /** Sets the annotationType field. */
        @JsonProperty("annotation_type")
        public Builder withAnnotationType(final PdfAnnotationType value) {
            this.annotationType = value;
            return this;
        }

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

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

        /** Sets the boundingBox field. */
        @JsonProperty("bounding_box")
        public Builder withBoundingBox(final @Nullable BoundingBox value) {
            this.boundingBox = value;
            return this;
        }

        /** Builds the PdfAnnotation instance. */
        public PdfAnnotation build() {
            return new PdfAnnotation(
                annotationType,
                content,
                pageNumber,
                boundingBox
            );
        }
    }
    // CPD-ON
}
