001 002package com.commercetools.importapi.models.orders; 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.importapi.models.common.DiscountCodeKeyReference; 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * DiscountCodeInfo 020 * 021 * <hr> 022 * Example to create an instance using the builder pattern 023 * <div class=code-example> 024 * <pre><code class='java'> 025 * DiscountCodeInfo discountCodeInfo = DiscountCodeInfo.builder() 026 * .discountCode(discountCodeBuilder -> discountCodeBuilder) 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 = DiscountCodeInfoImpl.class) 033public interface DiscountCodeInfo { 034 035 /** 036 * <p>References a discount code by key.</p> 037 * @return discountCode 038 */ 039 @NotNull 040 @Valid 041 @JsonProperty("discountCode") 042 public DiscountCodeKeyReference getDiscountCode(); 043 044 /** 045 * <p>Maps to <code>DiscountCodeInfo.state</code></p> 046 * @return state 047 */ 048 049 @JsonProperty("state") 050 public DiscountCodeState getState(); 051 052 /** 053 * <p>References a discount code by key.</p> 054 * @param discountCode value to be set 055 */ 056 057 public void setDiscountCode(final DiscountCodeKeyReference discountCode); 058 059 /** 060 * <p>Maps to <code>DiscountCodeInfo.state</code></p> 061 * @param state value to be set 062 */ 063 064 public void setState(final DiscountCodeState state); 065 066 /** 067 * factory method 068 * @return instance of DiscountCodeInfo 069 */ 070 public static DiscountCodeInfo of() { 071 return new DiscountCodeInfoImpl(); 072 } 073 074 /** 075 * factory method to create a shallow copy DiscountCodeInfo 076 * @param template instance to be copied 077 * @return copy instance 078 */ 079 public static DiscountCodeInfo of(final DiscountCodeInfo template) { 080 DiscountCodeInfoImpl instance = new DiscountCodeInfoImpl(); 081 instance.setDiscountCode(template.getDiscountCode()); 082 instance.setState(template.getState()); 083 return instance; 084 } 085 086 /** 087 * factory method to create a deep copy of DiscountCodeInfo 088 * @param template instance to be copied 089 * @return copy instance 090 */ 091 @Nullable 092 public static DiscountCodeInfo deepCopy(@Nullable final DiscountCodeInfo template) { 093 if (template == null) { 094 return null; 095 } 096 DiscountCodeInfoImpl instance = new DiscountCodeInfoImpl(); 097 instance.setDiscountCode( 098 com.commercetools.importapi.models.common.DiscountCodeKeyReference.deepCopy(template.getDiscountCode())); 099 instance.setState(template.getState()); 100 return instance; 101 } 102 103 /** 104 * builder factory method for DiscountCodeInfo 105 * @return builder 106 */ 107 public static DiscountCodeInfoBuilder builder() { 108 return DiscountCodeInfoBuilder.of(); 109 } 110 111 /** 112 * create builder for DiscountCodeInfo instance 113 * @param template instance with prefilled values for the builder 114 * @return builder 115 */ 116 public static DiscountCodeInfoBuilder builder(final DiscountCodeInfo template) { 117 return DiscountCodeInfoBuilder.of(template); 118 } 119 120 /** 121 * accessor map function 122 * @param <T> mapped type 123 * @param helper function to map the object 124 * @return mapped value 125 */ 126 default <T> T withDiscountCodeInfo(Function<DiscountCodeInfo, T> helper) { 127 return helper.apply(this); 128 } 129 130 /** 131 * gives a TypeReference for usage with Jackson DataBind 132 * @return TypeReference 133 */ 134 public static com.fasterxml.jackson.core.type.TypeReference<DiscountCodeInfo> typeReference() { 135 return new com.fasterxml.jackson.core.type.TypeReference<DiscountCodeInfo>() { 136 @Override 137 public String toString() { 138 return "TypeReference<DiscountCodeInfo>"; 139 } 140 }; 141 } 142}