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

/**
 * Structured data (Schema.org, microdata, RDFa) block.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = StructuredData.Builder.class)
public record StructuredData(
    /**
     * Type of structured data
     */
    @JsonProperty("data_type") StructuredDataType dataType,
    /**
     * Raw JSON string representation
     */
    @JsonProperty("raw_json") String rawJson,
    /**
     * Schema type if detectable (e.g., "Article", "Event", "Product")
     */
    @Nullable @JsonProperty("schema_type") String schemaType
) {
    public static Builder builder() {
        return new Builder();
    }

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

        @JsonProperty("data_type")
private StructuredDataType dataType = null;
        @JsonProperty("raw_json")
private String rawJson = "";
        @JsonProperty("schema_type")
private String schemaType = null;

        /** Sets the dataType field. */
        @JsonProperty("data_type")
        public Builder withDataType(final StructuredDataType value) {
            this.dataType = value;
            return this;
        }

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

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

        /** Builds the StructuredData instance. */
        public StructuredData build() {
            return new StructuredData(
                dataType,
                rawJson,
                schemaType
            );
        }
    }
    // CPD-ON
}
