001 002package com.commercetools.api.models.product; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007import java.util.stream.Collectors; 008 009import javax.annotation.Nullable; 010import javax.validation.Valid; 011import javax.validation.constraints.NotNull; 012 013import com.commercetools.api.models.common.PriceDraft; 014import com.fasterxml.jackson.annotation.*; 015import com.fasterxml.jackson.databind.annotation.*; 016 017import io.vrap.rmf.base.client.utils.Generated; 018 019/** 020 * <p>Either <code>variantId</code> or <code>sku</code> is required.</p> 021 * 022 * <hr> 023 * Example to create an instance using the builder pattern 024 * <div class=code-example> 025 * <pre><code class='java'> 026 * ProductSetPricesAction productSetPricesAction = ProductSetPricesAction.builder() 027 * .plusPrices(pricesBuilder -> pricesBuilder) 028 * .build() 029 * </code></pre> 030 * </div> 031 */ 032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 033@JsonDeserialize(as = ProductSetPricesActionImpl.class) 034public interface ProductSetPricesAction extends ProductUpdateAction { 035 036 /** 037 * discriminator value for ProductSetPricesAction 038 */ 039 String SET_PRICES = "setPrices"; 040 041 /** 042 * <p>The <code>id</code> of the ProductVariant to update.</p> 043 * @return variantId 044 */ 045 046 @JsonProperty("variantId") 047 public Long getVariantId(); 048 049 /** 050 * <p>The <code>sku</code> of the ProductVariant to update.</p> 051 * @return sku 052 */ 053 054 @JsonProperty("sku") 055 public String getSku(); 056 057 /** 058 * <p>The Embedded Prices to set. Each Price must have its unique Price scope (with same currency, country, Customer Group, Channel, <code>validFrom</code> and <code>validUntil</code>).</p> 059 * @return prices 060 */ 061 @NotNull 062 @Valid 063 @JsonProperty("prices") 064 public List<PriceDraft> getPrices(); 065 066 /** 067 * <p>If <code>true</code>, only the staged ProductVariant is updated. If <code>false</code>, both the current and staged ProductVariant are updated.</p> 068 * @return staged 069 */ 070 071 @JsonProperty("staged") 072 public Boolean getStaged(); 073 074 /** 075 * <p>The <code>id</code> of the ProductVariant to update.</p> 076 * @param variantId value to be set 077 */ 078 079 public void setVariantId(final Long variantId); 080 081 /** 082 * <p>The <code>sku</code> of the ProductVariant to update.</p> 083 * @param sku value to be set 084 */ 085 086 public void setSku(final String sku); 087 088 /** 089 * <p>The Embedded Prices to set. Each Price must have its unique Price scope (with same currency, country, Customer Group, Channel, <code>validFrom</code> and <code>validUntil</code>).</p> 090 * @param prices values to be set 091 */ 092 093 @JsonIgnore 094 public void setPrices(final PriceDraft... prices); 095 096 /** 097 * <p>The Embedded Prices to set. Each Price must have its unique Price scope (with same currency, country, Customer Group, Channel, <code>validFrom</code> and <code>validUntil</code>).</p> 098 * @param prices values to be set 099 */ 100 101 public void setPrices(final List<PriceDraft> prices); 102 103 /** 104 * <p>If <code>true</code>, only the staged ProductVariant is updated. If <code>false</code>, both the current and staged ProductVariant are updated.</p> 105 * @param staged value to be set 106 */ 107 108 public void setStaged(final Boolean staged); 109 110 /** 111 * factory method 112 * @return instance of ProductSetPricesAction 113 */ 114 public static ProductSetPricesAction of() { 115 return new ProductSetPricesActionImpl(); 116 } 117 118 /** 119 * factory method to create a shallow copy ProductSetPricesAction 120 * @param template instance to be copied 121 * @return copy instance 122 */ 123 public static ProductSetPricesAction of(final ProductSetPricesAction template) { 124 ProductSetPricesActionImpl instance = new ProductSetPricesActionImpl(); 125 instance.setVariantId(template.getVariantId()); 126 instance.setSku(template.getSku()); 127 instance.setPrices(template.getPrices()); 128 instance.setStaged(template.getStaged()); 129 return instance; 130 } 131 132 /** 133 * factory method to create a deep copy of ProductSetPricesAction 134 * @param template instance to be copied 135 * @return copy instance 136 */ 137 @Nullable 138 public static ProductSetPricesAction deepCopy(@Nullable final ProductSetPricesAction template) { 139 if (template == null) { 140 return null; 141 } 142 ProductSetPricesActionImpl instance = new ProductSetPricesActionImpl(); 143 instance.setVariantId(template.getVariantId()); 144 instance.setSku(template.getSku()); 145 instance.setPrices(Optional.ofNullable(template.getPrices()) 146 .map(t -> t.stream() 147 .map(com.commercetools.api.models.common.PriceDraft::deepCopy) 148 .collect(Collectors.toList())) 149 .orElse(null)); 150 instance.setStaged(template.getStaged()); 151 return instance; 152 } 153 154 /** 155 * builder factory method for ProductSetPricesAction 156 * @return builder 157 */ 158 public static ProductSetPricesActionBuilder builder() { 159 return ProductSetPricesActionBuilder.of(); 160 } 161 162 /** 163 * create builder for ProductSetPricesAction instance 164 * @param template instance with prefilled values for the builder 165 * @return builder 166 */ 167 public static ProductSetPricesActionBuilder builder(final ProductSetPricesAction template) { 168 return ProductSetPricesActionBuilder.of(template); 169 } 170 171 /** 172 * accessor map function 173 * @param <T> mapped type 174 * @param helper function to map the object 175 * @return mapped value 176 */ 177 default <T> T withProductSetPricesAction(Function<ProductSetPricesAction, T> helper) { 178 return helper.apply(this); 179 } 180 181 /** 182 * gives a TypeReference for usage with Jackson DataBind 183 * @return TypeReference 184 */ 185 public static com.fasterxml.jackson.core.type.TypeReference<ProductSetPricesAction> typeReference() { 186 return new com.fasterxml.jackson.core.type.TypeReference<ProductSetPricesAction>() { 187 @Override 188 public String toString() { 189 return "TypeReference<ProductSetPricesAction>"; 190 } 191 }; 192 } 193}