001
002package com.commercetools.api.models.product;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.Valid;
010import javax.validation.constraints.NotNull;
011
012import com.commercetools.api.models.common.AssetDraft;
013import com.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 *  <p>Either <code>variantId</code> or <code>sku</code> is required.</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 *     ProductAddAssetAction productAddAssetAction = ProductAddAssetAction.builder()
026 *             .asset(assetBuilder -> assetBuilder)
027 *             .build()
028 * </code></pre>
029 * </div>
030 */
031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
032@JsonDeserialize(as = ProductAddAssetActionImpl.class)
033public interface ProductAddAssetAction extends ProductUpdateAction {
034
035    /**
036     * discriminator value for ProductAddAssetAction
037     */
038    String ADD_ASSET = "addAsset";
039
040    /**
041     *  <p>The <code>id</code> of the ProductVariant to update.</p>
042     * @return variantId
043     */
044
045    @JsonProperty("variantId")
046    public Long getVariantId();
047
048    /**
049     *  <p>The <code>sku</code> of the ProductVariant to update.</p>
050     * @return sku
051     */
052
053    @JsonProperty("sku")
054    public String getSku();
055
056    /**
057     *  <p>If <code>true</code>, only the staged <code>assets</code> are updated. If <code>false</code>, both the current and staged <code>assets</code> are updated.</p>
058     * @return staged
059     */
060
061    @JsonProperty("staged")
062    public Boolean getStaged();
063
064    /**
065     *  <p>Value to append.</p>
066     * @return asset
067     */
068    @NotNull
069    @Valid
070    @JsonProperty("asset")
071    public AssetDraft getAsset();
072
073    /**
074     *  <p>Position in <code>assets</code> where the Asset should be put. When specified, the value must be between <code>0</code> and the total number of Assets minus <code>1</code>.</p>
075     * @return position
076     */
077
078    @JsonProperty("position")
079    public Integer getPosition();
080
081    /**
082     *  <p>The <code>id</code> of the ProductVariant to update.</p>
083     * @param variantId value to be set
084     */
085
086    public void setVariantId(final Long variantId);
087
088    /**
089     *  <p>The <code>sku</code> of the ProductVariant to update.</p>
090     * @param sku value to be set
091     */
092
093    public void setSku(final String sku);
094
095    /**
096     *  <p>If <code>true</code>, only the staged <code>assets</code> are updated. If <code>false</code>, both the current and staged <code>assets</code> are updated.</p>
097     * @param staged value to be set
098     */
099
100    public void setStaged(final Boolean staged);
101
102    /**
103     *  <p>Value to append.</p>
104     * @param asset value to be set
105     */
106
107    public void setAsset(final AssetDraft asset);
108
109    /**
110     *  <p>Position in <code>assets</code> where the Asset should be put. When specified, the value must be between <code>0</code> and the total number of Assets minus <code>1</code>.</p>
111     * @param position value to be set
112     */
113
114    public void setPosition(final Integer position);
115
116    /**
117     * factory method
118     * @return instance of ProductAddAssetAction
119     */
120    public static ProductAddAssetAction of() {
121        return new ProductAddAssetActionImpl();
122    }
123
124    /**
125     * factory method to create a shallow copy ProductAddAssetAction
126     * @param template instance to be copied
127     * @return copy instance
128     */
129    public static ProductAddAssetAction of(final ProductAddAssetAction template) {
130        ProductAddAssetActionImpl instance = new ProductAddAssetActionImpl();
131        instance.setVariantId(template.getVariantId());
132        instance.setSku(template.getSku());
133        instance.setStaged(template.getStaged());
134        instance.setAsset(template.getAsset());
135        instance.setPosition(template.getPosition());
136        return instance;
137    }
138
139    /**
140     * factory method to create a deep copy of ProductAddAssetAction
141     * @param template instance to be copied
142     * @return copy instance
143     */
144    @Nullable
145    public static ProductAddAssetAction deepCopy(@Nullable final ProductAddAssetAction template) {
146        if (template == null) {
147            return null;
148        }
149        ProductAddAssetActionImpl instance = new ProductAddAssetActionImpl();
150        instance.setVariantId(template.getVariantId());
151        instance.setSku(template.getSku());
152        instance.setStaged(template.getStaged());
153        instance.setAsset(com.commercetools.api.models.common.AssetDraft.deepCopy(template.getAsset()));
154        instance.setPosition(template.getPosition());
155        return instance;
156    }
157
158    /**
159     * builder factory method for ProductAddAssetAction
160     * @return builder
161     */
162    public static ProductAddAssetActionBuilder builder() {
163        return ProductAddAssetActionBuilder.of();
164    }
165
166    /**
167     * create builder for ProductAddAssetAction instance
168     * @param template instance with prefilled values for the builder
169     * @return builder
170     */
171    public static ProductAddAssetActionBuilder builder(final ProductAddAssetAction template) {
172        return ProductAddAssetActionBuilder.of(template);
173    }
174
175    /**
176     * accessor map function
177     * @param <T> mapped type
178     * @param helper function to map the object
179     * @return mapped value
180     */
181    default <T> T withProductAddAssetAction(Function<ProductAddAssetAction, T> helper) {
182        return helper.apply(this);
183    }
184
185    /**
186     * gives a TypeReference for usage with Jackson DataBind
187     * @return TypeReference
188     */
189    public static com.fasterxml.jackson.core.type.TypeReference<ProductAddAssetAction> typeReference() {
190        return new com.fasterxml.jackson.core.type.TypeReference<ProductAddAssetAction>() {
191            @Override
192            public String toString() {
193                return "TypeReference<ProductAddAssetAction>";
194            }
195        };
196    }
197}