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

/**
 * JATS contributor with role.
 */
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ContributorRole.Builder.class)
public record ContributorRole(
    @JsonProperty("name") String name,
    @Nullable @JsonProperty("role") String role
) {
    public static Builder builder() {
        return new Builder();
    }

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

private String name = "";
private String role = null;

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

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

        /** Builds the ContributorRole instance. */
        public ContributorRole build() {
            return new ContributorRole(
                name,
                role
            );
        }
    }
    // CPD-ON
}
