001
002package com.commercetools.api.models.message;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.Valid;
010
011import com.commercetools.api.models.customer_group.CustomerGroupReference;
012import com.fasterxml.jackson.annotation.*;
013import com.fasterxml.jackson.databind.annotation.*;
014
015import io.vrap.rmf.base.client.utils.Generated;
016
017/**
018 *  <p>Generated after a successful Set Customer Group update action.</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 *     CustomerGroupSetMessage customerGroupSetMessage = CustomerGroupSetMessage.builder()
025 *             .id("{id}")
026 *             .version(0.3)
027 *             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
028 *             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
029 *             .sequenceNumber(0.3)
030 *             .resource(resourceBuilder -> resourceBuilder)
031 *             .resourceVersion(0.3)
032 *             .build()
033 * </code></pre>
034 * </div>
035 */
036@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
037@JsonDeserialize(as = CustomerGroupSetMessageImpl.class)
038public interface CustomerGroupSetMessage extends Message {
039
040    /**
041     * discriminator value for CustomerGroupSetMessage
042     */
043    String CUSTOMER_GROUP_SET = "CustomerGroupSet";
044
045    /**
046     *  <p>Customer Group that was set during the Set Customer Group update action.</p>
047     * @return customerGroup
048     */
049    @Valid
050    @JsonProperty("customerGroup")
051    public CustomerGroupReference getCustomerGroup();
052
053    /**
054     *  <p>Customer Group that was set during the Set Customer Group update action.</p>
055     * @param customerGroup value to be set
056     */
057
058    public void setCustomerGroup(final CustomerGroupReference customerGroup);
059
060    /**
061     * factory method
062     * @return instance of CustomerGroupSetMessage
063     */
064    public static CustomerGroupSetMessage of() {
065        return new CustomerGroupSetMessageImpl();
066    }
067
068    /**
069     * factory method to create a shallow copy CustomerGroupSetMessage
070     * @param template instance to be copied
071     * @return copy instance
072     */
073    public static CustomerGroupSetMessage of(final CustomerGroupSetMessage template) {
074        CustomerGroupSetMessageImpl instance = new CustomerGroupSetMessageImpl();
075        instance.setId(template.getId());
076        instance.setVersion(template.getVersion());
077        instance.setCreatedAt(template.getCreatedAt());
078        instance.setLastModifiedAt(template.getLastModifiedAt());
079        instance.setLastModifiedBy(template.getLastModifiedBy());
080        instance.setCreatedBy(template.getCreatedBy());
081        instance.setSequenceNumber(template.getSequenceNumber());
082        instance.setResource(template.getResource());
083        instance.setResourceVersion(template.getResourceVersion());
084        instance.setResourceUserProvidedIdentifiers(template.getResourceUserProvidedIdentifiers());
085        instance.setCustomerGroup(template.getCustomerGroup());
086        return instance;
087    }
088
089    /**
090     * factory method to create a deep copy of CustomerGroupSetMessage
091     * @param template instance to be copied
092     * @return copy instance
093     */
094    @Nullable
095    public static CustomerGroupSetMessage deepCopy(@Nullable final CustomerGroupSetMessage template) {
096        if (template == null) {
097            return null;
098        }
099        CustomerGroupSetMessageImpl instance = new CustomerGroupSetMessageImpl();
100        instance.setId(template.getId());
101        instance.setVersion(template.getVersion());
102        instance.setCreatedAt(template.getCreatedAt());
103        instance.setLastModifiedAt(template.getLastModifiedAt());
104        instance.setLastModifiedBy(
105            com.commercetools.api.models.common.LastModifiedBy.deepCopy(template.getLastModifiedBy()));
106        instance.setCreatedBy(com.commercetools.api.models.common.CreatedBy.deepCopy(template.getCreatedBy()));
107        instance.setSequenceNumber(template.getSequenceNumber());
108        instance.setResource(com.commercetools.api.models.common.Reference.deepCopy(template.getResource()));
109        instance.setResourceVersion(template.getResourceVersion());
110        instance.setResourceUserProvidedIdentifiers(com.commercetools.api.models.message.UserProvidedIdentifiers
111                .deepCopy(template.getResourceUserProvidedIdentifiers()));
112        instance.setCustomerGroup(
113            com.commercetools.api.models.customer_group.CustomerGroupReference.deepCopy(template.getCustomerGroup()));
114        return instance;
115    }
116
117    /**
118     * builder factory method for CustomerGroupSetMessage
119     * @return builder
120     */
121    public static CustomerGroupSetMessageBuilder builder() {
122        return CustomerGroupSetMessageBuilder.of();
123    }
124
125    /**
126     * create builder for CustomerGroupSetMessage instance
127     * @param template instance with prefilled values for the builder
128     * @return builder
129     */
130    public static CustomerGroupSetMessageBuilder builder(final CustomerGroupSetMessage template) {
131        return CustomerGroupSetMessageBuilder.of(template);
132    }
133
134    /**
135     * accessor map function
136     * @param <T> mapped type
137     * @param helper function to map the object
138     * @return mapped value
139     */
140    default <T> T withCustomerGroupSetMessage(Function<CustomerGroupSetMessage, T> helper) {
141        return helper.apply(this);
142    }
143
144    /**
145     * gives a TypeReference for usage with Jackson DataBind
146     * @return TypeReference
147     */
148    public static com.fasterxml.jackson.core.type.TypeReference<CustomerGroupSetMessage> typeReference() {
149        return new com.fasterxml.jackson.core.type.TypeReference<CustomerGroupSetMessage>() {
150            @Override
151            public String toString() {
152                return "TypeReference<CustomerGroupSetMessage>";
153            }
154        };
155    }
156}