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; 010 011import com.commercetools.api.models.common.Money; 012import com.fasterxml.jackson.annotation.*; 013import com.fasterxml.jackson.databind.annotation.*; 014 015import io.vrap.rmf.base.client.utils.Generated; 016 017/** 018 * <p>The LineItem price is updated as described in LineItem Price selection.</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 * CartRemoveLineItemAction cartRemoveLineItemAction = CartRemoveLineItemAction.builder() 025 * .build() 026 * </code></pre> 027 * </div> 028 */ 029@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 030@JsonDeserialize(as = CartRemoveLineItemActionImpl.class) 031public interface CartRemoveLineItemAction extends CartUpdateAction { 032 033 /** 034 * discriminator value for CartRemoveLineItemAction 035 */ 036 String REMOVE_LINE_ITEM = "removeLineItem"; 037 038 /** 039 * <p><code>id</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 040 * @return lineItemId 041 */ 042 043 @JsonProperty("lineItemId") 044 public String getLineItemId(); 045 046 /** 047 * <p><code>key</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 048 * @return lineItemKey 049 */ 050 051 @JsonProperty("lineItemKey") 052 public String getLineItemKey(); 053 054 /** 055 * <p>Amount to subtract from the LineItem's <code>quantity</code>. If absent, the LineItem is removed from the Cart.</p> 056 * @return quantity 057 */ 058 059 @JsonProperty("quantity") 060 public Long getQuantity(); 061 062 /** 063 * <p>Sets the LineItem <code>price</code> to the given value when decreasing the quantity of a Line Item with the <code>ExternalPrice</code> LineItemPriceMode.</p> 064 * @return externalPrice 065 */ 066 @Valid 067 @JsonProperty("externalPrice") 068 public Money getExternalPrice(); 069 070 /** 071 * <p>Sets the LineItem <code>price</code> and <code>totalPrice</code> to the given value when decreasing the quantity of a Line Item with the <code>ExternalTotal</code> LineItemPriceMode.</p> 072 * @return externalTotalPrice 073 */ 074 @Valid 075 @JsonProperty("externalTotalPrice") 076 public ExternalLineItemTotalPrice getExternalTotalPrice(); 077 078 /** 079 * <p>Container for Line Item-specific addresses to remove.</p> 080 * @return shippingDetailsToRemove 081 */ 082 @Valid 083 @JsonProperty("shippingDetailsToRemove") 084 public ItemShippingDetailsDraft getShippingDetailsToRemove(); 085 086 /** 087 * <p><code>id</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 088 * @param lineItemId value to be set 089 */ 090 091 public void setLineItemId(final String lineItemId); 092 093 /** 094 * <p><code>key</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 095 * @param lineItemKey value to be set 096 */ 097 098 public void setLineItemKey(final String lineItemKey); 099 100 /** 101 * <p>Amount to subtract from the LineItem's <code>quantity</code>. If absent, the LineItem is removed from the Cart.</p> 102 * @param quantity value to be set 103 */ 104 105 public void setQuantity(final Long quantity); 106 107 /** 108 * <p>Sets the LineItem <code>price</code> to the given value when decreasing the quantity of a Line Item with the <code>ExternalPrice</code> LineItemPriceMode.</p> 109 * @param externalPrice value to be set 110 */ 111 112 public void setExternalPrice(final Money externalPrice); 113 114 /** 115 * <p>Sets the LineItem <code>price</code> and <code>totalPrice</code> to the given value when decreasing the quantity of a Line Item with the <code>ExternalTotal</code> LineItemPriceMode.</p> 116 * @param externalTotalPrice value to be set 117 */ 118 119 public void setExternalTotalPrice(final ExternalLineItemTotalPrice externalTotalPrice); 120 121 /** 122 * <p>Container for Line Item-specific addresses to remove.</p> 123 * @param shippingDetailsToRemove value to be set 124 */ 125 126 public void setShippingDetailsToRemove(final ItemShippingDetailsDraft shippingDetailsToRemove); 127 128 /** 129 * factory method 130 * @return instance of CartRemoveLineItemAction 131 */ 132 public static CartRemoveLineItemAction of() { 133 return new CartRemoveLineItemActionImpl(); 134 } 135 136 /** 137 * factory method to create a shallow copy CartRemoveLineItemAction 138 * @param template instance to be copied 139 * @return copy instance 140 */ 141 public static CartRemoveLineItemAction of(final CartRemoveLineItemAction template) { 142 CartRemoveLineItemActionImpl instance = new CartRemoveLineItemActionImpl(); 143 instance.setLineItemId(template.getLineItemId()); 144 instance.setLineItemKey(template.getLineItemKey()); 145 instance.setQuantity(template.getQuantity()); 146 instance.setExternalPrice(template.getExternalPrice()); 147 instance.setExternalTotalPrice(template.getExternalTotalPrice()); 148 instance.setShippingDetailsToRemove(template.getShippingDetailsToRemove()); 149 return instance; 150 } 151 152 /** 153 * factory method to create a deep copy of CartRemoveLineItemAction 154 * @param template instance to be copied 155 * @return copy instance 156 */ 157 @Nullable 158 public static CartRemoveLineItemAction deepCopy(@Nullable final CartRemoveLineItemAction template) { 159 if (template == null) { 160 return null; 161 } 162 CartRemoveLineItemActionImpl instance = new CartRemoveLineItemActionImpl(); 163 instance.setLineItemId(template.getLineItemId()); 164 instance.setLineItemKey(template.getLineItemKey()); 165 instance.setQuantity(template.getQuantity()); 166 instance.setExternalPrice(com.commercetools.api.models.common.Money.deepCopy(template.getExternalPrice())); 167 instance.setExternalTotalPrice( 168 com.commercetools.api.models.cart.ExternalLineItemTotalPrice.deepCopy(template.getExternalTotalPrice())); 169 instance.setShippingDetailsToRemove( 170 com.commercetools.api.models.cart.ItemShippingDetailsDraft.deepCopy(template.getShippingDetailsToRemove())); 171 return instance; 172 } 173 174 /** 175 * builder factory method for CartRemoveLineItemAction 176 * @return builder 177 */ 178 public static CartRemoveLineItemActionBuilder builder() { 179 return CartRemoveLineItemActionBuilder.of(); 180 } 181 182 /** 183 * create builder for CartRemoveLineItemAction instance 184 * @param template instance with prefilled values for the builder 185 * @return builder 186 */ 187 public static CartRemoveLineItemActionBuilder builder(final CartRemoveLineItemAction template) { 188 return CartRemoveLineItemActionBuilder.of(template); 189 } 190 191 /** 192 * accessor map function 193 * @param <T> mapped type 194 * @param helper function to map the object 195 * @return mapped value 196 */ 197 default <T> T withCartRemoveLineItemAction(Function<CartRemoveLineItemAction, T> helper) { 198 return helper.apply(this); 199 } 200 201 /** 202 * gives a TypeReference for usage with Jackson DataBind 203 * @return TypeReference 204 */ 205 public static com.fasterxml.jackson.core.type.TypeReference<CartRemoveLineItemAction> typeReference() { 206 return new com.fasterxml.jackson.core.type.TypeReference<CartRemoveLineItemAction>() { 207 @Override 208 public String toString() { 209 return "TypeReference<CartRemoveLineItemAction>"; 210 } 211 }; 212 } 213}