001 002package com.commercetools.api.models.message; 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.DiscountedPrice; 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * <p>Generated after a successful Set Discounted Price update action.</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 * ProductPriceExternalDiscountSetMessagePayload productPriceExternalDiscountSetMessagePayload = ProductPriceExternalDiscountSetMessagePayload.builder() 026 * .variantId(1) 027 * .priceId("{priceId}") 028 * .staged(true) 029 * .build() 030 * </code></pre> 031 * </div> 032 */ 033@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 034@JsonDeserialize(as = ProductPriceExternalDiscountSetMessagePayloadImpl.class) 035public interface ProductPriceExternalDiscountSetMessagePayload extends MessagePayload { 036 037 /** 038 * discriminator value for ProductPriceExternalDiscountSetMessagePayload 039 */ 040 String PRODUCT_PRICE_EXTERNAL_DISCOUNT_SET = "ProductPriceExternalDiscountSet"; 041 042 /** 043 * <p>Unique identifier of the Product Variant for which the Discount was set.</p> 044 * @return variantId 045 */ 046 @NotNull 047 @JsonProperty("variantId") 048 public Integer getVariantId(); 049 050 /** 051 * <p>Key of the Product Variant for which the Discount was set.</p> 052 * @return variantKey 053 */ 054 055 @JsonProperty("variantKey") 056 public String getVariantKey(); 057 058 /** 059 * <p>SKU of the Product Variant for which Discount was set.</p> 060 * @return sku 061 */ 062 063 @JsonProperty("sku") 064 public String getSku(); 065 066 /** 067 * <p>Unique identifier of the Price.</p> 068 * @return priceId 069 */ 070 @NotNull 071 @JsonProperty("priceId") 072 public String getPriceId(); 073 074 /** 075 * <p>Discounted Price for the Product Variant for which Discount was set.</p> 076 * @return discounted 077 */ 078 @Valid 079 @JsonProperty("discounted") 080 public DiscountedPrice getDiscounted(); 081 082 /** 083 * <p>Whether the update was only applied to the staged Product Projection.</p> 084 * @return staged 085 */ 086 @NotNull 087 @JsonProperty("staged") 088 public Boolean getStaged(); 089 090 /** 091 * <p>Unique identifier of the Product Variant for which the Discount was set.</p> 092 * @param variantId value to be set 093 */ 094 095 public void setVariantId(final Integer variantId); 096 097 /** 098 * <p>Key of the Product Variant for which the Discount was set.</p> 099 * @param variantKey value to be set 100 */ 101 102 public void setVariantKey(final String variantKey); 103 104 /** 105 * <p>SKU of the Product Variant for which Discount was set.</p> 106 * @param sku value to be set 107 */ 108 109 public void setSku(final String sku); 110 111 /** 112 * <p>Unique identifier of the Price.</p> 113 * @param priceId value to be set 114 */ 115 116 public void setPriceId(final String priceId); 117 118 /** 119 * <p>Discounted Price for the Product Variant for which Discount was set.</p> 120 * @param discounted value to be set 121 */ 122 123 public void setDiscounted(final DiscountedPrice discounted); 124 125 /** 126 * <p>Whether the update was only applied to the staged Product Projection.</p> 127 * @param staged value to be set 128 */ 129 130 public void setStaged(final Boolean staged); 131 132 /** 133 * factory method 134 * @return instance of ProductPriceExternalDiscountSetMessagePayload 135 */ 136 public static ProductPriceExternalDiscountSetMessagePayload of() { 137 return new ProductPriceExternalDiscountSetMessagePayloadImpl(); 138 } 139 140 /** 141 * factory method to create a shallow copy ProductPriceExternalDiscountSetMessagePayload 142 * @param template instance to be copied 143 * @return copy instance 144 */ 145 public static ProductPriceExternalDiscountSetMessagePayload of( 146 final ProductPriceExternalDiscountSetMessagePayload template) { 147 ProductPriceExternalDiscountSetMessagePayloadImpl instance = new ProductPriceExternalDiscountSetMessagePayloadImpl(); 148 instance.setVariantId(template.getVariantId()); 149 instance.setVariantKey(template.getVariantKey()); 150 instance.setSku(template.getSku()); 151 instance.setPriceId(template.getPriceId()); 152 instance.setDiscounted(template.getDiscounted()); 153 instance.setStaged(template.getStaged()); 154 return instance; 155 } 156 157 /** 158 * factory method to create a deep copy of ProductPriceExternalDiscountSetMessagePayload 159 * @param template instance to be copied 160 * @return copy instance 161 */ 162 @Nullable 163 public static ProductPriceExternalDiscountSetMessagePayload deepCopy( 164 @Nullable final ProductPriceExternalDiscountSetMessagePayload template) { 165 if (template == null) { 166 return null; 167 } 168 ProductPriceExternalDiscountSetMessagePayloadImpl instance = new ProductPriceExternalDiscountSetMessagePayloadImpl(); 169 instance.setVariantId(template.getVariantId()); 170 instance.setVariantKey(template.getVariantKey()); 171 instance.setSku(template.getSku()); 172 instance.setPriceId(template.getPriceId()); 173 instance.setDiscounted(com.commercetools.api.models.common.DiscountedPrice.deepCopy(template.getDiscounted())); 174 instance.setStaged(template.getStaged()); 175 return instance; 176 } 177 178 /** 179 * builder factory method for ProductPriceExternalDiscountSetMessagePayload 180 * @return builder 181 */ 182 public static ProductPriceExternalDiscountSetMessagePayloadBuilder builder() { 183 return ProductPriceExternalDiscountSetMessagePayloadBuilder.of(); 184 } 185 186 /** 187 * create builder for ProductPriceExternalDiscountSetMessagePayload instance 188 * @param template instance with prefilled values for the builder 189 * @return builder 190 */ 191 public static ProductPriceExternalDiscountSetMessagePayloadBuilder builder( 192 final ProductPriceExternalDiscountSetMessagePayload template) { 193 return ProductPriceExternalDiscountSetMessagePayloadBuilder.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 withProductPriceExternalDiscountSetMessagePayload( 203 Function<ProductPriceExternalDiscountSetMessagePayload, T> helper) { 204 return helper.apply(this); 205 } 206 207 /** 208 * gives a TypeReference for usage with Jackson DataBind 209 * @return TypeReference 210 */ 211 public static com.fasterxml.jackson.core.type.TypeReference<ProductPriceExternalDiscountSetMessagePayload> typeReference() { 212 return new com.fasterxml.jackson.core.type.TypeReference<ProductPriceExternalDiscountSetMessagePayload>() { 213 @Override 214 public String toString() { 215 return "TypeReference<ProductPriceExternalDiscountSetMessagePayload>"; 216 } 217 }; 218 } 219}