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>This action sets, overwrites, or removes any existing Custom Type and Custom Fields for the Cart's <code>shippingMethod</code> or <code>shipping</code>.</p>
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class CartSetShippingCustomTypeActionImpl implements CartSetShippingCustomTypeAction, ModelBase {
022
023    private String action;
024
025    private String shippingKey;
026
027    private com.commercetools.api.models.type.TypeResourceIdentifier type;
028
029    private com.commercetools.api.models.type.FieldContainer fields;
030
031    /**
032     * create instance with all properties
033     */
034    @JsonCreator
035    CartSetShippingCustomTypeActionImpl(@JsonProperty("shippingKey") final String shippingKey,
036            @JsonProperty("type") final com.commercetools.api.models.type.TypeResourceIdentifier type,
037            @JsonProperty("fields") final com.commercetools.api.models.type.FieldContainer fields) {
038        this.shippingKey = shippingKey;
039        this.type = type;
040        this.fields = fields;
041        this.action = SET_SHIPPING_CUSTOM_TYPE;
042    }
043
044    /**
045     * create empty instance
046     */
047    public CartSetShippingCustomTypeActionImpl() {
048        this.action = SET_SHIPPING_CUSTOM_TYPE;
049    }
050
051    /**
052     *
053     */
054
055    public String getAction() {
056        return this.action;
057    }
058
059    /**
060     *  <p>The <code>shippingKey</code> of the Shipping to customize. Used to specify which Shipping Method to customize on a Cart with <code>Multiple</code> ShippingMode. Leave this empty to customize the one and only ShippingMethod on a <code>Single</code> ShippingMode Cart.</p>
061     */
062
063    public String getShippingKey() {
064        return this.shippingKey;
065    }
066
067    /**
068     *  <p>Defines the Type that extends the specified ShippingMethod with Custom Fields. If absent, any existing Type and Custom Fields are removed from the ShippingMethod.</p>
069     */
070
071    public com.commercetools.api.models.type.TypeResourceIdentifier getType() {
072        return this.type;
073    }
074
075    /**
076     *  <p>Sets the Custom Fields fields for the <code>shippingMethod</code>.</p>
077     */
078
079    public com.commercetools.api.models.type.FieldContainer getFields() {
080        return this.fields;
081    }
082
083    public void setShippingKey(final String shippingKey) {
084        this.shippingKey = shippingKey;
085    }
086
087    public void setType(final com.commercetools.api.models.type.TypeResourceIdentifier type) {
088        this.type = type;
089    }
090
091    public void setFields(final com.commercetools.api.models.type.FieldContainer fields) {
092        this.fields = fields;
093    }
094
095    @Override
096    public boolean equals(Object o) {
097        if (this == o)
098            return true;
099
100        if (o == null || getClass() != o.getClass())
101            return false;
102
103        CartSetShippingCustomTypeActionImpl that = (CartSetShippingCustomTypeActionImpl) o;
104
105        return new EqualsBuilder().append(action, that.action)
106                .append(shippingKey, that.shippingKey)
107                .append(type, that.type)
108                .append(fields, that.fields)
109                .append(action, that.action)
110                .append(shippingKey, that.shippingKey)
111                .append(type, that.type)
112                .append(fields, that.fields)
113                .isEquals();
114    }
115
116    @Override
117    public int hashCode() {
118        return new HashCodeBuilder(17, 37).append(action).append(shippingKey).append(type).append(fields).toHashCode();
119    }
120
121}