001
002package com.commercetools.history.models.change_value;
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 * ChangeValueGiftLineItemChangeValueBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     ChangeValueGiftLineItemChangeValue changeValueGiftLineItemChangeValue = ChangeValueGiftLineItemChangeValue.builder()
019 *             .product(productBuilder -> productBuilder)
020 *             .variantId(1)
021 *             .distributionChannel(distributionChannelBuilder -> distributionChannelBuilder)
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 ChangeValueGiftLineItemChangeValueBuilder implements Builder<ChangeValueGiftLineItemChangeValue> {
028
029    private com.commercetools.history.models.common.Reference product;
030
031    private Integer variantId;
032
033    @Nullable
034    private com.commercetools.history.models.common.Reference supplyChannel;
035
036    private com.commercetools.history.models.common.Reference distributionChannel;
037
038    /**
039     *  <p>Reference to a Product.</p>
040     * @param builder function to build the product value
041     * @return Builder
042     */
043
044    public ChangeValueGiftLineItemChangeValueBuilder product(
045            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) {
046        this.product = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build();
047        return this;
048    }
049
050    /**
051     *  <p>Reference to a Product.</p>
052     * @param builder function to build the product value
053     * @return Builder
054     */
055
056    public ChangeValueGiftLineItemChangeValueBuilder withProduct(
057            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) {
058        this.product = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of());
059        return this;
060    }
061
062    /**
063     *  <p>Reference to a Product.</p>
064     * @param product value to be set
065     * @return Builder
066     */
067
068    public ChangeValueGiftLineItemChangeValueBuilder product(
069            final com.commercetools.history.models.common.Reference product) {
070        this.product = product;
071        return this;
072    }
073
074    /**
075     *  <p><code>id</code> of the ProductVariant.</p>
076     * @param variantId value to be set
077     * @return Builder
078     */
079
080    public ChangeValueGiftLineItemChangeValueBuilder variantId(final Integer variantId) {
081        this.variantId = variantId;
082        return this;
083    }
084
085    /**
086     *  <p>Channel with ChannelRoleEnum <code>InventorySupply</code>.</p>
087     * @param builder function to build the supplyChannel value
088     * @return Builder
089     */
090
091    public ChangeValueGiftLineItemChangeValueBuilder supplyChannel(
092            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) {
093        this.supplyChannel = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build();
094        return this;
095    }
096
097    /**
098     *  <p>Channel with ChannelRoleEnum <code>InventorySupply</code>.</p>
099     * @param builder function to build the supplyChannel value
100     * @return Builder
101     */
102
103    public ChangeValueGiftLineItemChangeValueBuilder withSupplyChannel(
104            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) {
105        this.supplyChannel = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of());
106        return this;
107    }
108
109    /**
110     *  <p>Channel with ChannelRoleEnum <code>InventorySupply</code>.</p>
111     * @param supplyChannel value to be set
112     * @return Builder
113     */
114
115    public ChangeValueGiftLineItemChangeValueBuilder supplyChannel(
116            @Nullable final com.commercetools.history.models.common.Reference supplyChannel) {
117        this.supplyChannel = supplyChannel;
118        return this;
119    }
120
121    /**
122     *  <p>Channel with ChannelRoleEnum <code>ProductDistribution</code>.</p>
123     * @param builder function to build the distributionChannel value
124     * @return Builder
125     */
126
127    public ChangeValueGiftLineItemChangeValueBuilder distributionChannel(
128            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) {
129        this.distributionChannel = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build();
130        return this;
131    }
132
133    /**
134     *  <p>Channel with ChannelRoleEnum <code>ProductDistribution</code>.</p>
135     * @param builder function to build the distributionChannel value
136     * @return Builder
137     */
138
139    public ChangeValueGiftLineItemChangeValueBuilder withDistributionChannel(
140            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) {
141        this.distributionChannel = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of());
142        return this;
143    }
144
145    /**
146     *  <p>Channel with ChannelRoleEnum <code>ProductDistribution</code>.</p>
147     * @param distributionChannel value to be set
148     * @return Builder
149     */
150
151    public ChangeValueGiftLineItemChangeValueBuilder distributionChannel(
152            final com.commercetools.history.models.common.Reference distributionChannel) {
153        this.distributionChannel = distributionChannel;
154        return this;
155    }
156
157    /**
158     *  <p>Reference to a Product.</p>
159     * @return product
160     */
161
162    public com.commercetools.history.models.common.Reference getProduct() {
163        return this.product;
164    }
165
166    /**
167     *  <p><code>id</code> of the ProductVariant.</p>
168     * @return variantId
169     */
170
171    public Integer getVariantId() {
172        return this.variantId;
173    }
174
175    /**
176     *  <p>Channel with ChannelRoleEnum <code>InventorySupply</code>.</p>
177     * @return supplyChannel
178     */
179
180    @Nullable
181    public com.commercetools.history.models.common.Reference getSupplyChannel() {
182        return this.supplyChannel;
183    }
184
185    /**
186     *  <p>Channel with ChannelRoleEnum <code>ProductDistribution</code>.</p>
187     * @return distributionChannel
188     */
189
190    public com.commercetools.history.models.common.Reference getDistributionChannel() {
191        return this.distributionChannel;
192    }
193
194    /**
195     * builds ChangeValueGiftLineItemChangeValue with checking for non-null required values
196     * @return ChangeValueGiftLineItemChangeValue
197     */
198    public ChangeValueGiftLineItemChangeValue build() {
199        Objects.requireNonNull(product, ChangeValueGiftLineItemChangeValue.class + ": product is missing");
200        Objects.requireNonNull(variantId, ChangeValueGiftLineItemChangeValue.class + ": variantId is missing");
201        Objects.requireNonNull(distributionChannel,
202            ChangeValueGiftLineItemChangeValue.class + ": distributionChannel is missing");
203        return new ChangeValueGiftLineItemChangeValueImpl(product, variantId, supplyChannel, distributionChannel);
204    }
205
206    /**
207     * builds ChangeValueGiftLineItemChangeValue without checking for non-null required values
208     * @return ChangeValueGiftLineItemChangeValue
209     */
210    public ChangeValueGiftLineItemChangeValue buildUnchecked() {
211        return new ChangeValueGiftLineItemChangeValueImpl(product, variantId, supplyChannel, distributionChannel);
212    }
213
214    /**
215     * factory method for an instance of ChangeValueGiftLineItemChangeValueBuilder
216     * @return builder
217     */
218    public static ChangeValueGiftLineItemChangeValueBuilder of() {
219        return new ChangeValueGiftLineItemChangeValueBuilder();
220    }
221
222    /**
223     * create builder for ChangeValueGiftLineItemChangeValue instance
224     * @param template instance with prefilled values for the builder
225     * @return builder
226     */
227    public static ChangeValueGiftLineItemChangeValueBuilder of(final ChangeValueGiftLineItemChangeValue template) {
228        ChangeValueGiftLineItemChangeValueBuilder builder = new ChangeValueGiftLineItemChangeValueBuilder();
229        builder.product = template.getProduct();
230        builder.variantId = template.getVariantId();
231        builder.supplyChannel = template.getSupplyChannel();
232        builder.distributionChannel = template.getDistributionChannel();
233        return builder;
234    }
235
236}