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

/**
 * Semantic element extracted from document.
 *
 * Represents a logical unit of content with semantic classification,
 * unique identifier, and metadata for tracking origin and position.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = Element.Builder.class)
public record Element(
    /**
     * Unique element identifier
     */
    @JsonProperty("element_id") String elementId,
    /**
     * Semantic type of this element
     */
    @JsonProperty("element_type") ElementType elementType,
    /**
     * Text content of the element
     */
    @JsonProperty("text") String text,
    /**
     * Metadata about the element
     */
    @JsonProperty("metadata") ElementMetadata metadata
) {
    public static Builder builder() {
        return new Builder();
    }

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

        @JsonProperty("element_id")
private String elementId = "";
        @JsonProperty("element_type")
private ElementType elementType = null;
private String text = "";
private ElementMetadata metadata = null;

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

        /** Sets the elementType field. */
        @JsonProperty("element_type")
        public Builder withElementType(final ElementType value) {
            this.elementType = value;
            return this;
        }

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

        /** Sets the metadata field. */
        @JsonProperty("metadata")
        public Builder withMetadata(final ElementMetadata value) {
            this.metadata = value;
            return this;
        }

        /** Builds the Element instance. */
        public Element build() {
            return new Element(
                elementId,
                elementType,
                text,
                metadata
            );
        }
    }
    // CPD-ON
}
