001
002package com.commercetools.api.models.project;
003
004import java.time.*;
005import java.time.ZonedDateTime;
006import java.util.*;
007import java.util.function.Function;
008
009import javax.annotation.Nullable;
010import javax.validation.Valid;
011import javax.validation.constraints.NotNull;
012
013import com.commercetools.api.models.message.MessagesConfiguration;
014import com.fasterxml.jackson.annotation.*;
015import com.fasterxml.jackson.databind.annotation.*;
016
017import io.vrap.rmf.base.client.utils.Generated;
018
019/**
020 * Project
021 *
022 * <hr>
023 * Example to create an instance using the builder pattern
024 * <div class=code-example>
025 * <pre><code class='java'>
026 *     Project project = Project.builder()
027 *             .version(0.3)
028 *             .key("{key}")
029 *             .name("{name}")
030 *             .plusCountries(countriesBuilder -> countriesBuilder)
031 *             .plusCurrencies(currenciesBuilder -> currenciesBuilder)
032 *             .plusLanguages(languagesBuilder -> languagesBuilder)
033 *             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
034 *             .messages(messagesBuilder -> messagesBuilder)
035 *             .carts(cartsBuilder -> cartsBuilder)
036 *             .build()
037 * </code></pre>
038 * </div>
039 */
040@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
041@JsonDeserialize(as = ProjectImpl.class)
042public interface Project extends com.commercetools.api.models.WithKey {
043
044    /**
045     *  <p>Current version of the Project.</p>
046     * @return version
047     */
048    @NotNull
049    @JsonProperty("version")
050    public Long getVersion();
051
052    /**
053     *  <p>User-defined unique identifier of the Project.</p>
054     * @return key
055     */
056    @NotNull
057    @JsonProperty("key")
058    public String getKey();
059
060    /**
061     *  <p>Name of the Project.</p>
062     * @return name
063     */
064    @NotNull
065    @JsonProperty("name")
066    public String getName();
067
068    /**
069     *  <p>Country code of the geographic location.</p>
070     * @return countries
071     */
072    @NotNull
073    @JsonProperty("countries")
074    public List<String> getCountries();
075
076    /**
077     *  <p>Currency code of the country. A Project must have at least one currency.</p>
078     * @return currencies
079     */
080    @NotNull
081    @JsonProperty("currencies")
082    public List<String> getCurrencies();
083
084    /**
085     *  <p>Language of the country. A Project must have at least one language.</p>
086     * @return languages
087     */
088    @NotNull
089    @JsonProperty("languages")
090    public List<String> getLanguages();
091
092    /**
093     *  <p>Date and time (UTC) the Project was initially created.</p>
094     * @return createdAt
095     */
096    @NotNull
097    @JsonProperty("createdAt")
098    public ZonedDateTime getCreatedAt();
099
100    /**
101     *  <p>Date in YYYY-MM format specifying when the trial period for the Project ends. Only present on Projects in trial period.</p>
102     * @return trialUntil
103     */
104
105    @JsonProperty("trialUntil")
106    public String getTrialUntil();
107
108    /**
109     *  <p>Holds the configuration for the Messages Query feature.</p>
110     * @return messages
111     */
112    @NotNull
113    @Valid
114    @JsonProperty("messages")
115    public MessagesConfiguration getMessages();
116
117    /**
118     *  <p>Holds the configuration for the Carts feature.</p>
119     * @return carts
120     */
121    @NotNull
122    @Valid
123    @JsonProperty("carts")
124    public CartsConfiguration getCarts();
125
126    /**
127     *  <p>Holds the configuration for the Shopping Lists feature. This field may not be present on Projects created before January 2020.</p>
128     * @return shoppingLists
129     */
130    @Valid
131    @JsonProperty("shoppingLists")
132    public ShoppingListsConfiguration getShoppingLists();
133
134    /**
135     *  <p>Holds the configuration for the tiered shipping rates feature.</p>
136     * @return shippingRateInputType
137     */
138    @Valid
139    @JsonProperty("shippingRateInputType")
140    public ShippingRateInputType getShippingRateInputType();
141
142    /**
143     *  <p>Represents a RFC 7662 compliant OAuth 2.0 Token Introspection endpoint.</p>
144     * @return externalOAuth
145     */
146    @Valid
147    @JsonProperty("externalOAuth")
148    public ExternalOAuth getExternalOAuth();
149
150    /**
151     *  <p>Controls indexing of resources to be provided on high performance read-only search endpoints.</p>
152     * @return searchIndexing
153     */
154    @Valid
155    @JsonProperty("searchIndexing")
156    public SearchIndexingConfiguration getSearchIndexing();
157
158    /**
159     *  <p>Holds configuration specific to Business Units.</p>
160     * @return businessUnits
161     */
162    @Valid
163    @JsonProperty("businessUnits")
164    public BusinessUnitConfiguration getBusinessUnits();
165
166    /**
167     *  <p>Current version of the Project.</p>
168     * @param version value to be set
169     */
170
171    public void setVersion(final Long version);
172
173    /**
174     *  <p>User-defined unique identifier of the Project.</p>
175     * @param key value to be set
176     */
177
178    public void setKey(final String key);
179
180    /**
181     *  <p>Name of the Project.</p>
182     * @param name value to be set
183     */
184
185    public void setName(final String name);
186
187    /**
188     *  <p>Country code of the geographic location.</p>
189     * @param countries values to be set
190     */
191
192    @JsonIgnore
193    public void setCountries(final String... countries);
194
195    /**
196     *  <p>Country code of the geographic location.</p>
197     * @param countries values to be set
198     */
199
200    public void setCountries(final List<String> countries);
201
202    /**
203     *  <p>Currency code of the country. A Project must have at least one currency.</p>
204     * @param currencies values to be set
205     */
206
207    @JsonIgnore
208    public void setCurrencies(final String... currencies);
209
210    /**
211     *  <p>Currency code of the country. A Project must have at least one currency.</p>
212     * @param currencies values to be set
213     */
214
215    public void setCurrencies(final List<String> currencies);
216
217    /**
218     *  <p>Language of the country. A Project must have at least one language.</p>
219     * @param languages values to be set
220     */
221
222    @JsonIgnore
223    public void setLanguages(final String... languages);
224
225    /**
226     *  <p>Language of the country. A Project must have at least one language.</p>
227     * @param languages values to be set
228     */
229
230    public void setLanguages(final List<String> languages);
231
232    /**
233     *  <p>Date and time (UTC) the Project was initially created.</p>
234     * @param createdAt value to be set
235     */
236
237    public void setCreatedAt(final ZonedDateTime createdAt);
238
239    /**
240     *  <p>Date in YYYY-MM format specifying when the trial period for the Project ends. Only present on Projects in trial period.</p>
241     * @param trialUntil value to be set
242     */
243
244    public void setTrialUntil(final String trialUntil);
245
246    /**
247     *  <p>Holds the configuration for the Messages Query feature.</p>
248     * @param messages value to be set
249     */
250
251    public void setMessages(final MessagesConfiguration messages);
252
253    /**
254     *  <p>Holds the configuration for the Carts feature.</p>
255     * @param carts value to be set
256     */
257
258    public void setCarts(final CartsConfiguration carts);
259
260    /**
261     *  <p>Holds the configuration for the Shopping Lists feature. This field may not be present on Projects created before January 2020.</p>
262     * @param shoppingLists value to be set
263     */
264
265    public void setShoppingLists(final ShoppingListsConfiguration shoppingLists);
266
267    /**
268     *  <p>Holds the configuration for the tiered shipping rates feature.</p>
269     * @param shippingRateInputType value to be set
270     */
271
272    public void setShippingRateInputType(final ShippingRateInputType shippingRateInputType);
273
274    /**
275     *  <p>Represents a RFC 7662 compliant OAuth 2.0 Token Introspection endpoint.</p>
276     * @param externalOAuth value to be set
277     */
278
279    public void setExternalOAuth(final ExternalOAuth externalOAuth);
280
281    /**
282     *  <p>Controls indexing of resources to be provided on high performance read-only search endpoints.</p>
283     * @param searchIndexing value to be set
284     */
285
286    public void setSearchIndexing(final SearchIndexingConfiguration searchIndexing);
287
288    /**
289     *  <p>Holds configuration specific to Business Units.</p>
290     * @param businessUnits value to be set
291     */
292
293    public void setBusinessUnits(final BusinessUnitConfiguration businessUnits);
294
295    /**
296     * factory method
297     * @return instance of Project
298     */
299    public static Project of() {
300        return new ProjectImpl();
301    }
302
303    /**
304     * factory method to create a shallow copy Project
305     * @param template instance to be copied
306     * @return copy instance
307     */
308    public static Project of(final Project template) {
309        ProjectImpl instance = new ProjectImpl();
310        instance.setVersion(template.getVersion());
311        instance.setKey(template.getKey());
312        instance.setName(template.getName());
313        instance.setCountries(template.getCountries());
314        instance.setCurrencies(template.getCurrencies());
315        instance.setLanguages(template.getLanguages());
316        instance.setCreatedAt(template.getCreatedAt());
317        instance.setTrialUntil(template.getTrialUntil());
318        instance.setMessages(template.getMessages());
319        instance.setCarts(template.getCarts());
320        instance.setShoppingLists(template.getShoppingLists());
321        instance.setShippingRateInputType(template.getShippingRateInputType());
322        instance.setExternalOAuth(template.getExternalOAuth());
323        instance.setSearchIndexing(template.getSearchIndexing());
324        instance.setBusinessUnits(template.getBusinessUnits());
325        return instance;
326    }
327
328    /**
329     * factory method to create a deep copy of Project
330     * @param template instance to be copied
331     * @return copy instance
332     */
333    @Nullable
334    public static Project deepCopy(@Nullable final Project template) {
335        if (template == null) {
336            return null;
337        }
338        ProjectImpl instance = new ProjectImpl();
339        instance.setVersion(template.getVersion());
340        instance.setKey(template.getKey());
341        instance.setName(template.getName());
342        instance.setCountries(Optional.ofNullable(template.getCountries()).map(ArrayList::new).orElse(null));
343        instance.setCurrencies(Optional.ofNullable(template.getCurrencies()).map(ArrayList::new).orElse(null));
344        instance.setLanguages(Optional.ofNullable(template.getLanguages()).map(ArrayList::new).orElse(null));
345        instance.setCreatedAt(template.getCreatedAt());
346        instance.setTrialUntil(template.getTrialUntil());
347        instance.setMessages(
348            com.commercetools.api.models.message.MessagesConfiguration.deepCopy(template.getMessages()));
349        instance.setCarts(com.commercetools.api.models.project.CartsConfiguration.deepCopy(template.getCarts()));
350        instance.setShoppingLists(
351            com.commercetools.api.models.project.ShoppingListsConfiguration.deepCopy(template.getShoppingLists()));
352        instance.setShippingRateInputType(
353            com.commercetools.api.models.project.ShippingRateInputType.deepCopy(template.getShippingRateInputType()));
354        instance.setExternalOAuth(
355            com.commercetools.api.models.project.ExternalOAuth.deepCopy(template.getExternalOAuth()));
356        instance.setSearchIndexing(
357            com.commercetools.api.models.project.SearchIndexingConfiguration.deepCopy(template.getSearchIndexing()));
358        instance.setBusinessUnits(
359            com.commercetools.api.models.project.BusinessUnitConfiguration.deepCopy(template.getBusinessUnits()));
360        return instance;
361    }
362
363    /**
364     * builder factory method for Project
365     * @return builder
366     */
367    public static ProjectBuilder builder() {
368        return ProjectBuilder.of();
369    }
370
371    /**
372     * create builder for Project instance
373     * @param template instance with prefilled values for the builder
374     * @return builder
375     */
376    public static ProjectBuilder builder(final Project template) {
377        return ProjectBuilder.of(template);
378    }
379
380    /**
381     * accessor map function
382     * @param <T> mapped type
383     * @param helper function to map the object
384     * @return mapped value
385     */
386    default <T> T withProject(Function<Project, T> helper) {
387        return helper.apply(this);
388    }
389
390    /**
391     * gives a TypeReference for usage with Jackson DataBind
392     * @return TypeReference
393     */
394    public static com.fasterxml.jackson.core.type.TypeReference<Project> typeReference() {
395        return new com.fasterxml.jackson.core.type.TypeReference<Project>() {
396            @Override
397            public String toString() {
398                return "TypeReference<Project>";
399            }
400        };
401    }
402}