001
002package com.commercetools.api.models.me;
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>Setting a distribution channel for a LineItem can lead to an updated <code>price</code> as described in LineItem Price selection.</p>
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class MyCartSetLineItemDistributionChannelActionImpl
022        implements MyCartSetLineItemDistributionChannelAction, ModelBase {
023
024    private String action;
025
026    private String lineItemId;
027
028    private String lineItemKey;
029
030    private com.commercetools.api.models.channel.ChannelResourceIdentifier distributionChannel;
031
032    /**
033     * create instance with all properties
034     */
035    @JsonCreator
036    MyCartSetLineItemDistributionChannelActionImpl(@JsonProperty("lineItemId") final String lineItemId,
037            @JsonProperty("lineItemKey") final String lineItemKey,
038            @JsonProperty("distributionChannel") final com.commercetools.api.models.channel.ChannelResourceIdentifier distributionChannel) {
039        this.lineItemId = lineItemId;
040        this.lineItemKey = lineItemKey;
041        this.distributionChannel = distributionChannel;
042        this.action = SET_LINE_ITEM_DISTRIBUTION_CHANNEL;
043    }
044
045    /**
046     * create empty instance
047     */
048    public MyCartSetLineItemDistributionChannelActionImpl() {
049        this.action = SET_LINE_ITEM_DISTRIBUTION_CHANNEL;
050    }
051
052    /**
053     *
054     */
055
056    public String getAction() {
057        return this.action;
058    }
059
060    /**
061     *  <p><code>id</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p>
062     */
063
064    public String getLineItemId() {
065        return this.lineItemId;
066    }
067
068    /**
069     *  <p><code>key</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p>
070     */
071
072    public String getLineItemKey() {
073        return this.lineItemKey;
074    }
075
076    /**
077     *  <ul>
078     *   <li>If present, a Reference to the Channel is set for the LineItem specified by <code>lineItemId</code>.</li>
079     *   <li>If not present, the current Reference to a distribution channel is removed from the LineItem specified by <code>lineItemId</code>. The Channel must have the <code>ProductDistribution</code> ChannelRoleEnum.</li>
080     *  </ul>
081     */
082
083    public com.commercetools.api.models.channel.ChannelResourceIdentifier getDistributionChannel() {
084        return this.distributionChannel;
085    }
086
087    public void setLineItemId(final String lineItemId) {
088        this.lineItemId = lineItemId;
089    }
090
091    public void setLineItemKey(final String lineItemKey) {
092        this.lineItemKey = lineItemKey;
093    }
094
095    public void setDistributionChannel(
096            final com.commercetools.api.models.channel.ChannelResourceIdentifier distributionChannel) {
097        this.distributionChannel = distributionChannel;
098    }
099
100    @Override
101    public boolean equals(Object o) {
102        if (this == o)
103            return true;
104
105        if (o == null || getClass() != o.getClass())
106            return false;
107
108        MyCartSetLineItemDistributionChannelActionImpl that = (MyCartSetLineItemDistributionChannelActionImpl) o;
109
110        return new EqualsBuilder().append(action, that.action)
111                .append(lineItemId, that.lineItemId)
112                .append(lineItemKey, that.lineItemKey)
113                .append(distributionChannel, that.distributionChannel)
114                .isEquals();
115    }
116
117    @Override
118    public int hashCode() {
119        return new HashCodeBuilder(17, 37).append(action)
120                .append(lineItemId)
121                .append(lineItemKey)
122                .append(distributionChannel)
123                .toHashCode();
124    }
125
126}