001
002package com.commercetools.ml.models.similar_products;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.Valid;
010
011import com.commercetools.ml.models.common.ProductReference;
012import com.fasterxml.jackson.annotation.*;
013import com.fasterxml.jackson.databind.annotation.*;
014
015import io.vrap.rmf.base.client.utils.Generated;
016
017/**
018 *  <p>One part of a SimilarProductPair. Refers to a specific ProductVariant.</p>
019 *
020 * <hr>
021 * Example to create an instance using the builder pattern
022 * <div class=code-example>
023 * <pre><code class='java'>
024 *     SimilarProduct similarProduct = SimilarProduct.builder()
025 *             .build()
026 * </code></pre>
027 * </div>
028 */
029@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
030@JsonDeserialize(as = SimilarProductImpl.class)
031public interface SimilarProduct {
032
033    /**
034     *  <p>Reference to Product</p>
035     * @return product
036     */
037    @Valid
038    @JsonProperty("product")
039    public ProductReference getProduct();
040
041    /**
042     *  <p>ID of the ProductVariant that was compared.</p>
043     * @return variantId
044     */
045
046    @JsonProperty("variantId")
047    public Long getVariantId();
048
049    /**
050     *  <p>Supplementary information about the data used for similarity estimation. This information helps you understand the estimated confidence score, but it should not be used to identify a product.</p>
051     * @return meta
052     */
053    @Valid
054    @JsonProperty("meta")
055    public SimilarProductMeta getMeta();
056
057    /**
058     *  <p>Reference to Product</p>
059     * @param product value to be set
060     */
061
062    public void setProduct(final ProductReference product);
063
064    /**
065     *  <p>ID of the ProductVariant that was compared.</p>
066     * @param variantId value to be set
067     */
068
069    public void setVariantId(final Long variantId);
070
071    /**
072     *  <p>Supplementary information about the data used for similarity estimation. This information helps you understand the estimated confidence score, but it should not be used to identify a product.</p>
073     * @param meta value to be set
074     */
075
076    public void setMeta(final SimilarProductMeta meta);
077
078    /**
079     * factory method
080     * @return instance of SimilarProduct
081     */
082    public static SimilarProduct of() {
083        return new SimilarProductImpl();
084    }
085
086    /**
087     * factory method to create a shallow copy SimilarProduct
088     * @param template instance to be copied
089     * @return copy instance
090     */
091    public static SimilarProduct of(final SimilarProduct template) {
092        SimilarProductImpl instance = new SimilarProductImpl();
093        instance.setProduct(template.getProduct());
094        instance.setVariantId(template.getVariantId());
095        instance.setMeta(template.getMeta());
096        return instance;
097    }
098
099    /**
100     * factory method to create a deep copy of SimilarProduct
101     * @param template instance to be copied
102     * @return copy instance
103     */
104    @Nullable
105    public static SimilarProduct deepCopy(@Nullable final SimilarProduct template) {
106        if (template == null) {
107            return null;
108        }
109        SimilarProductImpl instance = new SimilarProductImpl();
110        instance.setProduct(com.commercetools.ml.models.common.ProductReference.deepCopy(template.getProduct()));
111        instance.setVariantId(template.getVariantId());
112        instance.setMeta(com.commercetools.ml.models.similar_products.SimilarProductMeta.deepCopy(template.getMeta()));
113        return instance;
114    }
115
116    /**
117     * builder factory method for SimilarProduct
118     * @return builder
119     */
120    public static SimilarProductBuilder builder() {
121        return SimilarProductBuilder.of();
122    }
123
124    /**
125     * create builder for SimilarProduct instance
126     * @param template instance with prefilled values for the builder
127     * @return builder
128     */
129    public static SimilarProductBuilder builder(final SimilarProduct template) {
130        return SimilarProductBuilder.of(template);
131    }
132
133    /**
134     * accessor map function
135     * @param <T> mapped type
136     * @param helper function to map the object
137     * @return mapped value
138     */
139    default <T> T withSimilarProduct(Function<SimilarProduct, T> helper) {
140        return helper.apply(this);
141    }
142
143    /**
144     * gives a TypeReference for usage with Jackson DataBind
145     * @return TypeReference
146     */
147    public static com.fasterxml.jackson.core.type.TypeReference<SimilarProduct> typeReference() {
148        return new com.fasterxml.jackson.core.type.TypeReference<SimilarProduct>() {
149            @Override
150            public String toString() {
151                return "TypeReference<SimilarProduct>";
152            }
153        };
154    }
155}