001 002package com.commercetools.api.models.inventory; 003 004import java.time.*; 005import java.time.ZonedDateTime; 006import java.util.*; 007import java.util.function.Function; 008 009import javax.annotation.Nullable; 010import javax.validation.Valid; 011import javax.validation.constraints.NotNull; 012 013import com.commercetools.api.models.channel.ChannelResourceIdentifier; 014import com.commercetools.api.models.type.CustomFieldsDraft; 015import com.fasterxml.jackson.annotation.*; 016import com.fasterxml.jackson.databind.annotation.*; 017 018import io.vrap.rmf.base.client.utils.Generated; 019 020/** 021 * InventoryEntryDraft 022 * 023 * <hr> 024 * Example to create an instance using the builder pattern 025 * <div class=code-example> 026 * <pre><code class='java'> 027 * InventoryEntryDraft inventoryEntryDraft = InventoryEntryDraft.builder() 028 * .sku("{sku}") 029 * .quantityOnStock(0.3) 030 * .build() 031 * </code></pre> 032 * </div> 033 */ 034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 035@JsonDeserialize(as = InventoryEntryDraftImpl.class) 036public interface InventoryEntryDraft extends com.commercetools.api.models.CustomizableDraft<InventoryEntryDraft>, 037 com.commercetools.api.models.WithKey, io.vrap.rmf.base.client.Draft<InventoryEntryDraft> { 038 039 /** 040 * <p>ProductVariant <code>sku</code> of the InventoryEntry.</p> 041 * @return sku 042 */ 043 @NotNull 044 @JsonProperty("sku") 045 public String getSku(); 046 047 /** 048 * <p>User-defined unique identifier for the InventoryEntry.</p> 049 * @return key 050 */ 051 052 @JsonProperty("key") 053 public String getKey(); 054 055 /** 056 * <p>Channel that supplies this InventoryEntry.</p> 057 * @return supplyChannel 058 */ 059 @Valid 060 @JsonProperty("supplyChannel") 061 public ChannelResourceIdentifier getSupplyChannel(); 062 063 /** 064 * <p>Overall amount of stock.</p> 065 * @return quantityOnStock 066 */ 067 @NotNull 068 @JsonProperty("quantityOnStock") 069 public Long getQuantityOnStock(); 070 071 /** 072 * <p>How often the InventoryEntry is restocked (in days).</p> 073 * @return restockableInDays 074 */ 075 076 @JsonProperty("restockableInDays") 077 public Long getRestockableInDays(); 078 079 /** 080 * <p>Date and time of the next restock.</p> 081 * @return expectedDelivery 082 */ 083 084 @JsonProperty("expectedDelivery") 085 public ZonedDateTime getExpectedDelivery(); 086 087 /** 088 * <p>Custom Fields of the InventoryEntry.</p> 089 * @return custom 090 */ 091 @Valid 092 @JsonProperty("custom") 093 public CustomFieldsDraft getCustom(); 094 095 /** 096 * <p>ProductVariant <code>sku</code> of the InventoryEntry.</p> 097 * @param sku value to be set 098 */ 099 100 public void setSku(final String sku); 101 102 /** 103 * <p>User-defined unique identifier for the InventoryEntry.</p> 104 * @param key value to be set 105 */ 106 107 public void setKey(final String key); 108 109 /** 110 * <p>Channel that supplies this InventoryEntry.</p> 111 * @param supplyChannel value to be set 112 */ 113 114 public void setSupplyChannel(final ChannelResourceIdentifier supplyChannel); 115 116 /** 117 * <p>Overall amount of stock.</p> 118 * @param quantityOnStock value to be set 119 */ 120 121 public void setQuantityOnStock(final Long quantityOnStock); 122 123 /** 124 * <p>How often the InventoryEntry is restocked (in days).</p> 125 * @param restockableInDays value to be set 126 */ 127 128 public void setRestockableInDays(final Long restockableInDays); 129 130 /** 131 * <p>Date and time of the next restock.</p> 132 * @param expectedDelivery value to be set 133 */ 134 135 public void setExpectedDelivery(final ZonedDateTime expectedDelivery); 136 137 /** 138 * <p>Custom Fields of the InventoryEntry.</p> 139 * @param custom value to be set 140 */ 141 142 public void setCustom(final CustomFieldsDraft custom); 143 144 /** 145 * factory method 146 * @return instance of InventoryEntryDraft 147 */ 148 public static InventoryEntryDraft of() { 149 return new InventoryEntryDraftImpl(); 150 } 151 152 /** 153 * factory method to create a shallow copy InventoryEntryDraft 154 * @param template instance to be copied 155 * @return copy instance 156 */ 157 public static InventoryEntryDraft of(final InventoryEntryDraft template) { 158 InventoryEntryDraftImpl instance = new InventoryEntryDraftImpl(); 159 instance.setSku(template.getSku()); 160 instance.setKey(template.getKey()); 161 instance.setSupplyChannel(template.getSupplyChannel()); 162 instance.setQuantityOnStock(template.getQuantityOnStock()); 163 instance.setRestockableInDays(template.getRestockableInDays()); 164 instance.setExpectedDelivery(template.getExpectedDelivery()); 165 instance.setCustom(template.getCustom()); 166 return instance; 167 } 168 169 /** 170 * factory method to create a deep copy of InventoryEntryDraft 171 * @param template instance to be copied 172 * @return copy instance 173 */ 174 @Nullable 175 public static InventoryEntryDraft deepCopy(@Nullable final InventoryEntryDraft template) { 176 if (template == null) { 177 return null; 178 } 179 InventoryEntryDraftImpl instance = new InventoryEntryDraftImpl(); 180 instance.setSku(template.getSku()); 181 instance.setKey(template.getKey()); 182 instance.setSupplyChannel( 183 com.commercetools.api.models.channel.ChannelResourceIdentifier.deepCopy(template.getSupplyChannel())); 184 instance.setQuantityOnStock(template.getQuantityOnStock()); 185 instance.setRestockableInDays(template.getRestockableInDays()); 186 instance.setExpectedDelivery(template.getExpectedDelivery()); 187 instance.setCustom(com.commercetools.api.models.type.CustomFieldsDraft.deepCopy(template.getCustom())); 188 return instance; 189 } 190 191 /** 192 * builder factory method for InventoryEntryDraft 193 * @return builder 194 */ 195 public static InventoryEntryDraftBuilder builder() { 196 return InventoryEntryDraftBuilder.of(); 197 } 198 199 /** 200 * create builder for InventoryEntryDraft instance 201 * @param template instance with prefilled values for the builder 202 * @return builder 203 */ 204 public static InventoryEntryDraftBuilder builder(final InventoryEntryDraft template) { 205 return InventoryEntryDraftBuilder.of(template); 206 } 207 208 /** 209 * accessor map function 210 * @param <T> mapped type 211 * @param helper function to map the object 212 * @return mapped value 213 */ 214 default <T> T withInventoryEntryDraft(Function<InventoryEntryDraft, T> helper) { 215 return helper.apply(this); 216 } 217 218 /** 219 * gives a TypeReference for usage with Jackson DataBind 220 * @return TypeReference 221 */ 222 public static com.fasterxml.jackson.core.type.TypeReference<InventoryEntryDraft> typeReference() { 223 return new com.fasterxml.jackson.core.type.TypeReference<InventoryEntryDraft>() { 224 @Override 225 public String toString() { 226 return "TypeReference<InventoryEntryDraft>"; 227 } 228 }; 229 } 230}