001 002package com.commercetools.history.models.change; 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.history.models.common.Price; 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * <p>Change triggered by the Set Discounted Embedded Price update action.</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 * SetDiscountedPriceChange setDiscountedPriceChange = SetDiscountedPriceChange.builder() 026 * .change("{change}") 027 * .previousValue(previousValueBuilder -> previousValueBuilder) 028 * .nextValue(nextValueBuilder -> nextValueBuilder) 029 * .catalogData("{catalogData}") 030 * .variant("{variant}") 031 * .priceId("{priceId}") 032 * .build() 033 * </code></pre> 034 * </div> 035 */ 036@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 037@JsonDeserialize(as = SetDiscountedPriceChangeImpl.class) 038public interface SetDiscountedPriceChange extends Change { 039 040 /** 041 * discriminator value for SetDiscountedPriceChange 042 */ 043 String SET_DISCOUNTED_PRICE_CHANGE = "SetDiscountedPriceChange"; 044 045 /** 046 * 047 * @return type 048 */ 049 @NotNull 050 @JsonProperty("type") 051 public String getType(); 052 053 /** 054 * 055 * @return change 056 */ 057 @NotNull 058 @JsonProperty("change") 059 public String getChange(); 060 061 /** 062 * <p>Value before the change.</p> 063 * @return previousValue 064 */ 065 @NotNull 066 @Valid 067 @JsonProperty("previousValue") 068 public Price getPreviousValue(); 069 070 /** 071 * <p>Value after the change.</p> 072 * @return nextValue 073 */ 074 @NotNull 075 @Valid 076 @JsonProperty("nextValue") 077 public Price getNextValue(); 078 079 /** 080 * <ul> 081 * <li><code>staged</code>, if the staged ProductCatalogData was updated.</li> 082 * <li><code>current</code>, if the current ProductCatalogData was updated.</li> 083 * </ul> 084 * @return catalogData 085 */ 086 @NotNull 087 @JsonProperty("catalogData") 088 public String getCatalogData(); 089 090 /** 091 * <p><code>sku</code> or <code>key</code> of the updated ProductVariant.</p> 092 * @return variant 093 */ 094 @NotNull 095 @JsonProperty("variant") 096 public String getVariant(); 097 098 /** 099 * <p><code>id</code> of the Embedded Price.</p> 100 * @return priceId 101 */ 102 @NotNull 103 @JsonProperty("priceId") 104 public String getPriceId(); 105 106 /** 107 * set change 108 * @param change value to be set 109 */ 110 111 public void setChange(final String change); 112 113 /** 114 * <p>Value before the change.</p> 115 * @param previousValue value to be set 116 */ 117 118 public void setPreviousValue(final Price previousValue); 119 120 /** 121 * <p>Value after the change.</p> 122 * @param nextValue value to be set 123 */ 124 125 public void setNextValue(final Price nextValue); 126 127 /** 128 * <ul> 129 * <li><code>staged</code>, if the staged ProductCatalogData was updated.</li> 130 * <li><code>current</code>, if the current ProductCatalogData was updated.</li> 131 * </ul> 132 * @param catalogData value to be set 133 */ 134 135 public void setCatalogData(final String catalogData); 136 137 /** 138 * <p><code>sku</code> or <code>key</code> of the updated ProductVariant.</p> 139 * @param variant value to be set 140 */ 141 142 public void setVariant(final String variant); 143 144 /** 145 * <p><code>id</code> of the Embedded Price.</p> 146 * @param priceId value to be set 147 */ 148 149 public void setPriceId(final String priceId); 150 151 /** 152 * factory method 153 * @return instance of SetDiscountedPriceChange 154 */ 155 public static SetDiscountedPriceChange of() { 156 return new SetDiscountedPriceChangeImpl(); 157 } 158 159 /** 160 * factory method to create a shallow copy SetDiscountedPriceChange 161 * @param template instance to be copied 162 * @return copy instance 163 */ 164 public static SetDiscountedPriceChange of(final SetDiscountedPriceChange template) { 165 SetDiscountedPriceChangeImpl instance = new SetDiscountedPriceChangeImpl(); 166 instance.setChange(template.getChange()); 167 instance.setPreviousValue(template.getPreviousValue()); 168 instance.setNextValue(template.getNextValue()); 169 instance.setCatalogData(template.getCatalogData()); 170 instance.setVariant(template.getVariant()); 171 instance.setPriceId(template.getPriceId()); 172 return instance; 173 } 174 175 /** 176 * factory method to create a deep copy of SetDiscountedPriceChange 177 * @param template instance to be copied 178 * @return copy instance 179 */ 180 @Nullable 181 public static SetDiscountedPriceChange deepCopy(@Nullable final SetDiscountedPriceChange template) { 182 if (template == null) { 183 return null; 184 } 185 SetDiscountedPriceChangeImpl instance = new SetDiscountedPriceChangeImpl(); 186 instance.setChange(template.getChange()); 187 instance.setPreviousValue(com.commercetools.history.models.common.Price.deepCopy(template.getPreviousValue())); 188 instance.setNextValue(com.commercetools.history.models.common.Price.deepCopy(template.getNextValue())); 189 instance.setCatalogData(template.getCatalogData()); 190 instance.setVariant(template.getVariant()); 191 instance.setPriceId(template.getPriceId()); 192 return instance; 193 } 194 195 /** 196 * builder factory method for SetDiscountedPriceChange 197 * @return builder 198 */ 199 public static SetDiscountedPriceChangeBuilder builder() { 200 return SetDiscountedPriceChangeBuilder.of(); 201 } 202 203 /** 204 * create builder for SetDiscountedPriceChange instance 205 * @param template instance with prefilled values for the builder 206 * @return builder 207 */ 208 public static SetDiscountedPriceChangeBuilder builder(final SetDiscountedPriceChange template) { 209 return SetDiscountedPriceChangeBuilder.of(template); 210 } 211 212 /** 213 * accessor map function 214 * @param <T> mapped type 215 * @param helper function to map the object 216 * @return mapped value 217 */ 218 default <T> T withSetDiscountedPriceChange(Function<SetDiscountedPriceChange, T> helper) { 219 return helper.apply(this); 220 } 221 222 /** 223 * gives a TypeReference for usage with Jackson DataBind 224 * @return TypeReference 225 */ 226 public static com.fasterxml.jackson.core.type.TypeReference<SetDiscountedPriceChange> typeReference() { 227 return new com.fasterxml.jackson.core.type.TypeReference<SetDiscountedPriceChange>() { 228 @Override 229 public String toString() { 230 return "TypeReference<SetDiscountedPriceChange>"; 231 } 232 }; 233 } 234}