001 002package com.commercetools.ml.models.category_recommendations; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009import javax.validation.Valid; 010import javax.validation.constraints.NotNull; 011 012import com.commercetools.ml.models.common.CategoryReference; 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * ProjectCategoryRecommendation 020 * 021 * <hr> 022 * Example to create an instance using the builder pattern 023 * <div class=code-example> 024 * <pre><code class='java'> 025 * ProjectCategoryRecommendation projectCategoryRecommendation = ProjectCategoryRecommendation.builder() 026 * .category(categoryBuilder -> categoryBuilder) 027 * .confidence(0.3) 028 * .path("{path}") 029 * .build() 030 * </code></pre> 031 * </div> 032 */ 033@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 034@JsonDeserialize(as = ProjectCategoryRecommendationImpl.class) 035public interface ProjectCategoryRecommendation { 036 037 /** 038 * <p>A category that is recommended for a product.</p> 039 * @return category 040 */ 041 @NotNull 042 @Valid 043 @JsonProperty("category") 044 public CategoryReference getCategory(); 045 046 /** 047 * <p>Probability score for the category recommendation.</p> 048 * @return confidence 049 */ 050 @NotNull 051 @JsonProperty("confidence") 052 public Double getConfidence(); 053 054 /** 055 * <p>Breadcrumb path to the recommended category. This only picks up one language, not all available languages for the category. English is prioritized, but if English data is not available, an arbitrary language is selected. Do not use this to identify a category,use the category ID from the category reference instead.</p> 056 * @return path 057 */ 058 @NotNull 059 @JsonProperty("path") 060 public String getPath(); 061 062 /** 063 * <p>A category that is recommended for a product.</p> 064 * @param category value to be set 065 */ 066 067 public void setCategory(final CategoryReference category); 068 069 /** 070 * <p>Probability score for the category recommendation.</p> 071 * @param confidence value to be set 072 */ 073 074 public void setConfidence(final Double confidence); 075 076 /** 077 * <p>Breadcrumb path to the recommended category. This only picks up one language, not all available languages for the category. English is prioritized, but if English data is not available, an arbitrary language is selected. Do not use this to identify a category,use the category ID from the category reference instead.</p> 078 * @param path value to be set 079 */ 080 081 public void setPath(final String path); 082 083 /** 084 * factory method 085 * @return instance of ProjectCategoryRecommendation 086 */ 087 public static ProjectCategoryRecommendation of() { 088 return new ProjectCategoryRecommendationImpl(); 089 } 090 091 /** 092 * factory method to create a shallow copy ProjectCategoryRecommendation 093 * @param template instance to be copied 094 * @return copy instance 095 */ 096 public static ProjectCategoryRecommendation of(final ProjectCategoryRecommendation template) { 097 ProjectCategoryRecommendationImpl instance = new ProjectCategoryRecommendationImpl(); 098 instance.setCategory(template.getCategory()); 099 instance.setConfidence(template.getConfidence()); 100 instance.setPath(template.getPath()); 101 return instance; 102 } 103 104 /** 105 * factory method to create a deep copy of ProjectCategoryRecommendation 106 * @param template instance to be copied 107 * @return copy instance 108 */ 109 @Nullable 110 public static ProjectCategoryRecommendation deepCopy(@Nullable final ProjectCategoryRecommendation template) { 111 if (template == null) { 112 return null; 113 } 114 ProjectCategoryRecommendationImpl instance = new ProjectCategoryRecommendationImpl(); 115 instance.setCategory(com.commercetools.ml.models.common.CategoryReference.deepCopy(template.getCategory())); 116 instance.setConfidence(template.getConfidence()); 117 instance.setPath(template.getPath()); 118 return instance; 119 } 120 121 /** 122 * builder factory method for ProjectCategoryRecommendation 123 * @return builder 124 */ 125 public static ProjectCategoryRecommendationBuilder builder() { 126 return ProjectCategoryRecommendationBuilder.of(); 127 } 128 129 /** 130 * create builder for ProjectCategoryRecommendation instance 131 * @param template instance with prefilled values for the builder 132 * @return builder 133 */ 134 public static ProjectCategoryRecommendationBuilder builder(final ProjectCategoryRecommendation template) { 135 return ProjectCategoryRecommendationBuilder.of(template); 136 } 137 138 /** 139 * accessor map function 140 * @param <T> mapped type 141 * @param helper function to map the object 142 * @return mapped value 143 */ 144 default <T> T withProjectCategoryRecommendation(Function<ProjectCategoryRecommendation, T> helper) { 145 return helper.apply(this); 146 } 147 148 /** 149 * gives a TypeReference for usage with Jackson DataBind 150 * @return TypeReference 151 */ 152 public static com.fasterxml.jackson.core.type.TypeReference<ProjectCategoryRecommendation> typeReference() { 153 return new com.fasterxml.jackson.core.type.TypeReference<ProjectCategoryRecommendation>() { 154 @Override 155 public String toString() { 156 return "TypeReference<ProjectCategoryRecommendation>"; 157 } 158 }; 159 } 160}