001
002package com.commercetools.api.models.error;
003
004import java.util.*;
005import java.util.function.Function;
006
007import javax.annotation.Nullable;
008
009import io.vrap.rmf.base.client.Builder;
010import io.vrap.rmf.base.client.utils.Generated;
011
012/**
013 * GraphQLAssociateMissingPermissionErrorBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     GraphQLAssociateMissingPermissionError graphQLAssociateMissingPermissionError = GraphQLAssociateMissingPermissionError.builder()
019 *             .associate(associateBuilder -> associateBuilder)
020 *             .businessUnit(businessUnitBuilder -> businessUnitBuilder)
021 *             .plusPermissions(permissionsBuilder -> permissionsBuilder)
022 *             .build()
023 * </code></pre>
024 * </div>
025 */
026@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
027public class GraphQLAssociateMissingPermissionErrorBuilder implements Builder<GraphQLAssociateMissingPermissionError> {
028
029    private Map<String, java.lang.Object> values = new HashMap<>();
030
031    private com.commercetools.api.models.customer.CustomerResourceIdentifier associate;
032
033    private com.commercetools.api.models.business_unit.BusinessUnitResourceIdentifier businessUnit;
034
035    @Nullable
036    private com.commercetools.api.models.customer.CustomerResourceIdentifier associateOnBehalf;
037
038    private java.util.List<com.commercetools.api.models.associate_role.Permission> permissions;
039
040    /**
041     *  <p>Error-specific additional fields.</p>
042     * @param values properties to be set
043     * @return Builder
044     */
045
046    public GraphQLAssociateMissingPermissionErrorBuilder values(final Map<String, java.lang.Object> values) {
047        this.values = values;
048        return this;
049    }
050
051    /**
052     *  <p>Error-specific additional fields.</p>
053     * @param key property name
054     * @param value property value
055     * @return Builder
056     */
057
058    public GraphQLAssociateMissingPermissionErrorBuilder addValue(final String key, final java.lang.Object value) {
059        if (this.values == null) {
060            values = new HashMap<>();
061        }
062        values.put(key, value);
063        return this;
064    }
065
066    /**
067     *  <p>ResourceIdentifier to the Associate that tried to perform the action.</p>
068     * @param builder function to build the associate value
069     * @return Builder
070     */
071
072    public GraphQLAssociateMissingPermissionErrorBuilder associate(
073            Function<com.commercetools.api.models.customer.CustomerResourceIdentifierBuilder, com.commercetools.api.models.customer.CustomerResourceIdentifierBuilder> builder) {
074        this.associate = builder.apply(com.commercetools.api.models.customer.CustomerResourceIdentifierBuilder.of())
075                .build();
076        return this;
077    }
078
079    /**
080     *  <p>ResourceIdentifier to the Associate that tried to perform the action.</p>
081     * @param builder function to build the associate value
082     * @return Builder
083     */
084
085    public GraphQLAssociateMissingPermissionErrorBuilder withAssociate(
086            Function<com.commercetools.api.models.customer.CustomerResourceIdentifierBuilder, com.commercetools.api.models.customer.CustomerResourceIdentifier> builder) {
087        this.associate = builder.apply(com.commercetools.api.models.customer.CustomerResourceIdentifierBuilder.of());
088        return this;
089    }
090
091    /**
092     *  <p>ResourceIdentifier to the Associate that tried to perform the action.</p>
093     * @param associate value to be set
094     * @return Builder
095     */
096
097    public GraphQLAssociateMissingPermissionErrorBuilder associate(
098            final com.commercetools.api.models.customer.CustomerResourceIdentifier associate) {
099        this.associate = associate;
100        return this;
101    }
102
103    /**
104     *  <p>ResourceIdentifier to the BusinessUnit.</p>
105     * @param builder function to build the businessUnit value
106     * @return Builder
107     */
108
109    public GraphQLAssociateMissingPermissionErrorBuilder businessUnit(
110            Function<com.commercetools.api.models.business_unit.BusinessUnitResourceIdentifierBuilder, com.commercetools.api.models.business_unit.BusinessUnitResourceIdentifierBuilder> builder) {
111        this.businessUnit = builder
112                .apply(com.commercetools.api.models.business_unit.BusinessUnitResourceIdentifierBuilder.of())
113                .build();
114        return this;
115    }
116
117    /**
118     *  <p>ResourceIdentifier to the BusinessUnit.</p>
119     * @param builder function to build the businessUnit value
120     * @return Builder
121     */
122
123    public GraphQLAssociateMissingPermissionErrorBuilder withBusinessUnit(
124            Function<com.commercetools.api.models.business_unit.BusinessUnitResourceIdentifierBuilder, com.commercetools.api.models.business_unit.BusinessUnitResourceIdentifier> builder) {
125        this.businessUnit = builder
126                .apply(com.commercetools.api.models.business_unit.BusinessUnitResourceIdentifierBuilder.of());
127        return this;
128    }
129
130    /**
131     *  <p>ResourceIdentifier to the BusinessUnit.</p>
132     * @param businessUnit value to be set
133     * @return Builder
134     */
135
136    public GraphQLAssociateMissingPermissionErrorBuilder businessUnit(
137            final com.commercetools.api.models.business_unit.BusinessUnitResourceIdentifier businessUnit) {
138        this.businessUnit = businessUnit;
139        return this;
140    }
141
142    /**
143     *  <p>ResourceIdentifier of the Associate on whose behalf the action is performed.</p>
144     * @param builder function to build the associateOnBehalf value
145     * @return Builder
146     */
147
148    public GraphQLAssociateMissingPermissionErrorBuilder associateOnBehalf(
149            Function<com.commercetools.api.models.customer.CustomerResourceIdentifierBuilder, com.commercetools.api.models.customer.CustomerResourceIdentifierBuilder> builder) {
150        this.associateOnBehalf = builder
151                .apply(com.commercetools.api.models.customer.CustomerResourceIdentifierBuilder.of())
152                .build();
153        return this;
154    }
155
156    /**
157     *  <p>ResourceIdentifier of the Associate on whose behalf the action is performed.</p>
158     * @param builder function to build the associateOnBehalf value
159     * @return Builder
160     */
161
162    public GraphQLAssociateMissingPermissionErrorBuilder withAssociateOnBehalf(
163            Function<com.commercetools.api.models.customer.CustomerResourceIdentifierBuilder, com.commercetools.api.models.customer.CustomerResourceIdentifier> builder) {
164        this.associateOnBehalf = builder
165                .apply(com.commercetools.api.models.customer.CustomerResourceIdentifierBuilder.of());
166        return this;
167    }
168
169    /**
170     *  <p>ResourceIdentifier of the Associate on whose behalf the action is performed.</p>
171     * @param associateOnBehalf value to be set
172     * @return Builder
173     */
174
175    public GraphQLAssociateMissingPermissionErrorBuilder associateOnBehalf(
176            @Nullable final com.commercetools.api.models.customer.CustomerResourceIdentifier associateOnBehalf) {
177        this.associateOnBehalf = associateOnBehalf;
178        return this;
179    }
180
181    /**
182     *  <p>The Permissions that the Associate performing the action lacks. At least one of these Permissions is needed.</p>
183     * @param permissions value to be set
184     * @return Builder
185     */
186
187    public GraphQLAssociateMissingPermissionErrorBuilder permissions(
188            final com.commercetools.api.models.associate_role.Permission... permissions) {
189        this.permissions = new ArrayList<>(Arrays.asList(permissions));
190        return this;
191    }
192
193    /**
194     *  <p>The Permissions that the Associate performing the action lacks. At least one of these Permissions is needed.</p>
195     * @param permissions value to be set
196     * @return Builder
197     */
198
199    public GraphQLAssociateMissingPermissionErrorBuilder permissions(
200            final java.util.List<com.commercetools.api.models.associate_role.Permission> permissions) {
201        this.permissions = permissions;
202        return this;
203    }
204
205    /**
206     *  <p>The Permissions that the Associate performing the action lacks. At least one of these Permissions is needed.</p>
207     * @param permissions value to be set
208     * @return Builder
209     */
210
211    public GraphQLAssociateMissingPermissionErrorBuilder plusPermissions(
212            final com.commercetools.api.models.associate_role.Permission... permissions) {
213        if (this.permissions == null) {
214            this.permissions = new ArrayList<>();
215        }
216        this.permissions.addAll(Arrays.asList(permissions));
217        return this;
218    }
219
220    /**
221     *  <p>Error-specific additional fields.</p>
222     * @return pattern properties
223     */
224
225    public Map<String, java.lang.Object> getValues() {
226        return this.values;
227    }
228
229    /**
230     *  <p>ResourceIdentifier to the Associate that tried to perform the action.</p>
231     * @return associate
232     */
233
234    public com.commercetools.api.models.customer.CustomerResourceIdentifier getAssociate() {
235        return this.associate;
236    }
237
238    /**
239     *  <p>ResourceIdentifier to the BusinessUnit.</p>
240     * @return businessUnit
241     */
242
243    public com.commercetools.api.models.business_unit.BusinessUnitResourceIdentifier getBusinessUnit() {
244        return this.businessUnit;
245    }
246
247    /**
248     *  <p>ResourceIdentifier of the Associate on whose behalf the action is performed.</p>
249     * @return associateOnBehalf
250     */
251
252    @Nullable
253    public com.commercetools.api.models.customer.CustomerResourceIdentifier getAssociateOnBehalf() {
254        return this.associateOnBehalf;
255    }
256
257    /**
258     *  <p>The Permissions that the Associate performing the action lacks. At least one of these Permissions is needed.</p>
259     * @return permissions
260     */
261
262    public java.util.List<com.commercetools.api.models.associate_role.Permission> getPermissions() {
263        return this.permissions;
264    }
265
266    /**
267     * builds GraphQLAssociateMissingPermissionError with checking for non-null required values
268     * @return GraphQLAssociateMissingPermissionError
269     */
270    public GraphQLAssociateMissingPermissionError build() {
271        Objects.requireNonNull(associate, GraphQLAssociateMissingPermissionError.class + ": associate is missing");
272        Objects.requireNonNull(businessUnit,
273            GraphQLAssociateMissingPermissionError.class + ": businessUnit is missing");
274        Objects.requireNonNull(permissions, GraphQLAssociateMissingPermissionError.class + ": permissions is missing");
275        return new GraphQLAssociateMissingPermissionErrorImpl(values, associate, businessUnit, associateOnBehalf,
276            permissions);
277    }
278
279    /**
280     * builds GraphQLAssociateMissingPermissionError without checking for non-null required values
281     * @return GraphQLAssociateMissingPermissionError
282     */
283    public GraphQLAssociateMissingPermissionError buildUnchecked() {
284        return new GraphQLAssociateMissingPermissionErrorImpl(values, associate, businessUnit, associateOnBehalf,
285            permissions);
286    }
287
288    /**
289     * factory method for an instance of GraphQLAssociateMissingPermissionErrorBuilder
290     * @return builder
291     */
292    public static GraphQLAssociateMissingPermissionErrorBuilder of() {
293        return new GraphQLAssociateMissingPermissionErrorBuilder();
294    }
295
296    /**
297     * create builder for GraphQLAssociateMissingPermissionError instance
298     * @param template instance with prefilled values for the builder
299     * @return builder
300     */
301    public static GraphQLAssociateMissingPermissionErrorBuilder of(
302            final GraphQLAssociateMissingPermissionError template) {
303        GraphQLAssociateMissingPermissionErrorBuilder builder = new GraphQLAssociateMissingPermissionErrorBuilder();
304        builder.values = template.values();
305        builder.associate = template.getAssociate();
306        builder.businessUnit = template.getBusinessUnit();
307        builder.associateOnBehalf = template.getAssociateOnBehalf();
308        builder.permissions = template.getPermissions();
309        return builder;
310    }
311
312}