001
002package com.commercetools.ml.models.image_search;
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.commercetools.ml.models.common.ProductVariant;
012import com.fasterxml.jackson.annotation.*;
013import com.fasterxml.jackson.databind.annotation.*;
014
015import io.vrap.rmf.base.client.utils.Generated;
016
017/**
018 *  <p>An image URL and the product variants it is contained in. If no matching images are found, ResultItem is not present.</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 *     ResultItem resultItem = ResultItem.builder()
025 *             .imageUrl("{imageUrl}")
026 *             .plusProductVariants(productVariantsBuilder -> productVariantsBuilder)
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 = ResultItemImpl.class)
033public interface ResultItem {
034
035    /**
036     *  <p>The URL of the image.</p>
037     */
038    @NotNull
039    @JsonProperty("imageUrl")
040    public String getImageUrl();
041
042    /**
043     *  <p>An array of product variants containing the image URL.</p>
044     */
045    @NotNull
046    @Valid
047    @JsonProperty("productVariants")
048    public List<ProductVariant> getProductVariants();
049
050    public void setImageUrl(final String imageUrl);
051
052    @JsonIgnore
053    public void setProductVariants(final ProductVariant... productVariants);
054
055    public void setProductVariants(final List<ProductVariant> productVariants);
056
057    public static ResultItem of() {
058        return new ResultItemImpl();
059    }
060
061    public static ResultItem of(final ResultItem template) {
062        ResultItemImpl instance = new ResultItemImpl();
063        instance.setImageUrl(template.getImageUrl());
064        instance.setProductVariants(template.getProductVariants());
065        return instance;
066    }
067
068    public static ResultItemBuilder builder() {
069        return ResultItemBuilder.of();
070    }
071
072    public static ResultItemBuilder builder(final ResultItem template) {
073        return ResultItemBuilder.of(template);
074    }
075
076    default <T> T withResultItem(Function<ResultItem, T> helper) {
077        return helper.apply(this);
078    }
079
080    public static com.fasterxml.jackson.core.type.TypeReference<ResultItem> typeReference() {
081        return new com.fasterxml.jackson.core.type.TypeReference<ResultItem>() {
082            @Override
083            public String toString() {
084                return "TypeReference<ResultItem>";
085            }
086        };
087    }
088}