001
002package com.commercetools.api.models.product_selection;
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>Only Product Variants with explicitly stated SKUs are part of the Product Selection.</p>
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class ProductVariantSelectionIncludeOnlyImpl implements ProductVariantSelectionIncludeOnly, ModelBase {
022
023    private com.commercetools.api.models.product_selection.ProductVariantSelectionTypeEnum type;
024
025    private java.util.List<String> skus;
026
027    /**
028     * create instance with all properties
029     */
030    @JsonCreator
031    ProductVariantSelectionIncludeOnlyImpl(@JsonProperty("skus") final java.util.List<String> skus) {
032        this.skus = skus;
033        this.type = ProductVariantSelectionTypeEnum.findEnum("includeOnly");
034    }
035
036    /**
037     * create empty instance
038     */
039    public ProductVariantSelectionIncludeOnlyImpl() {
040        this.type = ProductVariantSelectionTypeEnum.findEnum("includeOnly");
041    }
042
043    /**
044     *
045     */
046
047    public com.commercetools.api.models.product_selection.ProductVariantSelectionTypeEnum getType() {
048        return this.type;
049    }
050
051    /**
052     *  <p>Non-empty array of SKUs representing Product Variants to be included into the Product Selection.</p>
053     */
054
055    public java.util.List<String> getSkus() {
056        return this.skus;
057    }
058
059    public void setSkus(final String... skus) {
060        this.skus = new ArrayList<>(Arrays.asList(skus));
061    }
062
063    public void setSkus(final java.util.List<String> skus) {
064        this.skus = skus;
065    }
066
067    @Override
068    public boolean equals(Object o) {
069        if (this == o)
070            return true;
071
072        if (o == null || getClass() != o.getClass())
073            return false;
074
075        ProductVariantSelectionIncludeOnlyImpl that = (ProductVariantSelectionIncludeOnlyImpl) o;
076
077        return new EqualsBuilder().append(type, that.type)
078                .append(skus, that.skus)
079                .append(type, that.type)
080                .append(skus, that.skus)
081                .isEquals();
082    }
083
084    @Override
085    public int hashCode() {
086        return new HashCodeBuilder(17, 37).append(type).append(skus).toHashCode();
087    }
088
089}