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

/**
 * Link element metadata.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = LinkMetadata.Builder.class)
public record LinkMetadata(
    /**
     * The href URL value
     */
    @JsonProperty("href") String href,
    /**
     * Link text content (normalized)
     */
    @JsonProperty("text") String text,
    /**
     * Optional title attribute
     */
    @Nullable @JsonProperty("title") String title,
    /**
     * Link type classification
     */
    @JsonProperty("link_type") LinkType linkType,
    /**
     * Rel attribute values
     */
    @JsonProperty("rel") List<String> rel,
    /**
     * Additional attributes as key-value pairs
     */
    @JsonProperty("attributes") List<List<String>> attributes
) {
    public static Builder builder() {
        return new Builder();
    }

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

private String href = "";
private String text = "";
private String title = null;
        @JsonProperty("link_type")
private LinkType linkType = null;
private List<String> rel = List.of();
private List<List<String>> attributes = List.of();

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

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

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

        /** Sets the linkType field. */
        @JsonProperty("link_type")
        public Builder withLinkType(final LinkType value) {
            this.linkType = value;
            return this;
        }

        /** Sets the rel field. */
        @JsonProperty("rel")
        public Builder withRel(final List<String> value) {
            this.rel = value;
            return this;
        }

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

        /** Builds the LinkMetadata instance. */
        public LinkMetadata build() {
            return new LinkMetadata(
                href,
                text,
                title,
                linkType,
                rel,
                attributes
            );
        }
    }
    // CPD-ON
}
