001
002package com.commercetools.ml.models.similar_products;
003
004import java.util.*;
005import java.util.function.Function;
006
007import javax.annotation.Nullable;
008
009import io.vrap.rmf.base.client.Builder;
010import io.vrap.rmf.base.client.utils.Generated;
011
012/**
013 * SimilarProductBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     SimilarProduct similarProduct = SimilarProduct.builder()
019 *             .build()
020 * </code></pre>
021 * </div>
022 */
023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
024public class SimilarProductBuilder implements Builder<SimilarProduct> {
025
026    @Nullable
027    private com.commercetools.ml.models.common.ProductReference product;
028
029    @Nullable
030    private Long variantId;
031
032    @Nullable
033    private com.commercetools.ml.models.similar_products.SimilarProductMeta meta;
034
035    /**
036     *  <p>Reference to Product</p>
037     */
038
039    public SimilarProductBuilder product(
040            Function<com.commercetools.ml.models.common.ProductReferenceBuilder, com.commercetools.ml.models.common.ProductReferenceBuilder> builder) {
041        this.product = builder.apply(com.commercetools.ml.models.common.ProductReferenceBuilder.of()).build();
042        return this;
043    }
044
045    /**
046     *  <p>Reference to Product</p>
047     */
048
049    public SimilarProductBuilder product(@Nullable final com.commercetools.ml.models.common.ProductReference product) {
050        this.product = product;
051        return this;
052    }
053
054    /**
055     *  <p>ID of the ProductVariant that was compared.</p>
056     */
057
058    public SimilarProductBuilder variantId(@Nullable final Long variantId) {
059        this.variantId = variantId;
060        return this;
061    }
062
063    /**
064     *  <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>
065     */
066
067    public SimilarProductBuilder meta(
068            Function<com.commercetools.ml.models.similar_products.SimilarProductMetaBuilder, com.commercetools.ml.models.similar_products.SimilarProductMetaBuilder> builder) {
069        this.meta = builder.apply(com.commercetools.ml.models.similar_products.SimilarProductMetaBuilder.of()).build();
070        return this;
071    }
072
073    /**
074     *  <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>
075     */
076
077    public SimilarProductBuilder meta(
078            @Nullable final com.commercetools.ml.models.similar_products.SimilarProductMeta meta) {
079        this.meta = meta;
080        return this;
081    }
082
083    @Nullable
084    public com.commercetools.ml.models.common.ProductReference getProduct() {
085        return this.product;
086    }
087
088    @Nullable
089    public Long getVariantId() {
090        return this.variantId;
091    }
092
093    @Nullable
094    public com.commercetools.ml.models.similar_products.SimilarProductMeta getMeta() {
095        return this.meta;
096    }
097
098    public SimilarProduct build() {
099        return new SimilarProductImpl(product, variantId, meta);
100    }
101
102    /**
103     * builds SimilarProduct without checking for non null required values
104     */
105    public SimilarProduct buildUnchecked() {
106        return new SimilarProductImpl(product, variantId, meta);
107    }
108
109    public static SimilarProductBuilder of() {
110        return new SimilarProductBuilder();
111    }
112
113    public static SimilarProductBuilder of(final SimilarProduct template) {
114        SimilarProductBuilder builder = new SimilarProductBuilder();
115        builder.product = template.getProduct();
116        builder.variantId = template.getVariantId();
117        builder.meta = template.getMeta();
118        return builder;
119    }
120
121}