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

/**
 * PDF-specific metadata.
 *
 * Contains metadata fields specific to PDF documents that are not in the common
 * {@code Metadata} structure. Common fields like title, authors, keywords, and dates
 * are at the {@code Metadata} level.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = PdfMetadata.Builder.class)
public record PdfMetadata(
    /**
     * PDF version (e.g., "1.7", "2.0")
     */
    @Nullable @JsonProperty("pdf_version") String pdfVersion,
    /**
     * PDF producer (application that created the PDF)
     */
    @Nullable @JsonProperty("producer") String producer,
    /**
     * Whether the PDF is encrypted/password-protected
     */
    @Nullable @JsonProperty("is_encrypted") Boolean isEncrypted,
    /**
     * First page width in points (1/72 inch)
     */
    @Nullable @JsonProperty("width") Long width,
    /**
     * First page height in points (1/72 inch)
     */
    @Nullable @JsonProperty("height") Long height,
    /**
     * Total number of pages in the PDF document
     */
    @Nullable @JsonProperty("page_count") Integer pageCount
) {
    public static Builder builder() {
        return new Builder();
    }

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

        @JsonProperty("pdf_version")
private String pdfVersion = null;
private String producer = null;
        @JsonProperty("is_encrypted")
private Boolean isEncrypted = null;
private Long width = null;
private Long height = null;
        @JsonProperty("page_count")
private Integer pageCount = null;

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

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

        /** Sets the isEncrypted field. */
        @JsonProperty("is_encrypted")
        public Builder withIsEncrypted(final @Nullable boolean value) {
            this.isEncrypted = value;
            return this;
        }

        /** Sets the width field. */
        @JsonProperty("width")
        public Builder withWidth(final @Nullable long value) {
            this.width = value;
            return this;
        }

        /** Sets the height field. */
        @JsonProperty("height")
        public Builder withHeight(final @Nullable long value) {
            this.height = value;
            return this;
        }

        /** Sets the pageCount field. */
        @JsonProperty("page_count")
        public Builder withPageCount(final @Nullable int value) {
            this.pageCount = value;
            return this;
        }

        /** Builds the PdfMetadata instance. */
        public PdfMetadata build() {
            return new PdfMetadata(
                pdfVersion,
                producer,
                isEncrypted,
                width,
                height,
                pageCount
            );
        }
    }
    // CPD-ON
}
