001
002package com.commercetools.api.models.cart;
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>Sets the LineItem <code>totalPrice</code> and <code>price</code>, and changes the <code>priceMode</code> to <code>ExternalTotal</code> LineItemPriceMode.</p>
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class CartSetLineItemTotalPriceActionImpl implements CartSetLineItemTotalPriceAction, ModelBase {
022
023    private String action;
024
025    private String lineItemId;
026
027    private String lineItemKey;
028
029    private com.commercetools.api.models.cart.ExternalLineItemTotalPrice externalTotalPrice;
030
031    /**
032     * create instance with all properties
033     */
034    @JsonCreator
035    CartSetLineItemTotalPriceActionImpl(@JsonProperty("lineItemId") final String lineItemId,
036            @JsonProperty("lineItemKey") final String lineItemKey,
037            @JsonProperty("externalTotalPrice") final com.commercetools.api.models.cart.ExternalLineItemTotalPrice externalTotalPrice) {
038        this.lineItemId = lineItemId;
039        this.lineItemKey = lineItemKey;
040        this.externalTotalPrice = externalTotalPrice;
041        this.action = SET_LINE_ITEM_TOTAL_PRICE;
042    }
043
044    /**
045     * create empty instance
046     */
047    public CartSetLineItemTotalPriceActionImpl() {
048        this.action = SET_LINE_ITEM_TOTAL_PRICE;
049    }
050
051    /**
052     *
053     */
054
055    public String getAction() {
056        return this.action;
057    }
058
059    /**
060     *  <p><code>id</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p>
061     */
062
063    public String getLineItemId() {
064        return this.lineItemId;
065    }
066
067    /**
068     *  <p><code>key</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p>
069     */
070
071    public String getLineItemKey() {
072        return this.lineItemKey;
073    }
074
075    /**
076     *  <p>Value to set. If <code>externalTotalPrice</code> is not given and the <code>priceMode</code> is <code>ExternalTotal</code>, the external price is unset and the <code>priceMode</code> is set to <code>Platform</code>.</p>
077     */
078
079    public com.commercetools.api.models.cart.ExternalLineItemTotalPrice getExternalTotalPrice() {
080        return this.externalTotalPrice;
081    }
082
083    public void setLineItemId(final String lineItemId) {
084        this.lineItemId = lineItemId;
085    }
086
087    public void setLineItemKey(final String lineItemKey) {
088        this.lineItemKey = lineItemKey;
089    }
090
091    public void setExternalTotalPrice(
092            final com.commercetools.api.models.cart.ExternalLineItemTotalPrice externalTotalPrice) {
093        this.externalTotalPrice = externalTotalPrice;
094    }
095
096    @Override
097    public boolean equals(Object o) {
098        if (this == o)
099            return true;
100
101        if (o == null || getClass() != o.getClass())
102            return false;
103
104        CartSetLineItemTotalPriceActionImpl that = (CartSetLineItemTotalPriceActionImpl) o;
105
106        return new EqualsBuilder().append(action, that.action)
107                .append(lineItemId, that.lineItemId)
108                .append(lineItemKey, that.lineItemKey)
109                .append(externalTotalPrice, that.externalTotalPrice)
110                .isEquals();
111    }
112
113    @Override
114    public int hashCode() {
115        return new HashCodeBuilder(17, 37).append(action)
116                .append(lineItemId)
117                .append(lineItemKey)
118                .append(externalTotalPrice)
119                .toHashCode();
120    }
121
122}