001
002package com.commercetools.ml.models.common;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.validation.Valid;
009import javax.validation.constraints.NotNull;
010
011import com.fasterxml.jackson.annotation.*;
012import com.fasterxml.jackson.databind.annotation.*;
013
014import io.vrap.rmf.base.client.utils.Generated;
015
016/**
017 *  <p>The product variant that contains the image.</p>
018 *
019 * <hr>
020 * Example to create an instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     ProductVariant productVariant = ProductVariant.builder()
024 *             .product(productBuilder -> productBuilder)
025 *             .staged(true)
026 *             .variantId(0.3)
027 *             .build()
028 * </code></pre>
029 * </div>
030 */
031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
032@JsonDeserialize(as = ProductVariantImpl.class)
033public interface ProductVariant {
034
035    /**
036     *  <p>The product that contains this variant.</p>
037     */
038    @NotNull
039    @Valid
040    @JsonProperty("product")
041    public ProductReference getProduct();
042
043    /**
044     *  <p>The state of the product variant.</p>
045     */
046    @NotNull
047    @JsonProperty("staged")
048    public Boolean getStaged();
049
050    /**
051     *  <p>The id of the product variant.</p>
052     */
053    @NotNull
054    @JsonProperty("variantId")
055    public Integer getVariantId();
056
057    public void setProduct(final ProductReference product);
058
059    public void setStaged(final Boolean staged);
060
061    public void setVariantId(final Integer variantId);
062
063    public static ProductVariant of() {
064        return new ProductVariantImpl();
065    }
066
067    public static ProductVariant of(final ProductVariant template) {
068        ProductVariantImpl instance = new ProductVariantImpl();
069        instance.setProduct(template.getProduct());
070        instance.setStaged(template.getStaged());
071        instance.setVariantId(template.getVariantId());
072        return instance;
073    }
074
075    public static ProductVariantBuilder builder() {
076        return ProductVariantBuilder.of();
077    }
078
079    public static ProductVariantBuilder builder(final ProductVariant template) {
080        return ProductVariantBuilder.of(template);
081    }
082
083    default <T> T withProductVariant(Function<ProductVariant, T> helper) {
084        return helper.apply(this);
085    }
086
087    public static com.fasterxml.jackson.core.type.TypeReference<ProductVariant> typeReference() {
088        return new com.fasterxml.jackson.core.type.TypeReference<ProductVariant>() {
089            @Override
090            public String toString() {
091                return "TypeReference<ProductVariant>";
092            }
093        };
094    }
095}