001 002package com.commercetools.importapi.models.common; 003 004import java.util.Arrays; 005import java.util.Optional; 006 007import com.fasterxml.jackson.annotation.JsonCreator; 008import com.fasterxml.jackson.annotation.JsonValue; 009 010import io.vrap.rmf.base.client.JsonEnum; 011import io.vrap.rmf.base.client.utils.Generated; 012 013/** 014 * <p>The type of the referenced resource.</p> 015 */ 016@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 017public interface ReferenceType extends JsonEnum { 018 019 /** 020 <p>References a cart.</p> 021 022 */ 023 ReferenceType CART = ReferenceTypeEnum.CART; 024 /** 025 <p>References a cart discount.</p> 026 027 */ 028 ReferenceType CART_DISCOUNT = ReferenceTypeEnum.CART_DISCOUNT; 029 /** 030 <p>References a category.</p> 031 032 */ 033 ReferenceType CATEGORY = ReferenceTypeEnum.CATEGORY; 034 /** 035 <p>References a channel.</p> 036 037 */ 038 ReferenceType CHANNEL = ReferenceTypeEnum.CHANNEL; 039 /** 040 <p>References a customer.</p> 041 042 */ 043 ReferenceType CUSTOMER = ReferenceTypeEnum.CUSTOMER; 044 /** 045 <p>References a customer group.</p> 046 047 */ 048 ReferenceType CUSTOMER_GROUP = ReferenceTypeEnum.CUSTOMER_GROUP; 049 /** 050 <p>References a discount code.</p> 051 052 */ 053 ReferenceType DISCOUNT_CODE = ReferenceTypeEnum.DISCOUNT_CODE; 054 /** 055 <p>References an order.</p> 056 057 */ 058 ReferenceType ORDER = ReferenceTypeEnum.ORDER; 059 /** 060 <p>References a payment</p> 061 062 */ 063 ReferenceType PAYMENT = ReferenceTypeEnum.PAYMENT; 064 /** 065 <p>References a price.</p> 066 067 */ 068 ReferenceType PRICE = ReferenceTypeEnum.PRICE; 069 /** 070 <p>References a product.</p> 071 072 */ 073 ReferenceType PRODUCT = ReferenceTypeEnum.PRODUCT; 074 /** 075 <p>References a product discount.</p> 076 077 */ 078 ReferenceType PRODUCT_DISCOUNT = ReferenceTypeEnum.PRODUCT_DISCOUNT; 079 /** 080 <p>References a product type.</p> 081 082 */ 083 ReferenceType PRODUCT_TYPE = ReferenceTypeEnum.PRODUCT_TYPE; 084 /** 085 <p>References a product variant.</p> 086 087 */ 088 ReferenceType PRODUCT_VARIANT = ReferenceTypeEnum.PRODUCT_VARIANT; 089 /** 090 <p>References a shipping method.</p> 091 092 */ 093 ReferenceType SHIPPING_METHOD = ReferenceTypeEnum.SHIPPING_METHOD; 094 /** 095 <p>References a state.</p> 096 097 */ 098 ReferenceType STATE = ReferenceTypeEnum.STATE; 099 /** 100 <p>References a store.</p> 101 102 */ 103 ReferenceType STORE = ReferenceTypeEnum.STORE; 104 /** 105 <p>References a tax-category.</p> 106 107 */ 108 ReferenceType TAX_CATEGORY = ReferenceTypeEnum.TAX_CATEGORY; 109 /** 110 <p>References a type.</p> 111 112 */ 113 ReferenceType TYPE = ReferenceTypeEnum.TYPE; 114 /** 115 <p>References a custom object</p> 116 117 */ 118 ReferenceType KEY_VALUE_DOCUMENT = ReferenceTypeEnum.KEY_VALUE_DOCUMENT; 119 120 /** 121 * possible values of ReferenceType 122 */ 123 enum ReferenceTypeEnum implements ReferenceType { 124 /** 125 * cart 126 */ 127 CART("cart"), 128 129 /** 130 * cart-discount 131 */ 132 CART_DISCOUNT("cart-discount"), 133 134 /** 135 * category 136 */ 137 CATEGORY("category"), 138 139 /** 140 * channel 141 */ 142 CHANNEL("channel"), 143 144 /** 145 * customer 146 */ 147 CUSTOMER("customer"), 148 149 /** 150 * customer-group 151 */ 152 CUSTOMER_GROUP("customer-group"), 153 154 /** 155 * discount-code 156 */ 157 DISCOUNT_CODE("discount-code"), 158 159 /** 160 * order 161 */ 162 ORDER("order"), 163 164 /** 165 * payment 166 */ 167 PAYMENT("payment"), 168 169 /** 170 * price 171 */ 172 PRICE("price"), 173 174 /** 175 * product 176 */ 177 PRODUCT("product"), 178 179 /** 180 * product-discount 181 */ 182 PRODUCT_DISCOUNT("product-discount"), 183 184 /** 185 * product-type 186 */ 187 PRODUCT_TYPE("product-type"), 188 189 /** 190 * product-variant 191 */ 192 PRODUCT_VARIANT("product-variant"), 193 194 /** 195 * shipping-method 196 */ 197 SHIPPING_METHOD("shipping-method"), 198 199 /** 200 * state 201 */ 202 STATE("state"), 203 204 /** 205 * store 206 */ 207 STORE("store"), 208 209 /** 210 * tax-category 211 */ 212 TAX_CATEGORY("tax-category"), 213 214 /** 215 * type 216 */ 217 TYPE("type"), 218 219 /** 220 * key-value-document 221 */ 222 KEY_VALUE_DOCUMENT("key-value-document"); 223 private final String jsonName; 224 225 private ReferenceTypeEnum(final String jsonName) { 226 this.jsonName = jsonName; 227 } 228 229 public String getJsonName() { 230 return jsonName; 231 } 232 233 public String toString() { 234 return jsonName; 235 } 236 } 237 238 /** 239 * the JSON value 240 * @return json value 241 */ 242 @JsonValue 243 String getJsonName(); 244 245 /** 246 * the enum value 247 * @return name 248 */ 249 String name(); 250 251 /** 252 * convert value to string 253 * @return string representation 254 */ 255 String toString(); 256 257 /** 258 * factory method for a enum value of ReferenceType 259 * if no enum has been found an anonymous instance will be created 260 * @param value the enum value to be wrapped 261 * @return enum instance 262 */ 263 @JsonCreator 264 public static ReferenceType findEnum(String value) { 265 return findEnumViaJsonName(value).orElse(new ReferenceType() { 266 @Override 267 public String getJsonName() { 268 return value; 269 } 270 271 @Override 272 public String name() { 273 return value.toUpperCase(); 274 } 275 276 public String toString() { 277 return value; 278 } 279 }); 280 } 281 282 /** 283 * method to find enum using the JSON value 284 * @param jsonName the json value to be wrapped 285 * @return optional of enum instance 286 */ 287 public static Optional<ReferenceType> findEnumViaJsonName(String jsonName) { 288 return Arrays.stream(values()).filter(t -> t.getJsonName().equals(jsonName)).findFirst(); 289 } 290 291 /** 292 * possible enum values 293 * @return array of possible enum values 294 */ 295 public static ReferenceType[] values() { 296 return ReferenceTypeEnum.values(); 297 } 298 299}