001
002package com.commercetools.api.models.order;
003
004import java.time.*;
005import java.time.ZonedDateTime;
006import java.util.*;
007import java.util.function.Function;
008
009import javax.annotation.Nullable;
010import javax.validation.Valid;
011import javax.validation.constraints.NotNull;
012
013import com.commercetools.api.models.channel.ChannelReference;
014import com.fasterxml.jackson.annotation.*;
015import com.fasterxml.jackson.databind.annotation.*;
016
017import io.vrap.rmf.base.client.utils.Generated;
018
019/**
020 * SyncInfo
021 *
022 * <hr>
023 * Example to create an instance using the builder pattern
024 * <div class=code-example>
025 * <pre><code class='java'>
026 *     SyncInfo syncInfo = SyncInfo.builder()
027 *             .channel(channelBuilder -> channelBuilder)
028 *             .syncedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
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 = SyncInfoImpl.class)
035public interface SyncInfo {
036
037    /**
038     *  <p>Connection to a particular synchronization destination.</p>
039     * @return channel
040     */
041    @NotNull
042    @Valid
043    @JsonProperty("channel")
044    public ChannelReference getChannel();
045
046    /**
047     *  <p>Can be used to reference an external order instance, file etc.</p>
048     * @return externalId
049     */
050
051    @JsonProperty("externalId")
052    public String getExternalId();
053
054    /**
055     *
056     * @return syncedAt
057     */
058    @NotNull
059    @JsonProperty("syncedAt")
060    public ZonedDateTime getSyncedAt();
061
062    /**
063     *  <p>Connection to a particular synchronization destination.</p>
064     * @param channel value to be set
065     */
066
067    public void setChannel(final ChannelReference channel);
068
069    /**
070     *  <p>Can be used to reference an external order instance, file etc.</p>
071     * @param externalId value to be set
072     */
073
074    public void setExternalId(final String externalId);
075
076    /**
077     * set syncedAt
078     * @param syncedAt value to be set
079     */
080
081    public void setSyncedAt(final ZonedDateTime syncedAt);
082
083    /**
084     * factory method
085     * @return instance of SyncInfo
086     */
087    public static SyncInfo of() {
088        return new SyncInfoImpl();
089    }
090
091    /**
092     * factory method to create a shallow copy SyncInfo
093     * @param template instance to be copied
094     * @return copy instance
095     */
096    public static SyncInfo of(final SyncInfo template) {
097        SyncInfoImpl instance = new SyncInfoImpl();
098        instance.setChannel(template.getChannel());
099        instance.setExternalId(template.getExternalId());
100        instance.setSyncedAt(template.getSyncedAt());
101        return instance;
102    }
103
104    /**
105     * factory method to create a deep copy of SyncInfo
106     * @param template instance to be copied
107     * @return copy instance
108     */
109    @Nullable
110    public static SyncInfo deepCopy(@Nullable final SyncInfo template) {
111        if (template == null) {
112            return null;
113        }
114        SyncInfoImpl instance = new SyncInfoImpl();
115        instance.setChannel(com.commercetools.api.models.channel.ChannelReference.deepCopy(template.getChannel()));
116        instance.setExternalId(template.getExternalId());
117        instance.setSyncedAt(template.getSyncedAt());
118        return instance;
119    }
120
121    /**
122     * builder factory method for SyncInfo
123     * @return builder
124     */
125    public static SyncInfoBuilder builder() {
126        return SyncInfoBuilder.of();
127    }
128
129    /**
130     * create builder for SyncInfo instance
131     * @param template instance with prefilled values for the builder
132     * @return builder
133     */
134    public static SyncInfoBuilder builder(final SyncInfo template) {
135        return SyncInfoBuilder.of(template);
136    }
137
138    /**
139     * accessor map function
140     * @param <T> mapped type
141     * @param helper function to map the object
142     * @return mapped value
143     */
144    default <T> T withSyncInfo(Function<SyncInfo, T> helper) {
145        return helper.apply(this);
146    }
147
148    /**
149     * gives a TypeReference for usage with Jackson DataBind
150     * @return TypeReference
151     */
152    public static com.fasterxml.jackson.core.type.TypeReference<SyncInfo> typeReference() {
153        return new com.fasterxml.jackson.core.type.TypeReference<SyncInfo>() {
154            @Override
155            public String toString() {
156                return "TypeReference<SyncInfo>";
157            }
158        };
159    }
160}