001
002package com.commercetools.ml.models.similar_products;
003
004import java.util.*;
005
006import javax.annotation.Nullable;
007
008import io.vrap.rmf.base.client.Builder;
009import io.vrap.rmf.base.client.utils.Generated;
010
011/**
012 * ProductSetSelectorBuilder
013 * <hr>
014 * Example to create an instance using the builder pattern
015 * <div class=code-example>
016 * <pre><code class='java'>
017 *     ProductSetSelector productSetSelector = ProductSetSelector.builder()
018 *             .projectKey("{projectKey}")
019 *             .build()
020 * </code></pre>
021 * </div>
022 */
023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
024public class ProductSetSelectorBuilder implements Builder<ProductSetSelector> {
025
026    private String projectKey;
027
028    @Nullable
029    private java.util.List<String> productIds;
030
031    @Nullable
032    private java.util.List<String> productTypeIds;
033
034    @Nullable
035    private Boolean staged;
036
037    @Nullable
038    private Boolean includeVariants;
039
040    @Nullable
041    private Long productSetLimit;
042
043    /**
044     *  <p>The project containing the project set.</p>
045     */
046
047    public ProductSetSelectorBuilder projectKey(final String projectKey) {
048        this.projectKey = projectKey;
049        return this;
050    }
051
052    /**
053     *  <p>An array of Product IDs to compare. If unspecified, no Product ID filter is applied.</p>
054     */
055
056    public ProductSetSelectorBuilder productIds(@Nullable final String... productIds) {
057        this.productIds = new ArrayList<>(Arrays.asList(productIds));
058        return this;
059    }
060
061    /**
062     *  <p>An array of Product IDs to compare. If unspecified, no Product ID filter is applied.</p>
063     */
064
065    public ProductSetSelectorBuilder productIds(@Nullable final java.util.List<String> productIds) {
066        this.productIds = productIds;
067        return this;
068    }
069
070    /**
071     *  <p>An array of Product IDs to compare. If unspecified, no Product ID filter is applied.</p>
072     */
073
074    public ProductSetSelectorBuilder plusProductIds(@Nullable final String... productIds) {
075        if (this.productIds == null) {
076            this.productIds = new ArrayList<>();
077        }
078        this.productIds.addAll(Arrays.asList(productIds));
079        return this;
080    }
081
082    /**
083     *  <p>An array of product type IDs. Only products with product types in this array are compared. If unspecified, no product type filter is applied.</p>
084     */
085
086    public ProductSetSelectorBuilder productTypeIds(@Nullable final String... productTypeIds) {
087        this.productTypeIds = new ArrayList<>(Arrays.asList(productTypeIds));
088        return this;
089    }
090
091    /**
092     *  <p>An array of product type IDs. Only products with product types in this array are compared. If unspecified, no product type filter is applied.</p>
093     */
094
095    public ProductSetSelectorBuilder productTypeIds(@Nullable final java.util.List<String> productTypeIds) {
096        this.productTypeIds = productTypeIds;
097        return this;
098    }
099
100    /**
101     *  <p>An array of product type IDs. Only products with product types in this array are compared. If unspecified, no product type filter is applied.</p>
102     */
103
104    public ProductSetSelectorBuilder plusProductTypeIds(@Nullable final String... productTypeIds) {
105        if (this.productTypeIds == null) {
106            this.productTypeIds = new ArrayList<>();
107        }
108        this.productTypeIds.addAll(Arrays.asList(productTypeIds));
109        return this;
110    }
111
112    /**
113     *  <p>Specifies use of staged or current product data.</p>
114     */
115
116    public ProductSetSelectorBuilder staged(@Nullable final Boolean staged) {
117        this.staged = staged;
118        return this;
119    }
120
121    /**
122     *  <p>Specifies use of product variants. If set to <code>true</code>, all product variants are compared, not just the master variant.</p>
123     */
124
125    public ProductSetSelectorBuilder includeVariants(@Nullable final Boolean includeVariants) {
126        this.includeVariants = includeVariants;
127        return this;
128    }
129
130    /**
131     *  <p>Maximum number of products to check (if unspecified, all products are considered). Note that the maximum number of product comparisons between two productSets is 20,000,000. This limit cannot be exceeded. If you need a higher limit, contact https://support.commercetools.com</p>
132     */
133
134    public ProductSetSelectorBuilder productSetLimit(@Nullable final Long productSetLimit) {
135        this.productSetLimit = productSetLimit;
136        return this;
137    }
138
139    public String getProjectKey() {
140        return this.projectKey;
141    }
142
143    @Nullable
144    public java.util.List<String> getProductIds() {
145        return this.productIds;
146    }
147
148    @Nullable
149    public java.util.List<String> getProductTypeIds() {
150        return this.productTypeIds;
151    }
152
153    @Nullable
154    public Boolean getStaged() {
155        return this.staged;
156    }
157
158    @Nullable
159    public Boolean getIncludeVariants() {
160        return this.includeVariants;
161    }
162
163    @Nullable
164    public Long getProductSetLimit() {
165        return this.productSetLimit;
166    }
167
168    public ProductSetSelector build() {
169        Objects.requireNonNull(projectKey, ProductSetSelector.class + ": projectKey is missing");
170        return new ProductSetSelectorImpl(projectKey, productIds, productTypeIds, staged, includeVariants,
171            productSetLimit);
172    }
173
174    /**
175     * builds ProductSetSelector without checking for non null required values
176     */
177    public ProductSetSelector buildUnchecked() {
178        return new ProductSetSelectorImpl(projectKey, productIds, productTypeIds, staged, includeVariants,
179            productSetLimit);
180    }
181
182    public static ProductSetSelectorBuilder of() {
183        return new ProductSetSelectorBuilder();
184    }
185
186    public static ProductSetSelectorBuilder of(final ProductSetSelector template) {
187        ProductSetSelectorBuilder builder = new ProductSetSelectorBuilder();
188        builder.projectKey = template.getProjectKey();
189        builder.productIds = template.getProductIds();
190        builder.productTypeIds = template.getProductTypeIds();
191        builder.staged = template.getStaged();
192        builder.includeVariants = template.getIncludeVariants();
193        builder.productSetLimit = template.getProductSetLimit();
194        return builder;
195    }
196
197}