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

/**
 * JATS (Journal Article Tag Suite) metadata.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = JatsMetadata.Builder.class)
public record JatsMetadata(
    @Nullable @JsonProperty("copyright") String copyright,
    @Nullable @JsonProperty("license") String license,
    @Nullable @JsonProperty("history_dates") Map<String, String> historyDates,
    @Nullable @JsonProperty("contributor_roles") List<ContributorRole> contributorRoles
) {
    public static Builder builder() {
        return new Builder();
    }

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

private String copyright = null;
private String license = null;
        @JsonProperty("history_dates")
private Map<String, String> historyDates = null;
        @JsonProperty("contributor_roles")
private List<ContributorRole> contributorRoles = null;

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

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

        /** Sets the historyDates field. */
        @JsonProperty("history_dates")
        public Builder withHistoryDates(final @Nullable Map<String, String> value) {
            this.historyDates = value;
            return this;
        }

        /** Sets the contributorRoles field. */
        @JsonProperty("contributor_roles")
        public Builder withContributorRoles(final @Nullable List<ContributorRole> value) {
            this.contributorRoles = value;
            return this;
        }

        /** Builds the JatsMetadata instance. */
        public JatsMetadata build() {
            return new JatsMetadata(
                copyright,
                license,
                historyDates,
                contributorRoles
            );
        }
    }
    // CPD-ON
}
