001 002package com.commercetools.api.models.product; 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.api.models.common.PriceDraft; 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * ProductRemovePriceAction 020 * 021 * <hr> 022 * Example to create an instance using the builder pattern 023 * <div class=code-example> 024 * <pre><code class='java'> 025 * ProductRemovePriceAction productRemovePriceAction = ProductRemovePriceAction.builder() 026 * .priceId("{priceId}") 027 * .build() 028 * </code></pre> 029 * </div> 030 */ 031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 032@JsonDeserialize(as = ProductRemovePriceActionImpl.class) 033public interface ProductRemovePriceAction extends ProductUpdateAction { 034 035 /** 036 * discriminator value for ProductRemovePriceAction 037 */ 038 String REMOVE_PRICE = "removePrice"; 039 040 /** 041 * <p>The <code>id</code> of the Embedded Price to remove.</p> 042 * @return priceId 043 */ 044 @NotNull 045 @JsonProperty("priceId") 046 public String getPriceId(); 047 048 /** 049 * <p>The <code>sku</code> of the ProductVariant the provided Price should be removed from. Either 'variantId' or 'sku' is required" when <code>priceId</code> is not provided. This field is now deprecated, use 'priceId' instead.</p> 050 * @return sku 051 */ 052 053 @JsonProperty("sku") 054 public String getSku(); 055 056 /** 057 * <p>The <code>id</code> of the ProductVariant the provided Price should be removed from. Either 'variantId' or 'sku' is required" when <code>priceId</code> is not provided. This field is now deprecated, use 'priceId' instead.</p> 058 * @return variantId 059 */ 060 061 @JsonProperty("variantId") 062 public Long getVariantId(); 063 064 /** 065 * <p>The Price identical to the one to be removed from the ProductVariant. This field is now deprecated, use 'priceId' instead.</p> 066 * @return price 067 */ 068 @Valid 069 @JsonProperty("price") 070 public PriceDraft getPrice(); 071 072 /** 073 * <p>If <code>true</code>, only the staged Embedded Price is removed. If <code>false</code>, both the current and staged Embedded Price are removed.</p> 074 * @return staged 075 */ 076 077 @JsonProperty("staged") 078 public Boolean getStaged(); 079 080 /** 081 * <p>The <code>id</code> of the Embedded Price to remove.</p> 082 * @param priceId value to be set 083 */ 084 085 public void setPriceId(final String priceId); 086 087 /** 088 * <p>The <code>sku</code> of the ProductVariant the provided Price should be removed from. Either 'variantId' or 'sku' is required" when <code>priceId</code> is not provided. This field is now deprecated, use 'priceId' instead.</p> 089 * @param sku value to be set 090 */ 091 092 public void setSku(final String sku); 093 094 /** 095 * <p>The <code>id</code> of the ProductVariant the provided Price should be removed from. Either 'variantId' or 'sku' is required" when <code>priceId</code> is not provided. This field is now deprecated, use 'priceId' instead.</p> 096 * @param variantId value to be set 097 */ 098 099 public void setVariantId(final Long variantId); 100 101 /** 102 * <p>The Price identical to the one to be removed from the ProductVariant. This field is now deprecated, use 'priceId' instead.</p> 103 * @param price value to be set 104 */ 105 106 public void setPrice(final PriceDraft price); 107 108 /** 109 * <p>If <code>true</code>, only the staged Embedded Price is removed. If <code>false</code>, both the current and staged Embedded Price are removed.</p> 110 * @param staged value to be set 111 */ 112 113 public void setStaged(final Boolean staged); 114 115 /** 116 * factory method 117 * @return instance of ProductRemovePriceAction 118 */ 119 public static ProductRemovePriceAction of() { 120 return new ProductRemovePriceActionImpl(); 121 } 122 123 /** 124 * factory method to create a shallow copy ProductRemovePriceAction 125 * @param template instance to be copied 126 * @return copy instance 127 */ 128 public static ProductRemovePriceAction of(final ProductRemovePriceAction template) { 129 ProductRemovePriceActionImpl instance = new ProductRemovePriceActionImpl(); 130 instance.setPriceId(template.getPriceId()); 131 instance.setSku(template.getSku()); 132 instance.setVariantId(template.getVariantId()); 133 instance.setPrice(template.getPrice()); 134 instance.setStaged(template.getStaged()); 135 return instance; 136 } 137 138 /** 139 * factory method to create a deep copy of ProductRemovePriceAction 140 * @param template instance to be copied 141 * @return copy instance 142 */ 143 @Nullable 144 public static ProductRemovePriceAction deepCopy(@Nullable final ProductRemovePriceAction template) { 145 if (template == null) { 146 return null; 147 } 148 ProductRemovePriceActionImpl instance = new ProductRemovePriceActionImpl(); 149 instance.setPriceId(template.getPriceId()); 150 instance.setSku(template.getSku()); 151 instance.setVariantId(template.getVariantId()); 152 instance.setPrice(com.commercetools.api.models.common.PriceDraft.deepCopy(template.getPrice())); 153 instance.setStaged(template.getStaged()); 154 return instance; 155 } 156 157 /** 158 * builder factory method for ProductRemovePriceAction 159 * @return builder 160 */ 161 public static ProductRemovePriceActionBuilder builder() { 162 return ProductRemovePriceActionBuilder.of(); 163 } 164 165 /** 166 * create builder for ProductRemovePriceAction instance 167 * @param template instance with prefilled values for the builder 168 * @return builder 169 */ 170 public static ProductRemovePriceActionBuilder builder(final ProductRemovePriceAction template) { 171 return ProductRemovePriceActionBuilder.of(template); 172 } 173 174 /** 175 * accessor map function 176 * @param <T> mapped type 177 * @param helper function to map the object 178 * @return mapped value 179 */ 180 default <T> T withProductRemovePriceAction(Function<ProductRemovePriceAction, T> helper) { 181 return helper.apply(this); 182 } 183 184 /** 185 * gives a TypeReference for usage with Jackson DataBind 186 * @return TypeReference 187 */ 188 public static com.fasterxml.jackson.core.type.TypeReference<ProductRemovePriceAction> typeReference() { 189 return new com.fasterxml.jackson.core.type.TypeReference<ProductRemovePriceAction>() { 190 @Override 191 public String toString() { 192 return "TypeReference<ProductRemovePriceAction>"; 193 } 194 }; 195 } 196}