// 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.databind.JsonNode;
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;

/**
 * Word document metadata.
 *
 * Extracted from DOCX files using shared Office Open XML metadata extraction.
 * Integrates with {@code office_metadata} module for core/app/custom properties.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = DocxMetadata.Builder.class)
public record DocxMetadata(
    /**
     * Core properties from docProps/core.xml (Dublin Core metadata)
     *
     * Contains title, creator, subject, keywords, dates, etc.
     * Shared format across DOCX/PPTX/XLSX documents.
     */
    @Nullable @JsonProperty("core_properties") CoreProperties coreProperties,
    /**
     * Application properties from docProps/app.xml (Word-specific statistics)
     *
     * Contains word count, page count, paragraph count, editing time, etc.
     * DOCX-specific variant of Office application properties.
     */
    @Nullable @JsonProperty("app_properties") DocxAppProperties appProperties,
    /**
     * Custom properties from docProps/custom.xml (user-defined properties)
     *
     * Contains key-value pairs defined by users or applications.
     * Values can be strings, numbers, booleans, or dates.
     */
    @Nullable @JsonProperty("custom_properties") Map<String, JsonNode> customProperties
) {
    public static Builder builder() {
        return new Builder();
    }

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

        @JsonProperty("core_properties")
private CoreProperties coreProperties = null;
        @JsonProperty("app_properties")
private DocxAppProperties appProperties = null;
        @JsonProperty("custom_properties")
private Map<String, JsonNode> customProperties = null;

        /** Sets the coreProperties field. */
        @JsonProperty("core_properties")
        public Builder withCoreProperties(final @Nullable CoreProperties value) {
            this.coreProperties = value;
            return this;
        }

        /** Sets the appProperties field. */
        @JsonProperty("app_properties")
        public Builder withAppProperties(final @Nullable DocxAppProperties value) {
            this.appProperties = value;
            return this;
        }

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

        /** Builds the DocxMetadata instance. */
        public DocxMetadata build() {
            return new DocxMetadata(
                coreProperties,
                appProperties,
                customProperties
            );
        }
    }
    // CPD-ON
}
