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