001 002package com.commercetools.api.models.me; 003 004import java.time.*; 005import java.time.LocalDate; 006import java.util.*; 007import java.util.function.Function; 008import java.util.stream.Collectors; 009 010import javax.annotation.Nullable; 011import javax.validation.Valid; 012import javax.validation.constraints.NotNull; 013 014import com.commercetools.api.models.common.BaseAddress; 015import com.commercetools.api.models.store.StoreResourceIdentifier; 016import com.commercetools.api.models.type.CustomFieldsDraft; 017import com.fasterxml.jackson.annotation.*; 018import com.fasterxml.jackson.databind.annotation.*; 019 020import io.vrap.rmf.base.client.utils.Generated; 021 022/** 023 * MyCustomerDraft 024 * 025 * <hr> 026 * Example to create an instance using the builder pattern 027 * <div class=code-example> 028 * <pre><code class='java'> 029 * MyCustomerDraft myCustomerDraft = MyCustomerDraft.builder() 030 * .email("{email}") 031 * .password("{password}") 032 * .build() 033 * </code></pre> 034 * </div> 035 */ 036@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 037@JsonDeserialize(as = MyCustomerDraftImpl.class) 038public interface MyCustomerDraft extends com.commercetools.api.models.CustomizableDraft<MyCustomerDraft>, 039 io.vrap.rmf.base.client.Draft<MyCustomerDraft> { 040 041 /** 042 * <p>Email address of the Customer that is unique for an entire Project or Store the Customer is assigned to. It is the mandatory unique identifier of a Customer.</p> 043 * @return email 044 */ 045 @NotNull 046 @JsonProperty("email") 047 public String getEmail(); 048 049 /** 050 * <p>Password of the Customer.</p> 051 * @return password 052 */ 053 @NotNull 054 @JsonProperty("password") 055 public String getPassword(); 056 057 /** 058 * <p>Given name (first name) of the Customer.</p> 059 * @return firstName 060 */ 061 062 @JsonProperty("firstName") 063 public String getFirstName(); 064 065 /** 066 * <p>Family name (last name) of the Customer.</p> 067 * @return lastName 068 */ 069 070 @JsonProperty("lastName") 071 public String getLastName(); 072 073 /** 074 * <p>Middle name of the Customer.</p> 075 * @return middleName 076 */ 077 078 @JsonProperty("middleName") 079 public String getMiddleName(); 080 081 /** 082 * <p>Title of the Customer, for example, 'Dr.'.</p> 083 * @return title 084 */ 085 086 @JsonProperty("title") 087 public String getTitle(); 088 089 /** 090 * <p>Salutation of the Customer, for example, 'Mr.' or 'Mrs.'.</p> 091 * @return salutation 092 */ 093 094 @JsonProperty("salutation") 095 public String getSalutation(); 096 097 /** 098 * <p>Date of birth of the Customer.</p> 099 * @return dateOfBirth 100 */ 101 102 @JsonProperty("dateOfBirth") 103 public LocalDate getDateOfBirth(); 104 105 /** 106 * <p>Company name of the Customer.</p> 107 * @return companyName 108 */ 109 110 @JsonProperty("companyName") 111 public String getCompanyName(); 112 113 /** 114 * <p>Individual VAT ID of the Customer.</p> 115 * @return vatId 116 */ 117 118 @JsonProperty("vatId") 119 public String getVatId(); 120 121 /** 122 * <p>Addresses of the Customer.</p> 123 * @return addresses 124 */ 125 @Valid 126 @JsonProperty("addresses") 127 public List<BaseAddress> getAddresses(); 128 129 /** 130 * <p>Index of the address in the <code>addresses</code> array to use as the default shipping address. The <code>defaultShippingAddressId</code> of the Customer will be set to the <code>id</code> of that address.</p> 131 * @return defaultShippingAddress 132 */ 133 134 @JsonProperty("defaultShippingAddress") 135 public Long getDefaultShippingAddress(); 136 137 /** 138 * <p>Index of the address in the <code>addresses</code> array to use as the default billing address. The <code>defaultBillingAddressId</code> of the Customer will be set to the <code>id</code> of that address.</p> 139 * @return defaultBillingAddress 140 */ 141 142 @JsonProperty("defaultBillingAddress") 143 public Long getDefaultBillingAddress(); 144 145 /** 146 * <p>Custom Fields for the Customer.</p> 147 * @return custom 148 */ 149 @Valid 150 @JsonProperty("custom") 151 public CustomFieldsDraft getCustom(); 152 153 /** 154 * <p>Preferred language of the Customer. Must be one of the languages supported by the Project.</p> 155 * @return locale 156 */ 157 158 @JsonProperty("locale") 159 public String getLocale(); 160 161 /** 162 * <p>Sets the Stores for the Customer.</p> 163 * @return stores 164 */ 165 @Valid 166 @JsonProperty("stores") 167 public List<StoreResourceIdentifier> getStores(); 168 169 /** 170 * <p>Email address of the Customer that is unique for an entire Project or Store the Customer is assigned to. It is the mandatory unique identifier of a Customer.</p> 171 * @param email value to be set 172 */ 173 174 public void setEmail(final String email); 175 176 /** 177 * <p>Password of the Customer.</p> 178 * @param password value to be set 179 */ 180 181 public void setPassword(final String password); 182 183 /** 184 * <p>Given name (first name) of the Customer.</p> 185 * @param firstName value to be set 186 */ 187 188 public void setFirstName(final String firstName); 189 190 /** 191 * <p>Family name (last name) of the Customer.</p> 192 * @param lastName value to be set 193 */ 194 195 public void setLastName(final String lastName); 196 197 /** 198 * <p>Middle name of the Customer.</p> 199 * @param middleName value to be set 200 */ 201 202 public void setMiddleName(final String middleName); 203 204 /** 205 * <p>Title of the Customer, for example, 'Dr.'.</p> 206 * @param title value to be set 207 */ 208 209 public void setTitle(final String title); 210 211 /** 212 * <p>Salutation of the Customer, for example, 'Mr.' or 'Mrs.'.</p> 213 * @param salutation value to be set 214 */ 215 216 public void setSalutation(final String salutation); 217 218 /** 219 * <p>Date of birth of the Customer.</p> 220 * @param dateOfBirth value to be set 221 */ 222 223 public void setDateOfBirth(final LocalDate dateOfBirth); 224 225 /** 226 * <p>Company name of the Customer.</p> 227 * @param companyName value to be set 228 */ 229 230 public void setCompanyName(final String companyName); 231 232 /** 233 * <p>Individual VAT ID of the Customer.</p> 234 * @param vatId value to be set 235 */ 236 237 public void setVatId(final String vatId); 238 239 /** 240 * <p>Addresses of the Customer.</p> 241 * @param addresses values to be set 242 */ 243 244 @JsonIgnore 245 public void setAddresses(final BaseAddress... addresses); 246 247 /** 248 * <p>Addresses of the Customer.</p> 249 * @param addresses values to be set 250 */ 251 252 public void setAddresses(final List<BaseAddress> addresses); 253 254 /** 255 * <p>Index of the address in the <code>addresses</code> array to use as the default shipping address. The <code>defaultShippingAddressId</code> of the Customer will be set to the <code>id</code> of that address.</p> 256 * @param defaultShippingAddress value to be set 257 */ 258 259 public void setDefaultShippingAddress(final Long defaultShippingAddress); 260 261 /** 262 * <p>Index of the address in the <code>addresses</code> array to use as the default billing address. The <code>defaultBillingAddressId</code> of the Customer will be set to the <code>id</code> of that address.</p> 263 * @param defaultBillingAddress value to be set 264 */ 265 266 public void setDefaultBillingAddress(final Long defaultBillingAddress); 267 268 /** 269 * <p>Custom Fields for the Customer.</p> 270 * @param custom value to be set 271 */ 272 273 public void setCustom(final CustomFieldsDraft custom); 274 275 /** 276 * <p>Preferred language of the Customer. Must be one of the languages supported by the Project.</p> 277 * @param locale value to be set 278 */ 279 280 public void setLocale(final String locale); 281 282 /** 283 * <p>Sets the Stores for the Customer.</p> 284 * @param stores values to be set 285 */ 286 287 @JsonIgnore 288 public void setStores(final StoreResourceIdentifier... stores); 289 290 /** 291 * <p>Sets the Stores for the Customer.</p> 292 * @param stores values to be set 293 */ 294 295 public void setStores(final List<StoreResourceIdentifier> stores); 296 297 /** 298 * factory method 299 * @return instance of MyCustomerDraft 300 */ 301 public static MyCustomerDraft of() { 302 return new MyCustomerDraftImpl(); 303 } 304 305 /** 306 * factory method to create a shallow copy MyCustomerDraft 307 * @param template instance to be copied 308 * @return copy instance 309 */ 310 public static MyCustomerDraft of(final MyCustomerDraft template) { 311 MyCustomerDraftImpl instance = new MyCustomerDraftImpl(); 312 instance.setEmail(template.getEmail()); 313 instance.setPassword(template.getPassword()); 314 instance.setFirstName(template.getFirstName()); 315 instance.setLastName(template.getLastName()); 316 instance.setMiddleName(template.getMiddleName()); 317 instance.setTitle(template.getTitle()); 318 instance.setSalutation(template.getSalutation()); 319 instance.setDateOfBirth(template.getDateOfBirth()); 320 instance.setCompanyName(template.getCompanyName()); 321 instance.setVatId(template.getVatId()); 322 instance.setAddresses(template.getAddresses()); 323 instance.setDefaultShippingAddress(template.getDefaultShippingAddress()); 324 instance.setDefaultBillingAddress(template.getDefaultBillingAddress()); 325 instance.setCustom(template.getCustom()); 326 instance.setLocale(template.getLocale()); 327 instance.setStores(template.getStores()); 328 return instance; 329 } 330 331 /** 332 * factory method to create a deep copy of MyCustomerDraft 333 * @param template instance to be copied 334 * @return copy instance 335 */ 336 @Nullable 337 public static MyCustomerDraft deepCopy(@Nullable final MyCustomerDraft template) { 338 if (template == null) { 339 return null; 340 } 341 MyCustomerDraftImpl instance = new MyCustomerDraftImpl(); 342 instance.setEmail(template.getEmail()); 343 instance.setPassword(template.getPassword()); 344 instance.setFirstName(template.getFirstName()); 345 instance.setLastName(template.getLastName()); 346 instance.setMiddleName(template.getMiddleName()); 347 instance.setTitle(template.getTitle()); 348 instance.setSalutation(template.getSalutation()); 349 instance.setDateOfBirth(template.getDateOfBirth()); 350 instance.setCompanyName(template.getCompanyName()); 351 instance.setVatId(template.getVatId()); 352 instance.setAddresses(Optional.ofNullable(template.getAddresses()) 353 .map(t -> t.stream() 354 .map(com.commercetools.api.models.common.BaseAddress::deepCopy) 355 .collect(Collectors.toList())) 356 .orElse(null)); 357 instance.setDefaultShippingAddress(template.getDefaultShippingAddress()); 358 instance.setDefaultBillingAddress(template.getDefaultBillingAddress()); 359 instance.setCustom(com.commercetools.api.models.type.CustomFieldsDraft.deepCopy(template.getCustom())); 360 instance.setLocale(template.getLocale()); 361 instance.setStores(Optional.ofNullable(template.getStores()) 362 .map(t -> t.stream() 363 .map(com.commercetools.api.models.store.StoreResourceIdentifier::deepCopy) 364 .collect(Collectors.toList())) 365 .orElse(null)); 366 return instance; 367 } 368 369 /** 370 * builder factory method for MyCustomerDraft 371 * @return builder 372 */ 373 public static MyCustomerDraftBuilder builder() { 374 return MyCustomerDraftBuilder.of(); 375 } 376 377 /** 378 * create builder for MyCustomerDraft instance 379 * @param template instance with prefilled values for the builder 380 * @return builder 381 */ 382 public static MyCustomerDraftBuilder builder(final MyCustomerDraft template) { 383 return MyCustomerDraftBuilder.of(template); 384 } 385 386 /** 387 * accessor map function 388 * @param <T> mapped type 389 * @param helper function to map the object 390 * @return mapped value 391 */ 392 default <T> T withMyCustomerDraft(Function<MyCustomerDraft, T> helper) { 393 return helper.apply(this); 394 } 395 396 /** 397 * gives a TypeReference for usage with Jackson DataBind 398 * @return TypeReference 399 */ 400 public static com.fasterxml.jackson.core.type.TypeReference<MyCustomerDraft> typeReference() { 401 return new com.fasterxml.jackson.core.type.TypeReference<MyCustomerDraft>() { 402 @Override 403 public String toString() { 404 return "TypeReference<MyCustomerDraft>"; 405 } 406 }; 407 } 408}