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

/**
 * Image element in Djot.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = DjotImage.Builder.class)
public record DjotImage(
    /**
     * Image source URL or path
     */
    @JsonProperty("src") String src,
    /**
     * Alternative text
     */
    @JsonProperty("alt") String alt,
    /**
     * Optional title
     */
    @Nullable @JsonProperty("title") String title,
    /**
     * Element attributes
     */
    @Nullable @JsonProperty("attributes") String attributes
) {
    public static Builder builder() {
        return new Builder();
    }

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

private String src = "";
private String alt = "";
private String title = null;
private String attributes = null;

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

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

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

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

        /** Builds the DjotImage instance. */
        public DjotImage build() {
            return new DjotImage(
                src,
                alt,
                title,
                attributes
            );
        }
    }
    // CPD-ON
}
