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

/**
 * Year range for bibliographic metadata.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = YearRange.Builder.class)
public record YearRange(
    @Nullable @JsonProperty("min") Integer min,
    @Nullable @JsonProperty("max") Integer max,
    @Nullable @JsonProperty("years") List<Integer> years
) {
    public static Builder builder() {
        return new Builder();
    }

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

private Integer min = null;
private Integer max = null;
private List<Integer> years = null;

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

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

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

        /** Builds the YearRange instance. */
        public YearRange build() {
            return new YearRange(
                min,
                max,
                years
            );
        }
    }
    // CPD-ON
}
