001 002package com.commercetools.api.models.common; 003 004import java.time.*; 005import java.time.ZonedDateTime; 006import java.util.*; 007import java.util.function.Function; 008import java.util.stream.Collectors; 009 010import javax.annotation.Nullable; 011import javax.validation.Valid; 012import javax.validation.constraints.NotNull; 013 014import com.commercetools.api.models.channel.ChannelReference; 015import com.commercetools.api.models.customer_group.CustomerGroupReference; 016import com.commercetools.api.models.type.CustomFields; 017import com.fasterxml.jackson.annotation.*; 018import com.fasterxml.jackson.databind.annotation.*; 019 020import io.vrap.rmf.base.client.utils.Generated; 021 022/** 023 * QueryPrice 024 * 025 * <hr> 026 * Example to create an instance using the builder pattern 027 * <div class=code-example> 028 * <pre><code class='java'> 029 * QueryPrice queryPrice = QueryPrice.builder() 030 * .value(valueBuilder -> valueBuilder) 031 * .build() 032 * </code></pre> 033 * </div> 034 */ 035@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 036@JsonDeserialize(as = QueryPriceImpl.class) 037public interface QueryPrice extends com.commercetools.api.models.Customizable<QueryPrice> { 038 039 /** 040 * <p>Unique identifier of the given Price.</p> 041 * @return id 042 */ 043 044 @JsonProperty("id") 045 public String getId(); 046 047 /** 048 * <p>Money value of the given Price.</p> 049 * @return value 050 */ 051 @NotNull 052 @Valid 053 @JsonProperty("value") 054 public Money getValue(); 055 056 /** 057 * <p>Country for which the given Price is valid.</p> 058 * @return country 059 */ 060 061 @JsonProperty("country") 062 public String getCountry(); 063 064 /** 065 * <p>CustomerGroup for which the given Price is valid.</p> 066 * @return customerGroup 067 */ 068 @Valid 069 @JsonProperty("customerGroup") 070 public CustomerGroupReference getCustomerGroup(); 071 072 /** 073 * <p><code>ProductDistribution</code> Channel for which the given Price is valid.</p> 074 * @return channel 075 */ 076 @Valid 077 @JsonProperty("channel") 078 public ChannelReference getChannel(); 079 080 /** 081 * <p>Date from which the given Price is valid.</p> 082 * @return validFrom 083 */ 084 085 @JsonProperty("validFrom") 086 public ZonedDateTime getValidFrom(); 087 088 /** 089 * <p>Date until which the given Price is valid.</p> 090 * @return validUntil 091 */ 092 093 @JsonProperty("validUntil") 094 public ZonedDateTime getValidUntil(); 095 096 /** 097 * <p>DiscountedPrice you specify for the given Price.</p> 098 * @return discounted 099 */ 100 @Valid 101 @JsonProperty("discounted") 102 public DiscountedPriceDraft getDiscounted(); 103 104 /** 105 * <p>Custom Fields for the Price.</p> 106 * @return custom 107 */ 108 @Valid 109 @JsonProperty("custom") 110 public CustomFields getCustom(); 111 112 /** 113 * <p>Price tier applied when the minimum quantity for the LineItem of a ProductVariant with the related Price is reached in a Cart.</p> 114 * @return tiers 115 */ 116 @Valid 117 @JsonProperty("tiers") 118 public List<PriceTierDraft> getTiers(); 119 120 /** 121 * <p>Unique identifier of the given Price.</p> 122 * @param id value to be set 123 */ 124 125 public void setId(final String id); 126 127 /** 128 * <p>Money value of the given Price.</p> 129 * @param value value to be set 130 */ 131 132 public void setValue(final Money value); 133 134 /** 135 * <p>Country for which the given Price is valid.</p> 136 * @param country value to be set 137 */ 138 139 public void setCountry(final String country); 140 141 /** 142 * <p>CustomerGroup for which the given Price is valid.</p> 143 * @param customerGroup value to be set 144 */ 145 146 public void setCustomerGroup(final CustomerGroupReference customerGroup); 147 148 /** 149 * <p><code>ProductDistribution</code> Channel for which the given Price is valid.</p> 150 * @param channel value to be set 151 */ 152 153 public void setChannel(final ChannelReference channel); 154 155 /** 156 * <p>Date from which the given Price is valid.</p> 157 * @param validFrom value to be set 158 */ 159 160 public void setValidFrom(final ZonedDateTime validFrom); 161 162 /** 163 * <p>Date until which the given Price is valid.</p> 164 * @param validUntil value to be set 165 */ 166 167 public void setValidUntil(final ZonedDateTime validUntil); 168 169 /** 170 * <p>DiscountedPrice you specify for the given Price.</p> 171 * @param discounted value to be set 172 */ 173 174 public void setDiscounted(final DiscountedPriceDraft discounted); 175 176 /** 177 * <p>Custom Fields for the Price.</p> 178 * @param custom value to be set 179 */ 180 181 public void setCustom(final CustomFields custom); 182 183 /** 184 * <p>Price tier applied when the minimum quantity for the LineItem of a ProductVariant with the related Price is reached in a Cart.</p> 185 * @param tiers values to be set 186 */ 187 188 @JsonIgnore 189 public void setTiers(final PriceTierDraft... tiers); 190 191 /** 192 * <p>Price tier applied when the minimum quantity for the LineItem of a ProductVariant with the related Price is reached in a Cart.</p> 193 * @param tiers values to be set 194 */ 195 196 public void setTiers(final List<PriceTierDraft> tiers); 197 198 /** 199 * factory method 200 * @return instance of QueryPrice 201 */ 202 public static QueryPrice of() { 203 return new QueryPriceImpl(); 204 } 205 206 /** 207 * factory method to create a shallow copy QueryPrice 208 * @param template instance to be copied 209 * @return copy instance 210 */ 211 public static QueryPrice of(final QueryPrice template) { 212 QueryPriceImpl instance = new QueryPriceImpl(); 213 instance.setId(template.getId()); 214 instance.setValue(template.getValue()); 215 instance.setCountry(template.getCountry()); 216 instance.setCustomerGroup(template.getCustomerGroup()); 217 instance.setChannel(template.getChannel()); 218 instance.setValidFrom(template.getValidFrom()); 219 instance.setValidUntil(template.getValidUntil()); 220 instance.setDiscounted(template.getDiscounted()); 221 instance.setCustom(template.getCustom()); 222 instance.setTiers(template.getTiers()); 223 return instance; 224 } 225 226 /** 227 * factory method to create a deep copy of QueryPrice 228 * @param template instance to be copied 229 * @return copy instance 230 */ 231 @Nullable 232 public static QueryPrice deepCopy(@Nullable final QueryPrice template) { 233 if (template == null) { 234 return null; 235 } 236 QueryPriceImpl instance = new QueryPriceImpl(); 237 instance.setId(template.getId()); 238 instance.setValue(com.commercetools.api.models.common.Money.deepCopy(template.getValue())); 239 instance.setCountry(template.getCountry()); 240 instance.setCustomerGroup( 241 com.commercetools.api.models.customer_group.CustomerGroupReference.deepCopy(template.getCustomerGroup())); 242 instance.setChannel(com.commercetools.api.models.channel.ChannelReference.deepCopy(template.getChannel())); 243 instance.setValidFrom(template.getValidFrom()); 244 instance.setValidUntil(template.getValidUntil()); 245 instance.setDiscounted( 246 com.commercetools.api.models.common.DiscountedPriceDraft.deepCopy(template.getDiscounted())); 247 instance.setCustom(com.commercetools.api.models.type.CustomFields.deepCopy(template.getCustom())); 248 instance.setTiers(Optional.ofNullable(template.getTiers()) 249 .map(t -> t.stream() 250 .map(com.commercetools.api.models.common.PriceTierDraft::deepCopy) 251 .collect(Collectors.toList())) 252 .orElse(null)); 253 return instance; 254 } 255 256 /** 257 * builder factory method for QueryPrice 258 * @return builder 259 */ 260 public static QueryPriceBuilder builder() { 261 return QueryPriceBuilder.of(); 262 } 263 264 /** 265 * create builder for QueryPrice instance 266 * @param template instance with prefilled values for the builder 267 * @return builder 268 */ 269 public static QueryPriceBuilder builder(final QueryPrice template) { 270 return QueryPriceBuilder.of(template); 271 } 272 273 /** 274 * accessor map function 275 * @param <T> mapped type 276 * @param helper function to map the object 277 * @return mapped value 278 */ 279 default <T> T withQueryPrice(Function<QueryPrice, T> helper) { 280 return helper.apply(this); 281 } 282 283 /** 284 * gives a TypeReference for usage with Jackson DataBind 285 * @return TypeReference 286 */ 287 public static com.fasterxml.jackson.core.type.TypeReference<QueryPrice> typeReference() { 288 return new com.fasterxml.jackson.core.type.TypeReference<QueryPrice>() { 289 @Override 290 public String toString() { 291 return "TypeReference<QueryPrice>"; 292 } 293 }; 294 } 295}