001
002package com.commercetools.api.models.standalone_price;
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.api.models.common.PriceTierDraft;
013import com.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 *  <p>Adding a PriceTier to a StandalonePrice produces the Standalone Price Tier Added Message.</p>
020 *
021 * <hr>
022 * Example to create an instance using the builder pattern
023 * <div class=code-example>
024 * <pre><code class='java'>
025 *     StandalonePriceAddPriceTierAction standalonePriceAddPriceTierAction = StandalonePriceAddPriceTierAction.builder()
026 *             .tier(tierBuilder -> tierBuilder)
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 = StandalonePriceAddPriceTierActionImpl.class)
033public interface StandalonePriceAddPriceTierAction extends StandalonePriceUpdateAction {
034
035    /**
036     * discriminator value for StandalonePriceAddPriceTierAction
037     */
038    String ADD_PRICE_TIER = "addPriceTier";
039
040    /**
041     *  <p>The PriceTier to be added to the <code>tiers</code> field of the StandalonePrice. The action returns an InvalidField error in the following cases:</p>
042     *  <ul>
043     *   <li>Trying to add a PriceTier with <code>minimumQuantity</code> &lt; <code>2</code>.</li>
044     *   <li>Trying to add a PriceTier with <code>minimumQuantity</code> that already exists for the StandalonePrice.</li>
045     *  </ul>
046     * @return tier
047     */
048    @NotNull
049    @Valid
050    @JsonProperty("tier")
051    public PriceTierDraft getTier();
052
053    /**
054     *  <p>The PriceTier to be added to the <code>tiers</code> field of the StandalonePrice. The action returns an InvalidField error in the following cases:</p>
055     *  <ul>
056     *   <li>Trying to add a PriceTier with <code>minimumQuantity</code> &lt; <code>2</code>.</li>
057     *   <li>Trying to add a PriceTier with <code>minimumQuantity</code> that already exists for the StandalonePrice.</li>
058     *  </ul>
059     * @param tier value to be set
060     */
061
062    public void setTier(final PriceTierDraft tier);
063
064    /**
065     * factory method
066     * @return instance of StandalonePriceAddPriceTierAction
067     */
068    public static StandalonePriceAddPriceTierAction of() {
069        return new StandalonePriceAddPriceTierActionImpl();
070    }
071
072    /**
073     * factory method to create a shallow copy StandalonePriceAddPriceTierAction
074     * @param template instance to be copied
075     * @return copy instance
076     */
077    public static StandalonePriceAddPriceTierAction of(final StandalonePriceAddPriceTierAction template) {
078        StandalonePriceAddPriceTierActionImpl instance = new StandalonePriceAddPriceTierActionImpl();
079        instance.setTier(template.getTier());
080        return instance;
081    }
082
083    /**
084     * factory method to create a deep copy of StandalonePriceAddPriceTierAction
085     * @param template instance to be copied
086     * @return copy instance
087     */
088    @Nullable
089    public static StandalonePriceAddPriceTierAction deepCopy(
090            @Nullable final StandalonePriceAddPriceTierAction template) {
091        if (template == null) {
092            return null;
093        }
094        StandalonePriceAddPriceTierActionImpl instance = new StandalonePriceAddPriceTierActionImpl();
095        instance.setTier(com.commercetools.api.models.common.PriceTierDraft.deepCopy(template.getTier()));
096        return instance;
097    }
098
099    /**
100     * builder factory method for StandalonePriceAddPriceTierAction
101     * @return builder
102     */
103    public static StandalonePriceAddPriceTierActionBuilder builder() {
104        return StandalonePriceAddPriceTierActionBuilder.of();
105    }
106
107    /**
108     * create builder for StandalonePriceAddPriceTierAction instance
109     * @param template instance with prefilled values for the builder
110     * @return builder
111     */
112    public static StandalonePriceAddPriceTierActionBuilder builder(final StandalonePriceAddPriceTierAction template) {
113        return StandalonePriceAddPriceTierActionBuilder.of(template);
114    }
115
116    /**
117     * accessor map function
118     * @param <T> mapped type
119     * @param helper function to map the object
120     * @return mapped value
121     */
122    default <T> T withStandalonePriceAddPriceTierAction(Function<StandalonePriceAddPriceTierAction, T> helper) {
123        return helper.apply(this);
124    }
125
126    /**
127     * gives a TypeReference for usage with Jackson DataBind
128     * @return TypeReference
129     */
130    public static com.fasterxml.jackson.core.type.TypeReference<StandalonePriceAddPriceTierAction> typeReference() {
131        return new com.fasterxml.jackson.core.type.TypeReference<StandalonePriceAddPriceTierAction>() {
132            @Override
133            public String toString() {
134                return "TypeReference<StandalonePriceAddPriceTierAction>";
135            }
136        };
137    }
138}