001
002package com.commercetools.api.models.product_selection;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.constraints.NotNull;
010
011import com.fasterxml.jackson.annotation.*;
012import com.fasterxml.jackson.databind.annotation.*;
013
014import io.vrap.rmf.base.client.utils.Generated;
015
016/**
017 * ProductSelectionUpdateAction
018 *
019 * <hr>
020 * Example to create a subtype instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     ProductSelectionUpdateAction productSelectionUpdateAction = ProductSelectionUpdateAction.addProductBuilder()
024 *             product(productBuilder -> productBuilder)
025 *             .build()
026 * </code></pre>
027 * </div>
028 */
029@JsonSubTypes({
030        @JsonSubTypes.Type(value = com.commercetools.api.models.product_selection.ProductSelectionAddProductActionImpl.class, name = ProductSelectionAddProductAction.ADD_PRODUCT),
031        @JsonSubTypes.Type(value = com.commercetools.api.models.product_selection.ProductSelectionChangeNameActionImpl.class, name = ProductSelectionChangeNameAction.CHANGE_NAME),
032        @JsonSubTypes.Type(value = com.commercetools.api.models.product_selection.ProductSelectionExcludeProductActionImpl.class, name = ProductSelectionExcludeProductAction.EXCLUDE_PRODUCT),
033        @JsonSubTypes.Type(value = com.commercetools.api.models.product_selection.ProductSelectionRemoveProductActionImpl.class, name = ProductSelectionRemoveProductAction.REMOVE_PRODUCT),
034        @JsonSubTypes.Type(value = com.commercetools.api.models.product_selection.ProductSelectionSetCustomFieldActionImpl.class, name = ProductSelectionSetCustomFieldAction.SET_CUSTOM_FIELD),
035        @JsonSubTypes.Type(value = com.commercetools.api.models.product_selection.ProductSelectionSetCustomTypeActionImpl.class, name = ProductSelectionSetCustomTypeAction.SET_CUSTOM_TYPE),
036        @JsonSubTypes.Type(value = com.commercetools.api.models.product_selection.ProductSelectionSetKeyActionImpl.class, name = ProductSelectionSetKeyAction.SET_KEY),
037        @JsonSubTypes.Type(value = com.commercetools.api.models.product_selection.ProductSelectionSetVariantExclusionActionImpl.class, name = ProductSelectionSetVariantExclusionAction.SET_VARIANT_EXCLUSION),
038        @JsonSubTypes.Type(value = com.commercetools.api.models.product_selection.ProductSelectionSetVariantSelectionActionImpl.class, name = ProductSelectionSetVariantSelectionAction.SET_VARIANT_SELECTION) })
039@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "action", defaultImpl = ProductSelectionUpdateActionImpl.class, visible = true)
040@JsonDeserialize(as = ProductSelectionUpdateActionImpl.class)
041@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
042public interface ProductSelectionUpdateAction
043        extends com.commercetools.api.models.ResourceUpdateAction<ProductSelectionUpdateAction> {
044
045    /**
046     *
047     * @return action
048     */
049    @NotNull
050    @JsonProperty("action")
051    public String getAction();
052
053    /**
054     * factory method to create a deep copy of ProductSelectionUpdateAction
055     * @param template instance to be copied
056     * @return copy instance
057     */
058    @Nullable
059    public static ProductSelectionUpdateAction deepCopy(@Nullable final ProductSelectionUpdateAction template) {
060        if (template == null) {
061            return null;
062        }
063        if (template instanceof com.commercetools.api.models.product_selection.ProductSelectionAddProductAction) {
064            return com.commercetools.api.models.product_selection.ProductSelectionAddProductAction.deepCopy(
065                (com.commercetools.api.models.product_selection.ProductSelectionAddProductAction) template);
066        }
067        if (template instanceof com.commercetools.api.models.product_selection.ProductSelectionChangeNameAction) {
068            return com.commercetools.api.models.product_selection.ProductSelectionChangeNameAction.deepCopy(
069                (com.commercetools.api.models.product_selection.ProductSelectionChangeNameAction) template);
070        }
071        if (template instanceof com.commercetools.api.models.product_selection.ProductSelectionExcludeProductAction) {
072            return com.commercetools.api.models.product_selection.ProductSelectionExcludeProductAction.deepCopy(
073                (com.commercetools.api.models.product_selection.ProductSelectionExcludeProductAction) template);
074        }
075        if (template instanceof com.commercetools.api.models.product_selection.ProductSelectionRemoveProductAction) {
076            return com.commercetools.api.models.product_selection.ProductSelectionRemoveProductAction.deepCopy(
077                (com.commercetools.api.models.product_selection.ProductSelectionRemoveProductAction) template);
078        }
079        if (template instanceof com.commercetools.api.models.product_selection.ProductSelectionSetCustomFieldAction) {
080            return com.commercetools.api.models.product_selection.ProductSelectionSetCustomFieldAction.deepCopy(
081                (com.commercetools.api.models.product_selection.ProductSelectionSetCustomFieldAction) template);
082        }
083        if (template instanceof com.commercetools.api.models.product_selection.ProductSelectionSetCustomTypeAction) {
084            return com.commercetools.api.models.product_selection.ProductSelectionSetCustomTypeAction.deepCopy(
085                (com.commercetools.api.models.product_selection.ProductSelectionSetCustomTypeAction) template);
086        }
087        if (template instanceof com.commercetools.api.models.product_selection.ProductSelectionSetKeyAction) {
088            return com.commercetools.api.models.product_selection.ProductSelectionSetKeyAction
089                    .deepCopy((com.commercetools.api.models.product_selection.ProductSelectionSetKeyAction) template);
090        }
091        if (template instanceof com.commercetools.api.models.product_selection.ProductSelectionSetVariantExclusionAction) {
092            return com.commercetools.api.models.product_selection.ProductSelectionSetVariantExclusionAction.deepCopy(
093                (com.commercetools.api.models.product_selection.ProductSelectionSetVariantExclusionAction) template);
094        }
095        if (template instanceof com.commercetools.api.models.product_selection.ProductSelectionSetVariantSelectionAction) {
096            return com.commercetools.api.models.product_selection.ProductSelectionSetVariantSelectionAction.deepCopy(
097                (com.commercetools.api.models.product_selection.ProductSelectionSetVariantSelectionAction) template);
098        }
099        ProductSelectionUpdateActionImpl instance = new ProductSelectionUpdateActionImpl();
100        return instance;
101    }
102
103    /**
104     * builder for addProduct subtype
105     * @return builder
106     */
107    public static com.commercetools.api.models.product_selection.ProductSelectionAddProductActionBuilder addProductBuilder() {
108        return com.commercetools.api.models.product_selection.ProductSelectionAddProductActionBuilder.of();
109    }
110
111    /**
112     * builder for changeName subtype
113     * @return builder
114     */
115    public static com.commercetools.api.models.product_selection.ProductSelectionChangeNameActionBuilder changeNameBuilder() {
116        return com.commercetools.api.models.product_selection.ProductSelectionChangeNameActionBuilder.of();
117    }
118
119    /**
120     * builder for excludeProduct subtype
121     * @return builder
122     */
123    public static com.commercetools.api.models.product_selection.ProductSelectionExcludeProductActionBuilder excludeProductBuilder() {
124        return com.commercetools.api.models.product_selection.ProductSelectionExcludeProductActionBuilder.of();
125    }
126
127    /**
128     * builder for removeProduct subtype
129     * @return builder
130     */
131    public static com.commercetools.api.models.product_selection.ProductSelectionRemoveProductActionBuilder removeProductBuilder() {
132        return com.commercetools.api.models.product_selection.ProductSelectionRemoveProductActionBuilder.of();
133    }
134
135    /**
136     * builder for setCustomField subtype
137     * @return builder
138     */
139    public static com.commercetools.api.models.product_selection.ProductSelectionSetCustomFieldActionBuilder setCustomFieldBuilder() {
140        return com.commercetools.api.models.product_selection.ProductSelectionSetCustomFieldActionBuilder.of();
141    }
142
143    /**
144     * builder for setCustomType subtype
145     * @return builder
146     */
147    public static com.commercetools.api.models.product_selection.ProductSelectionSetCustomTypeActionBuilder setCustomTypeBuilder() {
148        return com.commercetools.api.models.product_selection.ProductSelectionSetCustomTypeActionBuilder.of();
149    }
150
151    /**
152     * builder for setKey subtype
153     * @return builder
154     */
155    public static com.commercetools.api.models.product_selection.ProductSelectionSetKeyActionBuilder setKeyBuilder() {
156        return com.commercetools.api.models.product_selection.ProductSelectionSetKeyActionBuilder.of();
157    }
158
159    /**
160     * builder for setVariantExclusion subtype
161     * @return builder
162     */
163    public static com.commercetools.api.models.product_selection.ProductSelectionSetVariantExclusionActionBuilder setVariantExclusionBuilder() {
164        return com.commercetools.api.models.product_selection.ProductSelectionSetVariantExclusionActionBuilder.of();
165    }
166
167    /**
168     * builder for setVariantSelection subtype
169     * @return builder
170     */
171    public static com.commercetools.api.models.product_selection.ProductSelectionSetVariantSelectionActionBuilder setVariantSelectionBuilder() {
172        return com.commercetools.api.models.product_selection.ProductSelectionSetVariantSelectionActionBuilder.of();
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 withProductSelectionUpdateAction(Function<ProductSelectionUpdateAction, 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<ProductSelectionUpdateAction> typeReference() {
190        return new com.fasterxml.jackson.core.type.TypeReference<ProductSelectionUpdateAction>() {
191            @Override
192            public String toString() {
193                return "TypeReference<ProductSelectionUpdateAction>";
194            }
195        };
196    }
197}