001
002package com.commercetools.api.models.zone;
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 * ZoneUpdateAction
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 *     ZoneUpdateAction zoneUpdateAction = ZoneUpdateAction.addLocationBuilder()
024 *             location(locationBuilder -> locationBuilder)
025 *             .build()
026 * </code></pre>
027 * </div>
028 */
029@JsonSubTypes({
030        @JsonSubTypes.Type(value = com.commercetools.api.models.zone.ZoneAddLocationActionImpl.class, name = ZoneAddLocationAction.ADD_LOCATION),
031        @JsonSubTypes.Type(value = com.commercetools.api.models.zone.ZoneChangeNameActionImpl.class, name = ZoneChangeNameAction.CHANGE_NAME),
032        @JsonSubTypes.Type(value = com.commercetools.api.models.zone.ZoneRemoveLocationActionImpl.class, name = ZoneRemoveLocationAction.REMOVE_LOCATION),
033        @JsonSubTypes.Type(value = com.commercetools.api.models.zone.ZoneSetDescriptionActionImpl.class, name = ZoneSetDescriptionAction.SET_DESCRIPTION),
034        @JsonSubTypes.Type(value = com.commercetools.api.models.zone.ZoneSetKeyActionImpl.class, name = ZoneSetKeyAction.SET_KEY) })
035@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "action", defaultImpl = ZoneUpdateActionImpl.class, visible = true)
036@JsonDeserialize(as = ZoneUpdateActionImpl.class)
037@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
038public interface ZoneUpdateAction extends com.commercetools.api.models.ResourceUpdateAction<ZoneUpdateAction> {
039
040    /**
041     *
042     * @return action
043     */
044    @NotNull
045    @JsonProperty("action")
046    public String getAction();
047
048    /**
049     * factory method to create a deep copy of ZoneUpdateAction
050     * @param template instance to be copied
051     * @return copy instance
052     */
053    @Nullable
054    public static ZoneUpdateAction deepCopy(@Nullable final ZoneUpdateAction template) {
055        if (template == null) {
056            return null;
057        }
058        if (template instanceof com.commercetools.api.models.zone.ZoneAddLocationAction) {
059            return com.commercetools.api.models.zone.ZoneAddLocationAction
060                    .deepCopy((com.commercetools.api.models.zone.ZoneAddLocationAction) template);
061        }
062        if (template instanceof com.commercetools.api.models.zone.ZoneChangeNameAction) {
063            return com.commercetools.api.models.zone.ZoneChangeNameAction
064                    .deepCopy((com.commercetools.api.models.zone.ZoneChangeNameAction) template);
065        }
066        if (template instanceof com.commercetools.api.models.zone.ZoneRemoveLocationAction) {
067            return com.commercetools.api.models.zone.ZoneRemoveLocationAction
068                    .deepCopy((com.commercetools.api.models.zone.ZoneRemoveLocationAction) template);
069        }
070        if (template instanceof com.commercetools.api.models.zone.ZoneSetDescriptionAction) {
071            return com.commercetools.api.models.zone.ZoneSetDescriptionAction
072                    .deepCopy((com.commercetools.api.models.zone.ZoneSetDescriptionAction) template);
073        }
074        if (template instanceof com.commercetools.api.models.zone.ZoneSetKeyAction) {
075            return com.commercetools.api.models.zone.ZoneSetKeyAction
076                    .deepCopy((com.commercetools.api.models.zone.ZoneSetKeyAction) template);
077        }
078        ZoneUpdateActionImpl instance = new ZoneUpdateActionImpl();
079        return instance;
080    }
081
082    /**
083     * builder for addLocation subtype
084     * @return builder
085     */
086    public static com.commercetools.api.models.zone.ZoneAddLocationActionBuilder addLocationBuilder() {
087        return com.commercetools.api.models.zone.ZoneAddLocationActionBuilder.of();
088    }
089
090    /**
091     * builder for changeName subtype
092     * @return builder
093     */
094    public static com.commercetools.api.models.zone.ZoneChangeNameActionBuilder changeNameBuilder() {
095        return com.commercetools.api.models.zone.ZoneChangeNameActionBuilder.of();
096    }
097
098    /**
099     * builder for removeLocation subtype
100     * @return builder
101     */
102    public static com.commercetools.api.models.zone.ZoneRemoveLocationActionBuilder removeLocationBuilder() {
103        return com.commercetools.api.models.zone.ZoneRemoveLocationActionBuilder.of();
104    }
105
106    /**
107     * builder for setDescription subtype
108     * @return builder
109     */
110    public static com.commercetools.api.models.zone.ZoneSetDescriptionActionBuilder setDescriptionBuilder() {
111        return com.commercetools.api.models.zone.ZoneSetDescriptionActionBuilder.of();
112    }
113
114    /**
115     * builder for setKey subtype
116     * @return builder
117     */
118    public static com.commercetools.api.models.zone.ZoneSetKeyActionBuilder setKeyBuilder() {
119        return com.commercetools.api.models.zone.ZoneSetKeyActionBuilder.of();
120    }
121
122    /**
123     * accessor map function
124     * @param <T> mapped type
125     * @param helper function to map the object
126     * @return mapped value
127     */
128    default <T> T withZoneUpdateAction(Function<ZoneUpdateAction, T> helper) {
129        return helper.apply(this);
130    }
131
132    /**
133     * gives a TypeReference for usage with Jackson DataBind
134     * @return TypeReference
135     */
136    public static com.fasterxml.jackson.core.type.TypeReference<ZoneUpdateAction> typeReference() {
137        return new com.fasterxml.jackson.core.type.TypeReference<ZoneUpdateAction>() {
138            @Override
139            public String toString() {
140                return "TypeReference<ZoneUpdateAction>";
141            }
142        };
143    }
144}