001
002package com.commercetools.ml.models.similar_products;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007import java.util.stream.Collectors;
008
009import javax.annotation.Nullable;
010import javax.validation.Valid;
011
012import com.fasterxml.jackson.annotation.*;
013import com.fasterxml.jackson.databind.annotation.*;
014
015import io.vrap.rmf.base.client.utils.Generated;
016
017/**
018 * SimilarProductSearchRequest
019 *
020 * <hr>
021 * Example to create an instance using the builder pattern
022 * <div class=code-example>
023 * <pre><code class='java'>
024 *     SimilarProductSearchRequest similarProductSearchRequest = SimilarProductSearchRequest.builder()
025 *             .build()
026 * </code></pre>
027 * </div>
028 */
029@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
030@JsonDeserialize(as = SimilarProductSearchRequestImpl.class)
031public interface SimilarProductSearchRequest {
032
033    /**
034     *  <p>Number of results requested.</p>
035     * @return limit
036     */
037
038    @JsonProperty("limit")
039    public Long getLimit();
040
041    /**
042     *  <p>Number of elements skipped.</p>
043     * @return offset
044     */
045
046    @JsonProperty("offset")
047    public Long getOffset();
048
049    /**
050     *  <p>language tag used to prioritize language for text comparisons.</p>
051     * @return language
052     */
053
054    @JsonProperty("language")
055    public String getLanguage();
056
057    /**
058     *  <p>The three-digit currency code to compare prices in. When a product has multiple prices, all prices for the product are converted to the currency provided by the currency attribute and the median price is calculated for comparison. Currencies are converted using the ECB currency exchange rates at the time the request is made. Of the currency codes, only currencies with currency exchange rates provided by the ECB are supported.</p>
059     * @return currencyCode
060     */
061
062    @JsonProperty("currencyCode")
063    public String getCurrencyCode();
064
065    /**
066     *  <p><code>similarityMeasures</code> defines the attributes taken into account to measure product similarity.</p>
067     * @return similarityMeasures
068     */
069    @Valid
070    @JsonProperty("similarityMeasures")
071    public SimilarityMeasures getSimilarityMeasures();
072
073    /**
074     *  <p>Array of length 2 of ProductSetSelector</p>
075     * @return productSetSelectors
076     */
077    @Valid
078    @JsonProperty("productSetSelectors")
079    public List<ProductSetSelector> getProductSetSelectors();
080
081    /**
082     *
083     * @return confidenceMin
084     */
085
086    @JsonProperty("confidenceMin")
087    public Double getConfidenceMin();
088
089    /**
090     *
091     * @return confidenceMax
092     */
093
094    @JsonProperty("confidenceMax")
095    public Double getConfidenceMax();
096
097    /**
098     *  <p>Number of results requested.</p>
099     * @param limit value to be set
100     */
101
102    public void setLimit(final Long limit);
103
104    /**
105     *  <p>Number of elements skipped.</p>
106     * @param offset value to be set
107     */
108
109    public void setOffset(final Long offset);
110
111    /**
112     *  <p>language tag used to prioritize language for text comparisons.</p>
113     * @param language value to be set
114     */
115
116    public void setLanguage(final String language);
117
118    /**
119     *  <p>The three-digit currency code to compare prices in. When a product has multiple prices, all prices for the product are converted to the currency provided by the currency attribute and the median price is calculated for comparison. Currencies are converted using the ECB currency exchange rates at the time the request is made. Of the currency codes, only currencies with currency exchange rates provided by the ECB are supported.</p>
120     * @param currencyCode value to be set
121     */
122
123    public void setCurrencyCode(final String currencyCode);
124
125    /**
126     *  <p><code>similarityMeasures</code> defines the attributes taken into account to measure product similarity.</p>
127     * @param similarityMeasures value to be set
128     */
129
130    public void setSimilarityMeasures(final SimilarityMeasures similarityMeasures);
131
132    /**
133     *  <p>Array of length 2 of ProductSetSelector</p>
134     * @param productSetSelectors values to be set
135     */
136
137    @JsonIgnore
138    public void setProductSetSelectors(final ProductSetSelector... productSetSelectors);
139
140    /**
141     *  <p>Array of length 2 of ProductSetSelector</p>
142     * @param productSetSelectors values to be set
143     */
144
145    public void setProductSetSelectors(final List<ProductSetSelector> productSetSelectors);
146
147    /**
148     * set confidenceMin
149     * @param confidenceMin value to be set
150     */
151
152    public void setConfidenceMin(final Double confidenceMin);
153
154    /**
155     * set confidenceMax
156     * @param confidenceMax value to be set
157     */
158
159    public void setConfidenceMax(final Double confidenceMax);
160
161    /**
162     * factory method
163     * @return instance of SimilarProductSearchRequest
164     */
165    public static SimilarProductSearchRequest of() {
166        return new SimilarProductSearchRequestImpl();
167    }
168
169    /**
170     * factory method to create a shallow copy SimilarProductSearchRequest
171     * @param template instance to be copied
172     * @return copy instance
173     */
174    public static SimilarProductSearchRequest of(final SimilarProductSearchRequest template) {
175        SimilarProductSearchRequestImpl instance = new SimilarProductSearchRequestImpl();
176        instance.setLimit(template.getLimit());
177        instance.setOffset(template.getOffset());
178        instance.setLanguage(template.getLanguage());
179        instance.setCurrencyCode(template.getCurrencyCode());
180        instance.setSimilarityMeasures(template.getSimilarityMeasures());
181        instance.setProductSetSelectors(template.getProductSetSelectors());
182        instance.setConfidenceMin(template.getConfidenceMin());
183        instance.setConfidenceMax(template.getConfidenceMax());
184        return instance;
185    }
186
187    /**
188     * factory method to create a deep copy of SimilarProductSearchRequest
189     * @param template instance to be copied
190     * @return copy instance
191     */
192    @Nullable
193    public static SimilarProductSearchRequest deepCopy(@Nullable final SimilarProductSearchRequest template) {
194        if (template == null) {
195            return null;
196        }
197        SimilarProductSearchRequestImpl instance = new SimilarProductSearchRequestImpl();
198        instance.setLimit(template.getLimit());
199        instance.setOffset(template.getOffset());
200        instance.setLanguage(template.getLanguage());
201        instance.setCurrencyCode(template.getCurrencyCode());
202        instance.setSimilarityMeasures(
203            com.commercetools.ml.models.similar_products.SimilarityMeasures.deepCopy(template.getSimilarityMeasures()));
204        instance.setProductSetSelectors(Optional.ofNullable(template.getProductSetSelectors())
205                .map(t -> t.stream()
206                        .map(com.commercetools.ml.models.similar_products.ProductSetSelector::deepCopy)
207                        .collect(Collectors.toList()))
208                .orElse(null));
209        instance.setConfidenceMin(template.getConfidenceMin());
210        instance.setConfidenceMax(template.getConfidenceMax());
211        return instance;
212    }
213
214    /**
215     * builder factory method for SimilarProductSearchRequest
216     * @return builder
217     */
218    public static SimilarProductSearchRequestBuilder builder() {
219        return SimilarProductSearchRequestBuilder.of();
220    }
221
222    /**
223     * create builder for SimilarProductSearchRequest instance
224     * @param template instance with prefilled values for the builder
225     * @return builder
226     */
227    public static SimilarProductSearchRequestBuilder builder(final SimilarProductSearchRequest template) {
228        return SimilarProductSearchRequestBuilder.of(template);
229    }
230
231    /**
232     * accessor map function
233     * @param <T> mapped type
234     * @param helper function to map the object
235     * @return mapped value
236     */
237    default <T> T withSimilarProductSearchRequest(Function<SimilarProductSearchRequest, T> helper) {
238        return helper.apply(this);
239    }
240
241    /**
242     * gives a TypeReference for usage with Jackson DataBind
243     * @return TypeReference
244     */
245    public static com.fasterxml.jackson.core.type.TypeReference<SimilarProductSearchRequest> typeReference() {
246        return new com.fasterxml.jackson.core.type.TypeReference<SimilarProductSearchRequest>() {
247            @Override
248            public String toString() {
249                return "TypeReference<SimilarProductSearchRequest>";
250            }
251        };
252    }
253}