001
002package com.commercetools.api.models.product_selection;
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;
011import javax.validation.constraints.NotNull;
012
013import com.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 *  <p>PagedQueryResult containing an array of ProductSelectionAssignment.</p>
020 *
021 * <hr>
022 * Example to create an instance using the builder pattern
023 * <div class=code-example>
024 * <pre><code class='java'>
025 *     ProductsInStorePagedQueryResponse productsInStorePagedQueryResponse = ProductsInStorePagedQueryResponse.builder()
026 *             .limit(0.3)
027 *             .offset(0.3)
028 *             .count(0.3)
029 *             .plusResults(resultsBuilder -> resultsBuilder)
030 *             .build()
031 * </code></pre>
032 * </div>
033 */
034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
035@JsonDeserialize(as = ProductsInStorePagedQueryResponseImpl.class)
036public interface ProductsInStorePagedQueryResponse
037        extends com.commercetools.api.models.ResourcePagedQueryResponse<ProductSelectionAssignment> {
038
039    /**
040     *  <p>Number of results requested.</p>
041     * @return limit
042     */
043    @NotNull
044    @JsonProperty("limit")
045    public Long getLimit();
046
047    /**
048     *  <p>Number of elements skipped.</p>
049     * @return offset
050     */
051    @NotNull
052    @JsonProperty("offset")
053    public Long getOffset();
054
055    /**
056     *  <p>Actual number of results returned.</p>
057     * @return count
058     */
059    @NotNull
060    @JsonProperty("count")
061    public Long getCount();
062
063    /**
064     *  <p>Total number of results matching the query. This number is an estimation that is not strongly consistent. Unlike other endpoints, the Product Selection endpoint does not return this field by default. To get <code>total</code>, pass the query parameter <code>withTotal</code> set to <code>true</code>. When the results are filtered with a Query Predicate, <code>total</code> is subject to a limit.</p>
065     * @return total
066     */
067
068    @JsonProperty("total")
069    public Long getTotal();
070
071    /**
072     *  <p>ProductSelectionAssignments matching the query.</p>
073     * @return results
074     */
075    @NotNull
076    @Valid
077    @JsonProperty("results")
078    public List<ProductSelectionAssignment> getResults();
079
080    /**
081     *  <p>Number of results requested.</p>
082     * @param limit value to be set
083     */
084
085    public void setLimit(final Long limit);
086
087    /**
088     *  <p>Number of elements skipped.</p>
089     * @param offset value to be set
090     */
091
092    public void setOffset(final Long offset);
093
094    /**
095     *  <p>Actual number of results returned.</p>
096     * @param count value to be set
097     */
098
099    public void setCount(final Long count);
100
101    /**
102     *  <p>Total number of results matching the query. This number is an estimation that is not strongly consistent. Unlike other endpoints, the Product Selection endpoint does not return this field by default. To get <code>total</code>, pass the query parameter <code>withTotal</code> set to <code>true</code>. When the results are filtered with a Query Predicate, <code>total</code> is subject to a limit.</p>
103     * @param total value to be set
104     */
105
106    public void setTotal(final Long total);
107
108    /**
109     *  <p>ProductSelectionAssignments matching the query.</p>
110     * @param results values to be set
111     */
112
113    @JsonIgnore
114    public void setResults(final ProductSelectionAssignment... results);
115
116    /**
117     *  <p>ProductSelectionAssignments matching the query.</p>
118     * @param results values to be set
119     */
120
121    public void setResults(final List<ProductSelectionAssignment> results);
122
123    /**
124     * factory method
125     * @return instance of ProductsInStorePagedQueryResponse
126     */
127    public static ProductsInStorePagedQueryResponse of() {
128        return new ProductsInStorePagedQueryResponseImpl();
129    }
130
131    /**
132     * factory method to create a shallow copy ProductsInStorePagedQueryResponse
133     * @param template instance to be copied
134     * @return copy instance
135     */
136    public static ProductsInStorePagedQueryResponse of(final ProductsInStorePagedQueryResponse template) {
137        ProductsInStorePagedQueryResponseImpl instance = new ProductsInStorePagedQueryResponseImpl();
138        instance.setLimit(template.getLimit());
139        instance.setOffset(template.getOffset());
140        instance.setCount(template.getCount());
141        instance.setTotal(template.getTotal());
142        instance.setResults(template.getResults());
143        return instance;
144    }
145
146    /**
147     * factory method to create a deep copy of ProductsInStorePagedQueryResponse
148     * @param template instance to be copied
149     * @return copy instance
150     */
151    @Nullable
152    public static ProductsInStorePagedQueryResponse deepCopy(
153            @Nullable final ProductsInStorePagedQueryResponse template) {
154        if (template == null) {
155            return null;
156        }
157        ProductsInStorePagedQueryResponseImpl instance = new ProductsInStorePagedQueryResponseImpl();
158        instance.setLimit(template.getLimit());
159        instance.setOffset(template.getOffset());
160        instance.setCount(template.getCount());
161        instance.setTotal(template.getTotal());
162        instance.setResults(Optional.ofNullable(template.getResults())
163                .map(t -> t.stream()
164                        .map(com.commercetools.api.models.product_selection.ProductSelectionAssignment::deepCopy)
165                        .collect(Collectors.toList()))
166                .orElse(null));
167        return instance;
168    }
169
170    /**
171     * builder factory method for ProductsInStorePagedQueryResponse
172     * @return builder
173     */
174    public static ProductsInStorePagedQueryResponseBuilder builder() {
175        return ProductsInStorePagedQueryResponseBuilder.of();
176    }
177
178    /**
179     * create builder for ProductsInStorePagedQueryResponse instance
180     * @param template instance with prefilled values for the builder
181     * @return builder
182     */
183    public static ProductsInStorePagedQueryResponseBuilder builder(final ProductsInStorePagedQueryResponse template) {
184        return ProductsInStorePagedQueryResponseBuilder.of(template);
185    }
186
187    /**
188     * accessor map function
189     * @param <T> mapped type
190     * @param helper function to map the object
191     * @return mapped value
192     */
193    default <T> T withProductsInStorePagedQueryResponse(Function<ProductsInStorePagedQueryResponse, T> helper) {
194        return helper.apply(this);
195    }
196
197    /**
198     * gives a TypeReference for usage with Jackson DataBind
199     * @return TypeReference
200     */
201    public static com.fasterxml.jackson.core.type.TypeReference<ProductsInStorePagedQueryResponse> typeReference() {
202        return new com.fasterxml.jackson.core.type.TypeReference<ProductsInStorePagedQueryResponse>() {
203            @Override
204            public String toString() {
205                return "TypeReference<ProductsInStorePagedQueryResponse>";
206            }
207        };
208    }
209}