001
002package com.commercetools.api.models.standalone_price;
003
004import java.time.*;
005import java.time.ZonedDateTime;
006import java.util.*;
007import java.util.function.Function;
008
009import javax.annotation.Nullable;
010
011import com.fasterxml.jackson.annotation.*;
012import com.fasterxml.jackson.databind.annotation.*;
013
014import io.vrap.rmf.base.client.utils.Generated;
015
016/**
017 *  <p>Updating the <code>validFrom</code> value generates the StandalonePriceValidFromSet Message.</p>
018 *  <p>As the validity dates are part of the price scope and are not allowed to overlap, this update might return the DuplicateStandalonePriceScope and OverlappingStandalonePriceValidity errors, respectively. A Price without validity period does not conflict with a Price defined for a time period.</p>
019 *
020 * <hr>
021 * Example to create an instance using the builder pattern
022 * <div class=code-example>
023 * <pre><code class='java'>
024 *     StandalonePriceSetValidFromAction standalonePriceSetValidFromAction = StandalonePriceSetValidFromAction.builder()
025 *             .build()
026 * </code></pre>
027 * </div>
028 */
029@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
030@JsonDeserialize(as = StandalonePriceSetValidFromActionImpl.class)
031public interface StandalonePriceSetValidFromAction extends StandalonePriceUpdateAction {
032
033    /**
034     * discriminator value for StandalonePriceSetValidFromAction
035     */
036    String SET_VALID_FROM = "setValidFrom";
037
038    /**
039     *  <p>Value to set. If empty, any existing value is removed.</p>
040     * @return validFrom
041     */
042
043    @JsonProperty("validFrom")
044    public ZonedDateTime getValidFrom();
045
046    /**
047     *  <p>Value to set. If empty, any existing value is removed.</p>
048     * @param validFrom value to be set
049     */
050
051    public void setValidFrom(final ZonedDateTime validFrom);
052
053    /**
054     * factory method
055     * @return instance of StandalonePriceSetValidFromAction
056     */
057    public static StandalonePriceSetValidFromAction of() {
058        return new StandalonePriceSetValidFromActionImpl();
059    }
060
061    /**
062     * factory method to create a shallow copy StandalonePriceSetValidFromAction
063     * @param template instance to be copied
064     * @return copy instance
065     */
066    public static StandalonePriceSetValidFromAction of(final StandalonePriceSetValidFromAction template) {
067        StandalonePriceSetValidFromActionImpl instance = new StandalonePriceSetValidFromActionImpl();
068        instance.setValidFrom(template.getValidFrom());
069        return instance;
070    }
071
072    /**
073     * factory method to create a deep copy of StandalonePriceSetValidFromAction
074     * @param template instance to be copied
075     * @return copy instance
076     */
077    @Nullable
078    public static StandalonePriceSetValidFromAction deepCopy(
079            @Nullable final StandalonePriceSetValidFromAction template) {
080        if (template == null) {
081            return null;
082        }
083        StandalonePriceSetValidFromActionImpl instance = new StandalonePriceSetValidFromActionImpl();
084        instance.setValidFrom(template.getValidFrom());
085        return instance;
086    }
087
088    /**
089     * builder factory method for StandalonePriceSetValidFromAction
090     * @return builder
091     */
092    public static StandalonePriceSetValidFromActionBuilder builder() {
093        return StandalonePriceSetValidFromActionBuilder.of();
094    }
095
096    /**
097     * create builder for StandalonePriceSetValidFromAction instance
098     * @param template instance with prefilled values for the builder
099     * @return builder
100     */
101    public static StandalonePriceSetValidFromActionBuilder builder(final StandalonePriceSetValidFromAction template) {
102        return StandalonePriceSetValidFromActionBuilder.of(template);
103    }
104
105    /**
106     * accessor map function
107     * @param <T> mapped type
108     * @param helper function to map the object
109     * @return mapped value
110     */
111    default <T> T withStandalonePriceSetValidFromAction(Function<StandalonePriceSetValidFromAction, T> helper) {
112        return helper.apply(this);
113    }
114
115    /**
116     * gives a TypeReference for usage with Jackson DataBind
117     * @return TypeReference
118     */
119    public static com.fasterxml.jackson.core.type.TypeReference<StandalonePriceSetValidFromAction> typeReference() {
120        return new com.fasterxml.jackson.core.type.TypeReference<StandalonePriceSetValidFromAction>() {
121            @Override
122            public String toString() {
123                return "TypeReference<StandalonePriceSetValidFromAction>";
124            }
125        };
126    }
127}