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

/**
 * Inline element within a block.
 *
 * Represents text with formatting, links, images, etc.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = InlineElement.Builder.class)
public record InlineElement(
    /**
     * Type of inline element
     */
    @JsonProperty("element_type") InlineType elementType,
    /**
     * Text content
     */
    @JsonProperty("content") String content,
    /**
     * Element attributes
     */
    @Nullable @JsonProperty("attributes") String attributes,
    /**
     * Additional metadata (e.g., href for links, src/alt for images)
     */
    @Nullable @JsonProperty("metadata") Map<String, String> metadata
) {
    public static Builder builder() {
        return new Builder();
    }

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

        @JsonProperty("element_type")
private InlineType elementType = null;
private String content = "";
private String attributes = null;
private Map<String, String> metadata = null;

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

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

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

        /** Sets the metadata field. */
        @JsonProperty("metadata")
        public Builder withMetadata(final @Nullable Map<String, String> value) {
            this.metadata = value;
            return this;
        }

        /** Builds the InlineElement instance. */
        public InlineElement build() {
            return new InlineElement(
                elementType,
                content,
                attributes,
                metadata
            );
        }
    }
    // CPD-ON
}
