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