001
002package com.commercetools.api.models.subscription;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.constraints.NotNull;
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>Notification about changes to a resource. The payload format differs for resource creation, update, and deletion.</p>
018 *
019 * <hr>
020 * Example to create an instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     ChangeSubscription changeSubscription = ChangeSubscription.builder()
024 *             .resourceTypeId(ChangeSubscriptionResourceTypeId.BUSINESS_UNIT)
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 = ChangeSubscriptionImpl.class)
031public interface ChangeSubscription {
032
033    /**
034     *  <p>Unique identifier for the type of resource, for example, <code>cart</code>.</p>
035     * @return resourceTypeId
036     */
037    @NotNull
038    @JsonProperty("resourceTypeId")
039    public ChangeSubscriptionResourceTypeId getResourceTypeId();
040
041    /**
042     *  <p>Unique identifier for the type of resource, for example, <code>cart</code>.</p>
043     * @param resourceTypeId value to be set
044     */
045
046    public void setResourceTypeId(final ChangeSubscriptionResourceTypeId resourceTypeId);
047
048    /**
049     * factory method
050     * @return instance of ChangeSubscription
051     */
052    public static ChangeSubscription of() {
053        return new ChangeSubscriptionImpl();
054    }
055
056    /**
057     * factory method to create a shallow copy ChangeSubscription
058     * @param template instance to be copied
059     * @return copy instance
060     */
061    public static ChangeSubscription of(final ChangeSubscription template) {
062        ChangeSubscriptionImpl instance = new ChangeSubscriptionImpl();
063        instance.setResourceTypeId(template.getResourceTypeId());
064        return instance;
065    }
066
067    /**
068     * factory method to create a deep copy of ChangeSubscription
069     * @param template instance to be copied
070     * @return copy instance
071     */
072    @Nullable
073    public static ChangeSubscription deepCopy(@Nullable final ChangeSubscription template) {
074        if (template == null) {
075            return null;
076        }
077        ChangeSubscriptionImpl instance = new ChangeSubscriptionImpl();
078        instance.setResourceTypeId(template.getResourceTypeId());
079        return instance;
080    }
081
082    /**
083     * builder factory method for ChangeSubscription
084     * @return builder
085     */
086    public static ChangeSubscriptionBuilder builder() {
087        return ChangeSubscriptionBuilder.of();
088    }
089
090    /**
091     * create builder for ChangeSubscription instance
092     * @param template instance with prefilled values for the builder
093     * @return builder
094     */
095    public static ChangeSubscriptionBuilder builder(final ChangeSubscription template) {
096        return ChangeSubscriptionBuilder.of(template);
097    }
098
099    /**
100     * accessor map function
101     * @param <T> mapped type
102     * @param helper function to map the object
103     * @return mapped value
104     */
105    default <T> T withChangeSubscription(Function<ChangeSubscription, T> helper) {
106        return helper.apply(this);
107    }
108
109    /**
110     * gives a TypeReference for usage with Jackson DataBind
111     * @return TypeReference
112     */
113    public static com.fasterxml.jackson.core.type.TypeReference<ChangeSubscription> typeReference() {
114        return new com.fasterxml.jackson.core.type.TypeReference<ChangeSubscription>() {
115            @Override
116            public String toString() {
117                return "TypeReference<ChangeSubscription>";
118            }
119        };
120    }
121}