001
002package com.commercetools.api.models.business_unit;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.Valid;
010import javax.validation.constraints.NotNull;
011
012import com.commercetools.api.models.associate_role.AssociateRoleKeyReference;
013import com.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 * AssociateRoleAssignment
020 *
021 * <hr>
022 * Example to create an instance using the builder pattern
023 * <div class=code-example>
024 * <pre><code class='java'>
025 *     AssociateRoleAssignment associateRoleAssignment = AssociateRoleAssignment.builder()
026 *             .associateRole(associateRoleBuilder -> associateRoleBuilder)
027 *             .inheritance(AssociateRoleInheritanceMode.ENABLED)
028 *             .build()
029 * </code></pre>
030 * </div>
031 */
032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
033@JsonDeserialize(as = AssociateRoleAssignmentImpl.class)
034public interface AssociateRoleAssignment {
035
036    /**
037     *  <p>Role the Associate holds within a Business Unit.</p>
038     * @return associateRole
039     */
040    @NotNull
041    @Valid
042    @JsonProperty("associateRole")
043    public AssociateRoleKeyReference getAssociateRole();
044
045    /**
046     *  <p>Determines whether the AssociateRoleAssignment can be inherited by child Business Units.</p>
047     * @return inheritance
048     */
049    @NotNull
050    @JsonProperty("inheritance")
051    public AssociateRoleInheritanceMode getInheritance();
052
053    /**
054     *  <p>Role the Associate holds within a Business Unit.</p>
055     * @param associateRole value to be set
056     */
057
058    public void setAssociateRole(final AssociateRoleKeyReference associateRole);
059
060    /**
061     *  <p>Determines whether the AssociateRoleAssignment can be inherited by child Business Units.</p>
062     * @param inheritance value to be set
063     */
064
065    public void setInheritance(final AssociateRoleInheritanceMode inheritance);
066
067    /**
068     * factory method
069     * @return instance of AssociateRoleAssignment
070     */
071    public static AssociateRoleAssignment of() {
072        return new AssociateRoleAssignmentImpl();
073    }
074
075    /**
076     * factory method to create a shallow copy AssociateRoleAssignment
077     * @param template instance to be copied
078     * @return copy instance
079     */
080    public static AssociateRoleAssignment of(final AssociateRoleAssignment template) {
081        AssociateRoleAssignmentImpl instance = new AssociateRoleAssignmentImpl();
082        instance.setAssociateRole(template.getAssociateRole());
083        instance.setInheritance(template.getInheritance());
084        return instance;
085    }
086
087    /**
088     * factory method to create a deep copy of AssociateRoleAssignment
089     * @param template instance to be copied
090     * @return copy instance
091     */
092    @Nullable
093    public static AssociateRoleAssignment deepCopy(@Nullable final AssociateRoleAssignment template) {
094        if (template == null) {
095            return null;
096        }
097        AssociateRoleAssignmentImpl instance = new AssociateRoleAssignmentImpl();
098        instance.setAssociateRole(com.commercetools.api.models.associate_role.AssociateRoleKeyReference
099                .deepCopy(template.getAssociateRole()));
100        instance.setInheritance(template.getInheritance());
101        return instance;
102    }
103
104    /**
105     * builder factory method for AssociateRoleAssignment
106     * @return builder
107     */
108    public static AssociateRoleAssignmentBuilder builder() {
109        return AssociateRoleAssignmentBuilder.of();
110    }
111
112    /**
113     * create builder for AssociateRoleAssignment instance
114     * @param template instance with prefilled values for the builder
115     * @return builder
116     */
117    public static AssociateRoleAssignmentBuilder builder(final AssociateRoleAssignment template) {
118        return AssociateRoleAssignmentBuilder.of(template);
119    }
120
121    /**
122     * accessor map function
123     * @param <T> mapped type
124     * @param helper function to map the object
125     * @return mapped value
126     */
127    default <T> T withAssociateRoleAssignment(Function<AssociateRoleAssignment, T> helper) {
128        return helper.apply(this);
129    }
130
131    /**
132     * gives a TypeReference for usage with Jackson DataBind
133     * @return TypeReference
134     */
135    public static com.fasterxml.jackson.core.type.TypeReference<AssociateRoleAssignment> typeReference() {
136        return new com.fasterxml.jackson.core.type.TypeReference<AssociateRoleAssignment>() {
137            @Override
138            public String toString() {
139                return "TypeReference<AssociateRoleAssignment>";
140            }
141        };
142    }
143}