001
002package com.commercetools.history.models.change_history;
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.history.models.common.Reference;
013import com.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 *  <p>Information about the user or API Client who performed the change. This is a variant of LastModifiedBy.</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 *     ModifiedBy modifiedBy = ModifiedBy.builder()
026 *             .id("{id}")
027 *             .type("{type}")
028 *             .isPlatformClient(true)
029 *             .build()
030 * </code></pre>
031 * </div>
032 */
033@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
034@JsonDeserialize(as = ModifiedByImpl.class)
035public interface ModifiedBy {
036
037    /**
038     *  <p>ID of the Merchant Center user who made the change.</p>
039     *  <p>Present only if the change was made in the Merchant Center.</p>
040     * @return id
041     */
042    @NotNull
043    @JsonProperty("id")
044    public String getId();
045
046    /**
047     *  <p>Indicates who performed the change.</p>
048     *  <ul>
049     *   <li>If the change was made by a user, the value is <code>"user"</code>.</li>
050     *   <li>If the change was made by an API Client with or without an external user ID, the value is <code>"external-user"</code>.</li>
051     *  </ul>
052     * @return type
053     */
054    @NotNull
055    @JsonProperty("type")
056    public String getType();
057
058    /**
059     *  <p>Reference to the Customer who made the change.</p>
060     *  <p>Present only if the change was made using a token from the password flow.</p>
061     * @return customer
062     */
063    @Valid
064    @JsonProperty("customer")
065    public Reference getCustomer();
066
067    /**
068     *  <p>Present only if the change was made using a token from an anonymous session.</p>
069     * @return anonymousId
070     */
071
072    @JsonProperty("anonymousId")
073    public String getAnonymousId();
074
075    /**
076     *  <p>ID of the API Client that made the change.</p>
077     *  <p>Present only if the change was made using an API Client.</p>
078     * @return clientId
079     */
080
081    @JsonProperty("clientId")
082    public String getClientId();
083
084    /**
085     *  <p><code>true</code> if the change was made using the Merchant Center or ImpEx.</p>
086     * @return isPlatformClient
087     */
088    @NotNull
089    @JsonProperty("isPlatformClient")
090    public Boolean getIsPlatformClient();
091
092    /**
093     *  <p>ID of the Merchant Center user who made the change.</p>
094     *  <p>Present only if the change was made in the Merchant Center.</p>
095     * @param id value to be set
096     */
097
098    public void setId(final String id);
099
100    /**
101     *  <p>Indicates who performed the change.</p>
102     *  <ul>
103     *   <li>If the change was made by a user, the value is <code>"user"</code>.</li>
104     *   <li>If the change was made by an API Client with or without an external user ID, the value is <code>"external-user"</code>.</li>
105     *  </ul>
106     * @param type value to be set
107     */
108
109    public void setType(final String type);
110
111    /**
112     *  <p>Reference to the Customer who made the change.</p>
113     *  <p>Present only if the change was made using a token from the password flow.</p>
114     * @param customer value to be set
115     */
116
117    public void setCustomer(final Reference customer);
118
119    /**
120     *  <p>Present only if the change was made using a token from an anonymous session.</p>
121     * @param anonymousId value to be set
122     */
123
124    public void setAnonymousId(final String anonymousId);
125
126    /**
127     *  <p>ID of the API Client that made the change.</p>
128     *  <p>Present only if the change was made using an API Client.</p>
129     * @param clientId value to be set
130     */
131
132    public void setClientId(final String clientId);
133
134    /**
135     *  <p><code>true</code> if the change was made using the Merchant Center or ImpEx.</p>
136     * @param isPlatformClient value to be set
137     */
138
139    public void setIsPlatformClient(final Boolean isPlatformClient);
140
141    /**
142     * factory method
143     * @return instance of ModifiedBy
144     */
145    public static ModifiedBy of() {
146        return new ModifiedByImpl();
147    }
148
149    /**
150     * factory method to create a shallow copy ModifiedBy
151     * @param template instance to be copied
152     * @return copy instance
153     */
154    public static ModifiedBy of(final ModifiedBy template) {
155        ModifiedByImpl instance = new ModifiedByImpl();
156        instance.setId(template.getId());
157        instance.setType(template.getType());
158        instance.setCustomer(template.getCustomer());
159        instance.setAnonymousId(template.getAnonymousId());
160        instance.setClientId(template.getClientId());
161        instance.setIsPlatformClient(template.getIsPlatformClient());
162        return instance;
163    }
164
165    /**
166     * factory method to create a deep copy of ModifiedBy
167     * @param template instance to be copied
168     * @return copy instance
169     */
170    @Nullable
171    public static ModifiedBy deepCopy(@Nullable final ModifiedBy template) {
172        if (template == null) {
173            return null;
174        }
175        ModifiedByImpl instance = new ModifiedByImpl();
176        instance.setId(template.getId());
177        instance.setType(template.getType());
178        instance.setCustomer(com.commercetools.history.models.common.Reference.deepCopy(template.getCustomer()));
179        instance.setAnonymousId(template.getAnonymousId());
180        instance.setClientId(template.getClientId());
181        instance.setIsPlatformClient(template.getIsPlatformClient());
182        return instance;
183    }
184
185    /**
186     * builder factory method for ModifiedBy
187     * @return builder
188     */
189    public static ModifiedByBuilder builder() {
190        return ModifiedByBuilder.of();
191    }
192
193    /**
194     * create builder for ModifiedBy instance
195     * @param template instance with prefilled values for the builder
196     * @return builder
197     */
198    public static ModifiedByBuilder builder(final ModifiedBy template) {
199        return ModifiedByBuilder.of(template);
200    }
201
202    /**
203     * accessor map function
204     * @param <T> mapped type
205     * @param helper function to map the object
206     * @return mapped value
207     */
208    default <T> T withModifiedBy(Function<ModifiedBy, T> helper) {
209        return helper.apply(this);
210    }
211
212    /**
213     * gives a TypeReference for usage with Jackson DataBind
214     * @return TypeReference
215     */
216    public static com.fasterxml.jackson.core.type.TypeReference<ModifiedBy> typeReference() {
217        return new com.fasterxml.jackson.core.type.TypeReference<ModifiedBy>() {
218            @Override
219            public String toString() {
220                return "TypeReference<ModifiedBy>";
221            }
222        };
223    }
224}