001
002package com.commercetools.api.models.quote_request;
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 with results containing an array of QuoteRequest.</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 *     QuoteRequestPagedQueryResponse quoteRequestPagedQueryResponse = QuoteRequestPagedQueryResponse.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 = QuoteRequestPagedQueryResponseImpl.class)
036public interface QuoteRequestPagedQueryResponse
037        extends com.commercetools.api.models.ResourcePagedQueryResponse<QuoteRequest> {
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. This field is returned by default. For improved performance, calculating this field can be deactivated by using the query parameter <code>withTotal=false</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>Quote Requests matching the query.</p>
073     * @return results
074     */
075    @NotNull
076    @Valid
077    @JsonProperty("results")
078    public List<QuoteRequest> 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. This field is returned by default. For improved performance, calculating this field can be deactivated by using the query parameter <code>withTotal=false</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>Quote Requests matching the query.</p>
110     * @param results values to be set
111     */
112
113    @JsonIgnore
114    public void setResults(final QuoteRequest... results);
115
116    /**
117     *  <p>Quote Requests matching the query.</p>
118     * @param results values to be set
119     */
120
121    public void setResults(final List<QuoteRequest> results);
122
123    /**
124     * factory method
125     * @return instance of QuoteRequestPagedQueryResponse
126     */
127    public static QuoteRequestPagedQueryResponse of() {
128        return new QuoteRequestPagedQueryResponseImpl();
129    }
130
131    /**
132     * factory method to create a shallow copy QuoteRequestPagedQueryResponse
133     * @param template instance to be copied
134     * @return copy instance
135     */
136    public static QuoteRequestPagedQueryResponse of(final QuoteRequestPagedQueryResponse template) {
137        QuoteRequestPagedQueryResponseImpl instance = new QuoteRequestPagedQueryResponseImpl();
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 QuoteRequestPagedQueryResponse
148     * @param template instance to be copied
149     * @return copy instance
150     */
151    @Nullable
152    public static QuoteRequestPagedQueryResponse deepCopy(@Nullable final QuoteRequestPagedQueryResponse template) {
153        if (template == null) {
154            return null;
155        }
156        QuoteRequestPagedQueryResponseImpl instance = new QuoteRequestPagedQueryResponseImpl();
157        instance.setLimit(template.getLimit());
158        instance.setOffset(template.getOffset());
159        instance.setCount(template.getCount());
160        instance.setTotal(template.getTotal());
161        instance.setResults(Optional.ofNullable(template.getResults())
162                .map(t -> t.stream()
163                        .map(com.commercetools.api.models.quote_request.QuoteRequest::deepCopy)
164                        .collect(Collectors.toList()))
165                .orElse(null));
166        return instance;
167    }
168
169    /**
170     * builder factory method for QuoteRequestPagedQueryResponse
171     * @return builder
172     */
173    public static QuoteRequestPagedQueryResponseBuilder builder() {
174        return QuoteRequestPagedQueryResponseBuilder.of();
175    }
176
177    /**
178     * create builder for QuoteRequestPagedQueryResponse instance
179     * @param template instance with prefilled values for the builder
180     * @return builder
181     */
182    public static QuoteRequestPagedQueryResponseBuilder builder(final QuoteRequestPagedQueryResponse template) {
183        return QuoteRequestPagedQueryResponseBuilder.of(template);
184    }
185
186    /**
187     * accessor map function
188     * @param <T> mapped type
189     * @param helper function to map the object
190     * @return mapped value
191     */
192    default <T> T withQuoteRequestPagedQueryResponse(Function<QuoteRequestPagedQueryResponse, T> helper) {
193        return helper.apply(this);
194    }
195
196    /**
197     * gives a TypeReference for usage with Jackson DataBind
198     * @return TypeReference
199     */
200    public static com.fasterxml.jackson.core.type.TypeReference<QuoteRequestPagedQueryResponse> typeReference() {
201        return new com.fasterxml.jackson.core.type.TypeReference<QuoteRequestPagedQueryResponse>() {
202            @Override
203            public String toString() {
204                return "TypeReference<QuoteRequestPagedQueryResponse>";
205            }
206        };
207    }
208}