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

/**
 * Citation file metadata (RIS, PubMed, EndNote).
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = CitationMetadata.Builder.class)
public record CitationMetadata(
    @JsonProperty("citation_count") long citationCount,
    @Nullable @JsonProperty("format") String format,
    @Nullable @JsonProperty("authors") List<String> authors,
    @Nullable @JsonProperty("year_range") YearRange yearRange,
    @Nullable @JsonProperty("dois") List<String> dois,
    @Nullable @JsonProperty("keywords") List<String> keywords
) {
    public static Builder builder() {
        return new Builder();
    }

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

        @JsonProperty("citation_count")
private long citationCount = 0;
private String format = null;
private List<String> authors = null;
        @JsonProperty("year_range")
private YearRange yearRange = null;
private List<String> dois = null;
private List<String> keywords = null;

        /** Sets the citationCount field. */
        @JsonProperty("citation_count")
        public Builder withCitationCount(final long value) {
            this.citationCount = value;
            return this;
        }

        /** Sets the format field. */
        @JsonProperty("format")
        public Builder withFormat(final @Nullable String value) {
            this.format = 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 dois field. */
        @JsonProperty("dois")
        public Builder withDois(final @Nullable List<String> value) {
            this.dois = value;
            return this;
        }

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

        /** Builds the CitationMetadata instance. */
        public CitationMetadata build() {
            return new CitationMetadata(
                citationCount,
                format,
                authors,
                yearRange,
                dois,
                keywords
            );
        }
    }
    // CPD-ON
}
