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