001 002package com.commercetools.api.models.cart_discount; 003 004import java.time.*; 005import java.util.*; 006 007import com.fasterxml.jackson.annotation.JsonCreator; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import com.fasterxml.jackson.databind.annotation.*; 010 011import io.vrap.rmf.base.client.ModelBase; 012import io.vrap.rmf.base.client.utils.Generated; 013 014import org.apache.commons.lang3.builder.EqualsBuilder; 015import org.apache.commons.lang3.builder.HashCodeBuilder; 016 017/** 018 * <p>Can only be used in a CartDiscountDraft with no <code>target</code> specified. Hence, this type can not be used in the Change Value update action.</p> 019 */ 020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 021public class CartDiscountValueGiftLineItemDraftImpl implements CartDiscountValueGiftLineItemDraft, ModelBase { 022 023 private String type; 024 025 private com.commercetools.api.models.product.ProductResourceIdentifier product; 026 027 private Long variantId; 028 029 private com.commercetools.api.models.channel.ChannelResourceIdentifier supplyChannel; 030 031 private com.commercetools.api.models.channel.ChannelResourceIdentifier distributionChannel; 032 033 /** 034 * create instance with all properties 035 */ 036 @JsonCreator 037 CartDiscountValueGiftLineItemDraftImpl( 038 @JsonProperty("product") final com.commercetools.api.models.product.ProductResourceIdentifier product, 039 @JsonProperty("variantId") final Long variantId, 040 @JsonProperty("supplyChannel") final com.commercetools.api.models.channel.ChannelResourceIdentifier supplyChannel, 041 @JsonProperty("distributionChannel") final com.commercetools.api.models.channel.ChannelResourceIdentifier distributionChannel) { 042 this.product = product; 043 this.variantId = variantId; 044 this.supplyChannel = supplyChannel; 045 this.distributionChannel = distributionChannel; 046 this.type = GIFT_LINE_ITEM; 047 } 048 049 /** 050 * create empty instance 051 */ 052 public CartDiscountValueGiftLineItemDraftImpl() { 053 this.type = GIFT_LINE_ITEM; 054 } 055 056 /** 057 * 058 */ 059 060 public String getType() { 061 return this.type; 062 } 063 064 /** 065 * <p>ResourceIdentifier of a Product.</p> 066 */ 067 068 public com.commercetools.api.models.product.ProductResourceIdentifier getProduct() { 069 return this.product; 070 } 071 072 /** 073 * <p>ProductVariant of the Product.</p> 074 */ 075 076 public Long getVariantId() { 077 return this.variantId; 078 } 079 080 /** 081 * <p>Channel must have the role <code>InventorySupply</code>.</p> 082 */ 083 084 public com.commercetools.api.models.channel.ChannelResourceIdentifier getSupplyChannel() { 085 return this.supplyChannel; 086 } 087 088 /** 089 * <p>Channel must have the role <code>ProductDistribution</code>.</p> 090 */ 091 092 public com.commercetools.api.models.channel.ChannelResourceIdentifier getDistributionChannel() { 093 return this.distributionChannel; 094 } 095 096 public void setProduct(final com.commercetools.api.models.product.ProductResourceIdentifier product) { 097 this.product = product; 098 } 099 100 public void setVariantId(final Long variantId) { 101 this.variantId = variantId; 102 } 103 104 public void setSupplyChannel(final com.commercetools.api.models.channel.ChannelResourceIdentifier supplyChannel) { 105 this.supplyChannel = supplyChannel; 106 } 107 108 public void setDistributionChannel( 109 final com.commercetools.api.models.channel.ChannelResourceIdentifier distributionChannel) { 110 this.distributionChannel = distributionChannel; 111 } 112 113 @Override 114 public boolean equals(Object o) { 115 if (this == o) 116 return true; 117 118 if (o == null || getClass() != o.getClass()) 119 return false; 120 121 CartDiscountValueGiftLineItemDraftImpl that = (CartDiscountValueGiftLineItemDraftImpl) o; 122 123 return new EqualsBuilder().append(type, that.type) 124 .append(product, that.product) 125 .append(variantId, that.variantId) 126 .append(supplyChannel, that.supplyChannel) 127 .append(distributionChannel, that.distributionChannel) 128 .append(type, that.type) 129 .append(product, that.product) 130 .append(variantId, that.variantId) 131 .append(supplyChannel, that.supplyChannel) 132 .append(distributionChannel, that.distributionChannel) 133 .isEquals(); 134 } 135 136 @Override 137 public int hashCode() { 138 return new HashCodeBuilder(17, 37).append(type) 139 .append(product) 140 .append(variantId) 141 .append(supplyChannel) 142 .append(distributionChannel) 143 .toHashCode(); 144 } 145 146}