001
002package com.commercetools.history.models.change;
003
004import java.util.*;
005import java.util.function.Function;
006
007import io.vrap.rmf.base.client.Builder;
008import io.vrap.rmf.base.client.utils.Generated;
009
010/**
011 * SetDiscountedPriceChangeBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SetDiscountedPriceChange setDiscountedPriceChange = SetDiscountedPriceChange.builder()
017 *             .change("{change}")
018 *             .previousValue(previousValueBuilder -> previousValueBuilder)
019 *             .nextValue(nextValueBuilder -> nextValueBuilder)
020 *             .catalogData("{catalogData}")
021 *             .variant("{variant}")
022 *             .priceId("{priceId}")
023 *             .build()
024 * </code></pre>
025 * </div>
026 */
027@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
028public class SetDiscountedPriceChangeBuilder implements Builder<SetDiscountedPriceChange> {
029
030    private String change;
031
032    private com.commercetools.history.models.common.Price previousValue;
033
034    private com.commercetools.history.models.common.Price nextValue;
035
036    private String catalogData;
037
038    private String variant;
039
040    private String priceId;
041
042    /**
043     * set the value to the change
044     * @param change value to be set
045     * @return Builder
046     */
047
048    public SetDiscountedPriceChangeBuilder change(final String change) {
049        this.change = change;
050        return this;
051    }
052
053    /**
054     *  <p>Value before the change.</p>
055     * @param builder function to build the previousValue value
056     * @return Builder
057     */
058
059    public SetDiscountedPriceChangeBuilder previousValue(
060            Function<com.commercetools.history.models.common.PriceBuilder, com.commercetools.history.models.common.PriceBuilder> builder) {
061        this.previousValue = builder.apply(com.commercetools.history.models.common.PriceBuilder.of()).build();
062        return this;
063    }
064
065    /**
066     *  <p>Value before the change.</p>
067     * @param builder function to build the previousValue value
068     * @return Builder
069     */
070
071    public SetDiscountedPriceChangeBuilder withPreviousValue(
072            Function<com.commercetools.history.models.common.PriceBuilder, com.commercetools.history.models.common.Price> builder) {
073        this.previousValue = builder.apply(com.commercetools.history.models.common.PriceBuilder.of());
074        return this;
075    }
076
077    /**
078     *  <p>Value before the change.</p>
079     * @param previousValue value to be set
080     * @return Builder
081     */
082
083    public SetDiscountedPriceChangeBuilder previousValue(
084            final com.commercetools.history.models.common.Price previousValue) {
085        this.previousValue = previousValue;
086        return this;
087    }
088
089    /**
090     *  <p>Value after the change.</p>
091     * @param builder function to build the nextValue value
092     * @return Builder
093     */
094
095    public SetDiscountedPriceChangeBuilder nextValue(
096            Function<com.commercetools.history.models.common.PriceBuilder, com.commercetools.history.models.common.PriceBuilder> builder) {
097        this.nextValue = builder.apply(com.commercetools.history.models.common.PriceBuilder.of()).build();
098        return this;
099    }
100
101    /**
102     *  <p>Value after the change.</p>
103     * @param builder function to build the nextValue value
104     * @return Builder
105     */
106
107    public SetDiscountedPriceChangeBuilder withNextValue(
108            Function<com.commercetools.history.models.common.PriceBuilder, com.commercetools.history.models.common.Price> builder) {
109        this.nextValue = builder.apply(com.commercetools.history.models.common.PriceBuilder.of());
110        return this;
111    }
112
113    /**
114     *  <p>Value after the change.</p>
115     * @param nextValue value to be set
116     * @return Builder
117     */
118
119    public SetDiscountedPriceChangeBuilder nextValue(final com.commercetools.history.models.common.Price nextValue) {
120        this.nextValue = nextValue;
121        return this;
122    }
123
124    /**
125     *  <ul>
126     *   <li><code>staged</code>, if the staged ProductCatalogData was updated.</li>
127     *   <li><code>current</code>, if the current ProductCatalogData was updated.</li>
128     *  </ul>
129     * @param catalogData value to be set
130     * @return Builder
131     */
132
133    public SetDiscountedPriceChangeBuilder catalogData(final String catalogData) {
134        this.catalogData = catalogData;
135        return this;
136    }
137
138    /**
139     *  <p><code>sku</code> or <code>key</code> of the updated ProductVariant.</p>
140     * @param variant value to be set
141     * @return Builder
142     */
143
144    public SetDiscountedPriceChangeBuilder variant(final String variant) {
145        this.variant = variant;
146        return this;
147    }
148
149    /**
150     *  <p><code>id</code> of the Embedded Price.</p>
151     * @param priceId value to be set
152     * @return Builder
153     */
154
155    public SetDiscountedPriceChangeBuilder priceId(final String priceId) {
156        this.priceId = priceId;
157        return this;
158    }
159
160    /**
161     * value of change}
162     * @return change
163     */
164
165    public String getChange() {
166        return this.change;
167    }
168
169    /**
170     *  <p>Value before the change.</p>
171     * @return previousValue
172     */
173
174    public com.commercetools.history.models.common.Price getPreviousValue() {
175        return this.previousValue;
176    }
177
178    /**
179     *  <p>Value after the change.</p>
180     * @return nextValue
181     */
182
183    public com.commercetools.history.models.common.Price getNextValue() {
184        return this.nextValue;
185    }
186
187    /**
188     *  <ul>
189     *   <li><code>staged</code>, if the staged ProductCatalogData was updated.</li>
190     *   <li><code>current</code>, if the current ProductCatalogData was updated.</li>
191     *  </ul>
192     * @return catalogData
193     */
194
195    public String getCatalogData() {
196        return this.catalogData;
197    }
198
199    /**
200     *  <p><code>sku</code> or <code>key</code> of the updated ProductVariant.</p>
201     * @return variant
202     */
203
204    public String getVariant() {
205        return this.variant;
206    }
207
208    /**
209     *  <p><code>id</code> of the Embedded Price.</p>
210     * @return priceId
211     */
212
213    public String getPriceId() {
214        return this.priceId;
215    }
216
217    /**
218     * builds SetDiscountedPriceChange with checking for non-null required values
219     * @return SetDiscountedPriceChange
220     */
221    public SetDiscountedPriceChange build() {
222        Objects.requireNonNull(change, SetDiscountedPriceChange.class + ": change is missing");
223        Objects.requireNonNull(previousValue, SetDiscountedPriceChange.class + ": previousValue is missing");
224        Objects.requireNonNull(nextValue, SetDiscountedPriceChange.class + ": nextValue is missing");
225        Objects.requireNonNull(catalogData, SetDiscountedPriceChange.class + ": catalogData is missing");
226        Objects.requireNonNull(variant, SetDiscountedPriceChange.class + ": variant is missing");
227        Objects.requireNonNull(priceId, SetDiscountedPriceChange.class + ": priceId is missing");
228        return new SetDiscountedPriceChangeImpl(change, previousValue, nextValue, catalogData, variant, priceId);
229    }
230
231    /**
232     * builds SetDiscountedPriceChange without checking for non-null required values
233     * @return SetDiscountedPriceChange
234     */
235    public SetDiscountedPriceChange buildUnchecked() {
236        return new SetDiscountedPriceChangeImpl(change, previousValue, nextValue, catalogData, variant, priceId);
237    }
238
239    /**
240     * factory method for an instance of SetDiscountedPriceChangeBuilder
241     * @return builder
242     */
243    public static SetDiscountedPriceChangeBuilder of() {
244        return new SetDiscountedPriceChangeBuilder();
245    }
246
247    /**
248     * create builder for SetDiscountedPriceChange instance
249     * @param template instance with prefilled values for the builder
250     * @return builder
251     */
252    public static SetDiscountedPriceChangeBuilder of(final SetDiscountedPriceChange template) {
253        SetDiscountedPriceChangeBuilder builder = new SetDiscountedPriceChangeBuilder();
254        builder.change = template.getChange();
255        builder.previousValue = template.getPreviousValue();
256        builder.nextValue = template.getNextValue();
257        builder.catalogData = template.getCatalogData();
258        builder.variant = template.getVariant();
259        builder.priceId = template.getPriceId();
260        return builder;
261    }
262
263}