001 002package com.commercetools.api.models.cart_discount; 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.channel.ChannelReference; 013import com.commercetools.api.models.product.ProductReference; 014import com.fasterxml.jackson.annotation.*; 015import com.fasterxml.jackson.databind.annotation.*; 016 017import io.vrap.rmf.base.client.utils.Generated; 018 019/** 020 * CartDiscountValueGiftLineItem 021 * 022 * <hr> 023 * Example to create an instance using the builder pattern 024 * <div class=code-example> 025 * <pre><code class='java'> 026 * CartDiscountValueGiftLineItem cartDiscountValueGiftLineItem = CartDiscountValueGiftLineItem.builder() 027 * .product(productBuilder -> productBuilder) 028 * .variantId(0.3) 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 = CartDiscountValueGiftLineItemImpl.class) 035public interface CartDiscountValueGiftLineItem extends CartDiscountValue, CartDiscountValueGiftLineItemMixin { 036 037 /** 038 * discriminator value for CartDiscountValueGiftLineItem 039 */ 040 String GIFT_LINE_ITEM = "giftLineItem"; 041 042 /** 043 * <p>Reference to a Product.</p> 044 * @return product 045 */ 046 @NotNull 047 @Valid 048 @JsonProperty("product") 049 public ProductReference getProduct(); 050 051 /** 052 * <p>ProductVariant of the Product.</p> 053 * @return variantId 054 */ 055 @NotNull 056 @JsonProperty("variantId") 057 public Long getVariantId(); 058 059 /** 060 * <p>Channel must have the ChannelRoleEnum <code>InventorySupply</code>.</p> 061 * @return supplyChannel 062 */ 063 @Valid 064 @JsonProperty("supplyChannel") 065 public ChannelReference getSupplyChannel(); 066 067 /** 068 * <p>Channel must have the ChannelRoleEnum <code>ProductDistribution</code>.</p> 069 * @return distributionChannel 070 */ 071 @Valid 072 @JsonProperty("distributionChannel") 073 public ChannelReference getDistributionChannel(); 074 075 /** 076 * <p>Reference to a Product.</p> 077 * @param product value to be set 078 */ 079 080 public void setProduct(final ProductReference product); 081 082 /** 083 * <p>ProductVariant of the Product.</p> 084 * @param variantId value to be set 085 */ 086 087 public void setVariantId(final Long variantId); 088 089 /** 090 * <p>Channel must have the ChannelRoleEnum <code>InventorySupply</code>.</p> 091 * @param supplyChannel value to be set 092 */ 093 094 public void setSupplyChannel(final ChannelReference supplyChannel); 095 096 /** 097 * <p>Channel must have the ChannelRoleEnum <code>ProductDistribution</code>.</p> 098 * @param distributionChannel value to be set 099 */ 100 101 public void setDistributionChannel(final ChannelReference distributionChannel); 102 103 /** 104 * factory method 105 * @return instance of CartDiscountValueGiftLineItem 106 */ 107 public static CartDiscountValueGiftLineItem of() { 108 return new CartDiscountValueGiftLineItemImpl(); 109 } 110 111 /** 112 * factory method to create a shallow copy CartDiscountValueGiftLineItem 113 * @param template instance to be copied 114 * @return copy instance 115 */ 116 public static CartDiscountValueGiftLineItem of(final CartDiscountValueGiftLineItem template) { 117 CartDiscountValueGiftLineItemImpl instance = new CartDiscountValueGiftLineItemImpl(); 118 instance.setProduct(template.getProduct()); 119 instance.setVariantId(template.getVariantId()); 120 instance.setSupplyChannel(template.getSupplyChannel()); 121 instance.setDistributionChannel(template.getDistributionChannel()); 122 return instance; 123 } 124 125 /** 126 * factory method to create a deep copy of CartDiscountValueGiftLineItem 127 * @param template instance to be copied 128 * @return copy instance 129 */ 130 @Nullable 131 public static CartDiscountValueGiftLineItem deepCopy(@Nullable final CartDiscountValueGiftLineItem template) { 132 if (template == null) { 133 return null; 134 } 135 CartDiscountValueGiftLineItemImpl instance = new CartDiscountValueGiftLineItemImpl(); 136 instance.setProduct(com.commercetools.api.models.product.ProductReference.deepCopy(template.getProduct())); 137 instance.setVariantId(template.getVariantId()); 138 instance.setSupplyChannel( 139 com.commercetools.api.models.channel.ChannelReference.deepCopy(template.getSupplyChannel())); 140 instance.setDistributionChannel( 141 com.commercetools.api.models.channel.ChannelReference.deepCopy(template.getDistributionChannel())); 142 return instance; 143 } 144 145 /** 146 * builder factory method for CartDiscountValueGiftLineItem 147 * @return builder 148 */ 149 public static CartDiscountValueGiftLineItemBuilder builder() { 150 return CartDiscountValueGiftLineItemBuilder.of(); 151 } 152 153 /** 154 * create builder for CartDiscountValueGiftLineItem instance 155 * @param template instance with prefilled values for the builder 156 * @return builder 157 */ 158 public static CartDiscountValueGiftLineItemBuilder builder(final CartDiscountValueGiftLineItem template) { 159 return CartDiscountValueGiftLineItemBuilder.of(template); 160 } 161 162 /** 163 * accessor map function 164 * @param <T> mapped type 165 * @param helper function to map the object 166 * @return mapped value 167 */ 168 default <T> T withCartDiscountValueGiftLineItem(Function<CartDiscountValueGiftLineItem, T> helper) { 169 return helper.apply(this); 170 } 171 172 /** 173 * gives a TypeReference for usage with Jackson DataBind 174 * @return TypeReference 175 */ 176 public static com.fasterxml.jackson.core.type.TypeReference<CartDiscountValueGiftLineItem> typeReference() { 177 return new com.fasterxml.jackson.core.type.TypeReference<CartDiscountValueGiftLineItem>() { 178 @Override 179 public String toString() { 180 return "TypeReference<CartDiscountValueGiftLineItem>"; 181 } 182 }; 183 } 184}