001
002package com.commercetools.api.models.store;
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.commercetools.api.models.channel.ChannelResourceIdentifier;
014import com.commercetools.api.models.common.LocalizedString;
015import com.commercetools.api.models.store_country.StoreCountry;
016import com.commercetools.api.models.type.CustomFieldsDraft;
017import com.fasterxml.jackson.annotation.*;
018import com.fasterxml.jackson.databind.annotation.*;
019
020import io.vrap.rmf.base.client.utils.Generated;
021
022/**
023 * StoreDraft
024 *
025 * <hr>
026 * Example to create an instance using the builder pattern
027 * <div class=code-example>
028 * <pre><code class='java'>
029 *     StoreDraft storeDraft = StoreDraft.builder()
030 *             .key("{key}")
031 *             .build()
032 * </code></pre>
033 * </div>
034 */
035@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
036@JsonDeserialize(as = StoreDraftImpl.class)
037public interface StoreDraft extends com.commercetools.api.models.CustomizableDraft<StoreDraft>,
038        com.commercetools.api.models.WithKey, io.vrap.rmf.base.client.Draft<StoreDraft> {
039
040    /**
041     *  <p>User-defined unique and immutable identifier for the Store. Keys can only contain alphanumeric characters, underscores, and hyphens.</p>
042     * @return key
043     */
044    @NotNull
045    @JsonProperty("key")
046    public String getKey();
047
048    /**
049     *  <p>Name of the Store.</p>
050     * @return name
051     */
052    @Valid
053    @JsonProperty("name")
054    public LocalizedString getName();
055
056    /**
057     *  <p>Languages defined in Project. Only languages defined in the Project can be used.</p>
058     * @return languages
059     */
060
061    @JsonProperty("languages")
062    public List<String> getLanguages();
063
064    /**
065     *  <p>Countries defined for the Store.</p>
066     * @return countries
067     */
068    @Valid
069    @JsonProperty("countries")
070    public List<StoreCountry> getCountries();
071
072    /**
073     *  <p>ResourceIdentifier of a Channel with <code>ProductDistribution</code> ChannelRoleEnum.</p>
074     * @return distributionChannels
075     */
076    @Valid
077    @JsonProperty("distributionChannels")
078    public List<ChannelResourceIdentifier> getDistributionChannels();
079
080    /**
081     *  <p>ResourceIdentifier of a Channel with <code>InventorySupply</code> ChannelRoleEnum.</p>
082     * @return supplyChannels
083     */
084    @Valid
085    @JsonProperty("supplyChannels")
086    public List<ChannelResourceIdentifier> getSupplyChannels();
087
088    /**
089     *  <p>Controls availability of Products for this Store via active/inactive Product Selections:</p>
090     *  <ul>
091     *   <li>Leave empty if all Products in the Project should be available in this Store.</li>
092     *   <li>If only <code>inactive</code> Product Selections with <code>IndividualExclusion</code> ProductSelectionMode are provided, all the Products are available in this Store.</li>
093     *   <li>If all the Product Selections provided are <code>inactive</code> and there's at least a Product Selection of mode <code>Individual</code>, no Product is available in this Store.</li>
094     *   <li>If at least an <code>active</code> Product Selection is provided, only <code>active</code> Product Selections are considered to compute the availability in this Store.</li>
095     *  </ul>
096     * @return productSelections
097     */
098    @Valid
099    @JsonProperty("productSelections")
100    public List<ProductSelectionSettingDraft> getProductSelections();
101
102    /**
103     *  <p>Custom fields for the Store.</p>
104     * @return custom
105     */
106    @Valid
107    @JsonProperty("custom")
108    public CustomFieldsDraft getCustom();
109
110    /**
111     *  <p>User-defined unique and immutable identifier for the Store. Keys can only contain alphanumeric characters, underscores, and hyphens.</p>
112     * @param key value to be set
113     */
114
115    public void setKey(final String key);
116
117    /**
118     *  <p>Name of the Store.</p>
119     * @param name value to be set
120     */
121
122    public void setName(final LocalizedString name);
123
124    /**
125     *  <p>Languages defined in Project. Only languages defined in the Project can be used.</p>
126     * @param languages values to be set
127     */
128
129    @JsonIgnore
130    public void setLanguages(final String... languages);
131
132    /**
133     *  <p>Languages defined in Project. Only languages defined in the Project can be used.</p>
134     * @param languages values to be set
135     */
136
137    public void setLanguages(final List<String> languages);
138
139    /**
140     *  <p>Countries defined for the Store.</p>
141     * @param countries values to be set
142     */
143
144    @JsonIgnore
145    public void setCountries(final StoreCountry... countries);
146
147    /**
148     *  <p>Countries defined for the Store.</p>
149     * @param countries values to be set
150     */
151
152    public void setCountries(final List<StoreCountry> countries);
153
154    /**
155     *  <p>ResourceIdentifier of a Channel with <code>ProductDistribution</code> ChannelRoleEnum.</p>
156     * @param distributionChannels values to be set
157     */
158
159    @JsonIgnore
160    public void setDistributionChannels(final ChannelResourceIdentifier... distributionChannels);
161
162    /**
163     *  <p>ResourceIdentifier of a Channel with <code>ProductDistribution</code> ChannelRoleEnum.</p>
164     * @param distributionChannels values to be set
165     */
166
167    public void setDistributionChannels(final List<ChannelResourceIdentifier> distributionChannels);
168
169    /**
170     *  <p>ResourceIdentifier of a Channel with <code>InventorySupply</code> ChannelRoleEnum.</p>
171     * @param supplyChannels values to be set
172     */
173
174    @JsonIgnore
175    public void setSupplyChannels(final ChannelResourceIdentifier... supplyChannels);
176
177    /**
178     *  <p>ResourceIdentifier of a Channel with <code>InventorySupply</code> ChannelRoleEnum.</p>
179     * @param supplyChannels values to be set
180     */
181
182    public void setSupplyChannels(final List<ChannelResourceIdentifier> supplyChannels);
183
184    /**
185     *  <p>Controls availability of Products for this Store via active/inactive Product Selections:</p>
186     *  <ul>
187     *   <li>Leave empty if all Products in the Project should be available in this Store.</li>
188     *   <li>If only <code>inactive</code> Product Selections with <code>IndividualExclusion</code> ProductSelectionMode are provided, all the Products are available in this Store.</li>
189     *   <li>If all the Product Selections provided are <code>inactive</code> and there's at least a Product Selection of mode <code>Individual</code>, no Product is available in this Store.</li>
190     *   <li>If at least an <code>active</code> Product Selection is provided, only <code>active</code> Product Selections are considered to compute the availability in this Store.</li>
191     *  </ul>
192     * @param productSelections values to be set
193     */
194
195    @JsonIgnore
196    public void setProductSelections(final ProductSelectionSettingDraft... productSelections);
197
198    /**
199     *  <p>Controls availability of Products for this Store via active/inactive Product Selections:</p>
200     *  <ul>
201     *   <li>Leave empty if all Products in the Project should be available in this Store.</li>
202     *   <li>If only <code>inactive</code> Product Selections with <code>IndividualExclusion</code> ProductSelectionMode are provided, all the Products are available in this Store.</li>
203     *   <li>If all the Product Selections provided are <code>inactive</code> and there's at least a Product Selection of mode <code>Individual</code>, no Product is available in this Store.</li>
204     *   <li>If at least an <code>active</code> Product Selection is provided, only <code>active</code> Product Selections are considered to compute the availability in this Store.</li>
205     *  </ul>
206     * @param productSelections values to be set
207     */
208
209    public void setProductSelections(final List<ProductSelectionSettingDraft> productSelections);
210
211    /**
212     *  <p>Custom fields for the Store.</p>
213     * @param custom value to be set
214     */
215
216    public void setCustom(final CustomFieldsDraft custom);
217
218    /**
219     * factory method
220     * @return instance of StoreDraft
221     */
222    public static StoreDraft of() {
223        return new StoreDraftImpl();
224    }
225
226    /**
227     * factory method to create a shallow copy StoreDraft
228     * @param template instance to be copied
229     * @return copy instance
230     */
231    public static StoreDraft of(final StoreDraft template) {
232        StoreDraftImpl instance = new StoreDraftImpl();
233        instance.setKey(template.getKey());
234        instance.setName(template.getName());
235        instance.setLanguages(template.getLanguages());
236        instance.setCountries(template.getCountries());
237        instance.setDistributionChannels(template.getDistributionChannels());
238        instance.setSupplyChannels(template.getSupplyChannels());
239        instance.setProductSelections(template.getProductSelections());
240        instance.setCustom(template.getCustom());
241        return instance;
242    }
243
244    /**
245     * factory method to create a deep copy of StoreDraft
246     * @param template instance to be copied
247     * @return copy instance
248     */
249    @Nullable
250    public static StoreDraft deepCopy(@Nullable final StoreDraft template) {
251        if (template == null) {
252            return null;
253        }
254        StoreDraftImpl instance = new StoreDraftImpl();
255        instance.setKey(template.getKey());
256        instance.setName(com.commercetools.api.models.common.LocalizedString.deepCopy(template.getName()));
257        instance.setLanguages(Optional.ofNullable(template.getLanguages()).map(ArrayList::new).orElse(null));
258        instance.setCountries(Optional.ofNullable(template.getCountries())
259                .map(t -> t.stream()
260                        .map(com.commercetools.api.models.store_country.StoreCountry::deepCopy)
261                        .collect(Collectors.toList()))
262                .orElse(null));
263        instance.setDistributionChannels(Optional.ofNullable(template.getDistributionChannels())
264                .map(t -> t.stream()
265                        .map(com.commercetools.api.models.channel.ChannelResourceIdentifier::deepCopy)
266                        .collect(Collectors.toList()))
267                .orElse(null));
268        instance.setSupplyChannels(Optional.ofNullable(template.getSupplyChannels())
269                .map(t -> t.stream()
270                        .map(com.commercetools.api.models.channel.ChannelResourceIdentifier::deepCopy)
271                        .collect(Collectors.toList()))
272                .orElse(null));
273        instance.setProductSelections(Optional.ofNullable(template.getProductSelections())
274                .map(t -> t.stream()
275                        .map(com.commercetools.api.models.store.ProductSelectionSettingDraft::deepCopy)
276                        .collect(Collectors.toList()))
277                .orElse(null));
278        instance.setCustom(com.commercetools.api.models.type.CustomFieldsDraft.deepCopy(template.getCustom()));
279        return instance;
280    }
281
282    /**
283     * builder factory method for StoreDraft
284     * @return builder
285     */
286    public static StoreDraftBuilder builder() {
287        return StoreDraftBuilder.of();
288    }
289
290    /**
291     * create builder for StoreDraft instance
292     * @param template instance with prefilled values for the builder
293     * @return builder
294     */
295    public static StoreDraftBuilder builder(final StoreDraft template) {
296        return StoreDraftBuilder.of(template);
297    }
298
299    /**
300     * accessor map function
301     * @param <T> mapped type
302     * @param helper function to map the object
303     * @return mapped value
304     */
305    default <T> T withStoreDraft(Function<StoreDraft, T> helper) {
306        return helper.apply(this);
307    }
308
309    /**
310     * gives a TypeReference for usage with Jackson DataBind
311     * @return TypeReference
312     */
313    public static com.fasterxml.jackson.core.type.TypeReference<StoreDraft> typeReference() {
314        return new com.fasterxml.jackson.core.type.TypeReference<StoreDraft>() {
315            @Override
316            public String toString() {
317                return "TypeReference<StoreDraft>";
318            }
319        };
320    }
321}