// 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 java.util.Map;
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;

/**
 * BibTeX bibliography metadata.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = BibtexMetadata.Builder.class)
public record BibtexMetadata(
    /**
     * Number of entries in the bibliography.
     */
    @JsonProperty("entry_count") long entryCount,
    @Nullable @JsonProperty("citation_keys") List<String> citationKeys,
    @Nullable @JsonProperty("authors") List<String> authors,
    @Nullable @JsonProperty("year_range") YearRange yearRange,
    @Nullable @JsonProperty("entry_types") Map<String, Long> entryTypes
) {
    public static Builder builder() {
        return new Builder();
    }

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

        @JsonProperty("entry_count")
private long entryCount = 0;
        @JsonProperty("citation_keys")
private List<String> citationKeys = null;
private List<String> authors = null;
        @JsonProperty("year_range")
private YearRange yearRange = null;
        @JsonProperty("entry_types")
private Map<String, Long> entryTypes = null;

        /** Sets the entryCount field. */
        @JsonProperty("entry_count")
        public Builder withEntryCount(final long value) {
            this.entryCount = value;
            return this;
        }

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

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

        /** Sets the yearRange field. */
        @JsonProperty("year_range")
        public Builder withYearRange(final @Nullable YearRange value) {
            this.yearRange = value;
            return this;
        }

        /** Sets the entryTypes field. */
        @JsonProperty("entry_types")
        public Builder withEntryTypes(final @Nullable Map<String, Long> value) {
            this.entryTypes = value;
            return this;
        }

        /** Builds the BibtexMetadata instance. */
        public BibtexMetadata build() {
            return new BibtexMetadata(
                entryCount,
                citationKeys,
                authors,
                yearRange,
                entryTypes
            );
        }
    }
    // CPD-ON
}
