001 002package com.commercetools.api.models.cart; 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.fasterxml.jackson.annotation.*; 013import com.fasterxml.jackson.databind.annotation.*; 014 015import io.vrap.rmf.base.client.utils.Generated; 016 017/** 018 * <p>Can be used if the Cart has the <code>ExternalAmount</code> TaxMode.</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 * CartSetCustomLineItemTaxAmountAction cartSetCustomLineItemTaxAmountAction = CartSetCustomLineItemTaxAmountAction.builder() 025 * .customLineItemId("{customLineItemId}") 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 = CartSetCustomLineItemTaxAmountActionImpl.class) 032public interface CartSetCustomLineItemTaxAmountAction extends CartUpdateAction { 033 034 /** 035 * discriminator value for CartSetCustomLineItemTaxAmountAction 036 */ 037 String SET_CUSTOM_LINE_ITEM_TAX_AMOUNT = "setCustomLineItemTaxAmount"; 038 039 /** 040 * <p><code>id</code> of the CustomLineItem to update.</p> 041 * @return customLineItemId 042 */ 043 @NotNull 044 @JsonProperty("customLineItemId") 045 public String getCustomLineItemId(); 046 047 /** 048 * <p>Value to set. If empty, any existing value is removed.</p> 049 * @return externalTaxAmount 050 */ 051 @Valid 052 @JsonProperty("externalTaxAmount") 053 public ExternalTaxAmountDraft getExternalTaxAmount(); 054 055 /** 056 * <p><code>id</code> of the CustomLineItem to update.</p> 057 * @param customLineItemId value to be set 058 */ 059 060 public void setCustomLineItemId(final String customLineItemId); 061 062 /** 063 * <p>Value to set. If empty, any existing value is removed.</p> 064 * @param externalTaxAmount value to be set 065 */ 066 067 public void setExternalTaxAmount(final ExternalTaxAmountDraft externalTaxAmount); 068 069 /** 070 * factory method 071 * @return instance of CartSetCustomLineItemTaxAmountAction 072 */ 073 public static CartSetCustomLineItemTaxAmountAction of() { 074 return new CartSetCustomLineItemTaxAmountActionImpl(); 075 } 076 077 /** 078 * factory method to create a shallow copy CartSetCustomLineItemTaxAmountAction 079 * @param template instance to be copied 080 * @return copy instance 081 */ 082 public static CartSetCustomLineItemTaxAmountAction of(final CartSetCustomLineItemTaxAmountAction template) { 083 CartSetCustomLineItemTaxAmountActionImpl instance = new CartSetCustomLineItemTaxAmountActionImpl(); 084 instance.setCustomLineItemId(template.getCustomLineItemId()); 085 instance.setExternalTaxAmount(template.getExternalTaxAmount()); 086 return instance; 087 } 088 089 /** 090 * factory method to create a deep copy of CartSetCustomLineItemTaxAmountAction 091 * @param template instance to be copied 092 * @return copy instance 093 */ 094 @Nullable 095 public static CartSetCustomLineItemTaxAmountAction deepCopy( 096 @Nullable final CartSetCustomLineItemTaxAmountAction template) { 097 if (template == null) { 098 return null; 099 } 100 CartSetCustomLineItemTaxAmountActionImpl instance = new CartSetCustomLineItemTaxAmountActionImpl(); 101 instance.setCustomLineItemId(template.getCustomLineItemId()); 102 instance.setExternalTaxAmount( 103 com.commercetools.api.models.cart.ExternalTaxAmountDraft.deepCopy(template.getExternalTaxAmount())); 104 return instance; 105 } 106 107 /** 108 * builder factory method for CartSetCustomLineItemTaxAmountAction 109 * @return builder 110 */ 111 public static CartSetCustomLineItemTaxAmountActionBuilder builder() { 112 return CartSetCustomLineItemTaxAmountActionBuilder.of(); 113 } 114 115 /** 116 * create builder for CartSetCustomLineItemTaxAmountAction instance 117 * @param template instance with prefilled values for the builder 118 * @return builder 119 */ 120 public static CartSetCustomLineItemTaxAmountActionBuilder builder( 121 final CartSetCustomLineItemTaxAmountAction template) { 122 return CartSetCustomLineItemTaxAmountActionBuilder.of(template); 123 } 124 125 /** 126 * accessor map function 127 * @param <T> mapped type 128 * @param helper function to map the object 129 * @return mapped value 130 */ 131 default <T> T withCartSetCustomLineItemTaxAmountAction(Function<CartSetCustomLineItemTaxAmountAction, T> helper) { 132 return helper.apply(this); 133 } 134 135 /** 136 * gives a TypeReference for usage with Jackson DataBind 137 * @return TypeReference 138 */ 139 public static com.fasterxml.jackson.core.type.TypeReference<CartSetCustomLineItemTaxAmountAction> typeReference() { 140 return new com.fasterxml.jackson.core.type.TypeReference<CartSetCustomLineItemTaxAmountAction>() { 141 @Override 142 public String toString() { 143 return "TypeReference<CartSetCustomLineItemTaxAmountAction>"; 144 } 145 }; 146 } 147}