001
002package com.commercetools.api.models.product_type;
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 *  <p>Renames an AttributeDefinition and also renames all corresponding Attributes on all Products with this ProductType. The renaming of the Attributes is eventually consistent.</p>
018 *  <p>If the AttributeDefinition name to be changed does not exist, an AttributeNameDoesNotExist error is returned.</p>
019 *
020 * <hr>
021 * Example to create an instance using the builder pattern
022 * <div class=code-example>
023 * <pre><code class='java'>
024 *     ProductTypeChangeAttributeNameAction productTypeChangeAttributeNameAction = ProductTypeChangeAttributeNameAction.builder()
025 *             .attributeName("{attributeName}")
026 *             .newAttributeName("{newAttributeName}")
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 = ProductTypeChangeAttributeNameActionImpl.class)
033public interface ProductTypeChangeAttributeNameAction extends ProductTypeUpdateAction {
034
035    /**
036     * discriminator value for ProductTypeChangeAttributeNameAction
037     */
038    String CHANGE_ATTRIBUTE_NAME = "changeAttributeName";
039
040    /**
041     *  <p>Name of the AttributeDefinition to update.</p>
042     * @return attributeName
043     */
044    @NotNull
045    @JsonProperty("attributeName")
046    public String getAttributeName();
047
048    /**
049     *  <p>New user-defined name of the Attribute that is unique with the Project.</p>
050     *  <p>When using the same <code>name</code> for an Attribute in two or more ProductTypes, all fields of the AttributeDefinition of this Attribute must be the same across the ProductTypes. If not, an AttributeDefinitionAlreadyExists error is returned. An exception to this are the values of an <code>enum</code> or <code>lenum</code> type and sets thereof.</p>
051     * @return newAttributeName
052     */
053    @NotNull
054    @JsonProperty("newAttributeName")
055    public String getNewAttributeName();
056
057    /**
058     *  <p>Name of the AttributeDefinition to update.</p>
059     * @param attributeName value to be set
060     */
061
062    public void setAttributeName(final String attributeName);
063
064    /**
065     *  <p>New user-defined name of the Attribute that is unique with the Project.</p>
066     *  <p>When using the same <code>name</code> for an Attribute in two or more ProductTypes, all fields of the AttributeDefinition of this Attribute must be the same across the ProductTypes. If not, an AttributeDefinitionAlreadyExists error is returned. An exception to this are the values of an <code>enum</code> or <code>lenum</code> type and sets thereof.</p>
067     * @param newAttributeName value to be set
068     */
069
070    public void setNewAttributeName(final String newAttributeName);
071
072    /**
073     * factory method
074     * @return instance of ProductTypeChangeAttributeNameAction
075     */
076    public static ProductTypeChangeAttributeNameAction of() {
077        return new ProductTypeChangeAttributeNameActionImpl();
078    }
079
080    /**
081     * factory method to create a shallow copy ProductTypeChangeAttributeNameAction
082     * @param template instance to be copied
083     * @return copy instance
084     */
085    public static ProductTypeChangeAttributeNameAction of(final ProductTypeChangeAttributeNameAction template) {
086        ProductTypeChangeAttributeNameActionImpl instance = new ProductTypeChangeAttributeNameActionImpl();
087        instance.setAttributeName(template.getAttributeName());
088        instance.setNewAttributeName(template.getNewAttributeName());
089        return instance;
090    }
091
092    /**
093     * factory method to create a deep copy of ProductTypeChangeAttributeNameAction
094     * @param template instance to be copied
095     * @return copy instance
096     */
097    @Nullable
098    public static ProductTypeChangeAttributeNameAction deepCopy(
099            @Nullable final ProductTypeChangeAttributeNameAction template) {
100        if (template == null) {
101            return null;
102        }
103        ProductTypeChangeAttributeNameActionImpl instance = new ProductTypeChangeAttributeNameActionImpl();
104        instance.setAttributeName(template.getAttributeName());
105        instance.setNewAttributeName(template.getNewAttributeName());
106        return instance;
107    }
108
109    /**
110     * builder factory method for ProductTypeChangeAttributeNameAction
111     * @return builder
112     */
113    public static ProductTypeChangeAttributeNameActionBuilder builder() {
114        return ProductTypeChangeAttributeNameActionBuilder.of();
115    }
116
117    /**
118     * create builder for ProductTypeChangeAttributeNameAction instance
119     * @param template instance with prefilled values for the builder
120     * @return builder
121     */
122    public static ProductTypeChangeAttributeNameActionBuilder builder(
123            final ProductTypeChangeAttributeNameAction template) {
124        return ProductTypeChangeAttributeNameActionBuilder.of(template);
125    }
126
127    /**
128     * accessor map function
129     * @param <T> mapped type
130     * @param helper function to map the object
131     * @return mapped value
132     */
133    default <T> T withProductTypeChangeAttributeNameAction(Function<ProductTypeChangeAttributeNameAction, T> helper) {
134        return helper.apply(this);
135    }
136
137    /**
138     * gives a TypeReference for usage with Jackson DataBind
139     * @return TypeReference
140     */
141    public static com.fasterxml.jackson.core.type.TypeReference<ProductTypeChangeAttributeNameAction> typeReference() {
142        return new com.fasterxml.jackson.core.type.TypeReference<ProductTypeChangeAttributeNameAction>() {
143            @Override
144            public String toString() {
145                return "TypeReference<ProductTypeChangeAttributeNameAction>";
146            }
147        };
148    }
149}