001
002package com.commercetools.api.models.customer;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.Valid;
010
011import com.commercetools.api.models.type.FieldContainer;
012import com.commercetools.api.models.type.TypeResourceIdentifier;
013import com.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 * CustomerSetCustomTypeAction
020 *
021 * <hr>
022 * Example to create an instance using the builder pattern
023 * <div class=code-example>
024 * <pre><code class='java'>
025 *     CustomerSetCustomTypeAction customerSetCustomTypeAction = CustomerSetCustomTypeAction.builder()
026 *             .build()
027 * </code></pre>
028 * </div>
029 */
030@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
031@JsonDeserialize(as = CustomerSetCustomTypeActionImpl.class)
032public interface CustomerSetCustomTypeAction extends CustomerUpdateAction {
033
034    /**
035     * discriminator value for CustomerSetCustomTypeAction
036     */
037    String SET_CUSTOM_TYPE = "setCustomType";
038
039    /**
040     *  <p>Defines the Type that extends the Customer with Custom Fields. If absent, any existing Type and Custom Fields are removed from the Customer.</p>
041     * @return type
042     */
043    @Valid
044    @JsonProperty("type")
045    public TypeResourceIdentifier getType();
046
047    /**
048     *  <p>Sets the Custom Fields fields for the Customer.</p>
049     * @return fields
050     */
051    @Valid
052    @JsonProperty("fields")
053    public FieldContainer getFields();
054
055    /**
056     *  <p>Defines the Type that extends the Customer with Custom Fields. If absent, any existing Type and Custom Fields are removed from the Customer.</p>
057     * @param type value to be set
058     */
059
060    public void setType(final TypeResourceIdentifier type);
061
062    /**
063     *  <p>Sets the Custom Fields fields for the Customer.</p>
064     * @param fields value to be set
065     */
066
067    public void setFields(final FieldContainer fields);
068
069    /**
070     * factory method
071     * @return instance of CustomerSetCustomTypeAction
072     */
073    public static CustomerSetCustomTypeAction of() {
074        return new CustomerSetCustomTypeActionImpl();
075    }
076
077    /**
078     * factory method to create a shallow copy CustomerSetCustomTypeAction
079     * @param template instance to be copied
080     * @return copy instance
081     */
082    public static CustomerSetCustomTypeAction of(final CustomerSetCustomTypeAction template) {
083        CustomerSetCustomTypeActionImpl instance = new CustomerSetCustomTypeActionImpl();
084        instance.setType(template.getType());
085        instance.setFields(template.getFields());
086        return instance;
087    }
088
089    /**
090     * factory method to create a deep copy of CustomerSetCustomTypeAction
091     * @param template instance to be copied
092     * @return copy instance
093     */
094    @Nullable
095    public static CustomerSetCustomTypeAction deepCopy(@Nullable final CustomerSetCustomTypeAction template) {
096        if (template == null) {
097            return null;
098        }
099        CustomerSetCustomTypeActionImpl instance = new CustomerSetCustomTypeActionImpl();
100        instance.setType(com.commercetools.api.models.type.TypeResourceIdentifier.deepCopy(template.getType()));
101        instance.setFields(com.commercetools.api.models.type.FieldContainer.deepCopy(template.getFields()));
102        return instance;
103    }
104
105    /**
106     * builder factory method for CustomerSetCustomTypeAction
107     * @return builder
108     */
109    public static CustomerSetCustomTypeActionBuilder builder() {
110        return CustomerSetCustomTypeActionBuilder.of();
111    }
112
113    /**
114     * create builder for CustomerSetCustomTypeAction instance
115     * @param template instance with prefilled values for the builder
116     * @return builder
117     */
118    public static CustomerSetCustomTypeActionBuilder builder(final CustomerSetCustomTypeAction template) {
119        return CustomerSetCustomTypeActionBuilder.of(template);
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 withCustomerSetCustomTypeAction(Function<CustomerSetCustomTypeAction, 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<CustomerSetCustomTypeAction> typeReference() {
137        return new com.fasterxml.jackson.core.type.TypeReference<CustomerSetCustomTypeAction>() {
138            @Override
139            public String toString() {
140                return "TypeReference<CustomerSetCustomTypeAction>";
141            }
142        };
143    }
144}