001
002package com.commercetools.api.models.error;
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>Returned when a Cart or an Order in a Store references a country that is not included in the countries configured for the Store.</p>
018 *  <p>The error is returned as a failed response to:</p>
019 *  <ul>
020 *   <li>Create Cart in Store request and Set Country update action on Carts.</li>
021 *   <li>Create Cart in Store request and Set Country update action on My Carts.</li>
022 *   <li>Create Order in Store from Cart requests on Orders.</li>
023 *   <li>Create Order in Store from Cart requests on My Orders.</li>
024 *   <li>Create Order from Quote requests on Orders.</li>
025 *   <li>Create Order from Quote requests on My Orders.</li>
026 *   <li>Create Order by Import request on Order Import.</li>
027 *   <li>Set Country on Order Edits.</li>
028 *  </ul>
029 *
030 * <hr>
031 * Example to create an instance using the builder pattern
032 * <div class=code-example>
033 * <pre><code class='java'>
034 *     CountryNotConfiguredInStoreError countryNotConfiguredInStoreError = CountryNotConfiguredInStoreError.builder()
035 *             .message("{message}")
036 *             .plusStoreCountries(storeCountriesBuilder -> storeCountriesBuilder)
037 *             .country("{country}")
038 *             .build()
039 * </code></pre>
040 * </div>
041 */
042@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
043@JsonDeserialize(as = CountryNotConfiguredInStoreErrorImpl.class)
044public interface CountryNotConfiguredInStoreError extends ErrorObject {
045
046    /**
047     * discriminator value for CountryNotConfiguredInStoreError
048     */
049    String COUNTRY_NOT_CONFIGURED_IN_STORE = "CountryNotConfiguredInStore";
050
051    /**
052     *
053     * @return code
054     */
055    @NotNull
056    @JsonProperty("code")
057    public String getCode();
058
059    /**
060     *  <p><code>"The country $country is not configured for the store $store."</code></p>
061     * @return message
062     */
063    @NotNull
064    @JsonProperty("message")
065    public String getMessage();
066
067    /**
068     *  <p>Countries configured for the Store.</p>
069     * @return storeCountries
070     */
071    @NotNull
072    @JsonProperty("storeCountries")
073    public List<String> getStoreCountries();
074
075    /**
076     *  <p>The country that is not configured for the Store but referenced on the Cart or Order.</p>
077     * @return country
078     */
079    @NotNull
080    @JsonProperty("country")
081    public String getCountry();
082
083    /**
084     *  <p><code>"The country $country is not configured for the store $store."</code></p>
085     * @param message value to be set
086     */
087
088    public void setMessage(final String message);
089
090    /**
091     *  <p>Countries configured for the Store.</p>
092     * @param storeCountries values to be set
093     */
094
095    @JsonIgnore
096    public void setStoreCountries(final String... storeCountries);
097
098    /**
099     *  <p>Countries configured for the Store.</p>
100     * @param storeCountries values to be set
101     */
102
103    public void setStoreCountries(final List<String> storeCountries);
104
105    /**
106     *  <p>The country that is not configured for the Store but referenced on the Cart or Order.</p>
107     * @param country value to be set
108     */
109
110    public void setCountry(final String country);
111
112    /**
113     * factory method
114     * @return instance of CountryNotConfiguredInStoreError
115     */
116    public static CountryNotConfiguredInStoreError of() {
117        return new CountryNotConfiguredInStoreErrorImpl();
118    }
119
120    /**
121     * factory method to create a shallow copy CountryNotConfiguredInStoreError
122     * @param template instance to be copied
123     * @return copy instance
124     */
125    public static CountryNotConfiguredInStoreError of(final CountryNotConfiguredInStoreError template) {
126        CountryNotConfiguredInStoreErrorImpl instance = new CountryNotConfiguredInStoreErrorImpl();
127        instance.setMessage(template.getMessage());
128        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
129        instance.setStoreCountries(template.getStoreCountries());
130        instance.setCountry(template.getCountry());
131        return instance;
132    }
133
134    /**
135     * factory method to create a deep copy of CountryNotConfiguredInStoreError
136     * @param template instance to be copied
137     * @return copy instance
138     */
139    @Nullable
140    public static CountryNotConfiguredInStoreError deepCopy(@Nullable final CountryNotConfiguredInStoreError template) {
141        if (template == null) {
142            return null;
143        }
144        CountryNotConfiguredInStoreErrorImpl instance = new CountryNotConfiguredInStoreErrorImpl();
145        instance.setMessage(template.getMessage());
146        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
147        instance.setStoreCountries(Optional.ofNullable(template.getStoreCountries()).map(ArrayList::new).orElse(null));
148        instance.setCountry(template.getCountry());
149        return instance;
150    }
151
152    /**
153     * builder factory method for CountryNotConfiguredInStoreError
154     * @return builder
155     */
156    public static CountryNotConfiguredInStoreErrorBuilder builder() {
157        return CountryNotConfiguredInStoreErrorBuilder.of();
158    }
159
160    /**
161     * create builder for CountryNotConfiguredInStoreError instance
162     * @param template instance with prefilled values for the builder
163     * @return builder
164     */
165    public static CountryNotConfiguredInStoreErrorBuilder builder(final CountryNotConfiguredInStoreError template) {
166        return CountryNotConfiguredInStoreErrorBuilder.of(template);
167    }
168
169    /**
170     * accessor map function
171     * @param <T> mapped type
172     * @param helper function to map the object
173     * @return mapped value
174     */
175    default <T> T withCountryNotConfiguredInStoreError(Function<CountryNotConfiguredInStoreError, T> helper) {
176        return helper.apply(this);
177    }
178
179    /**
180     * gives a TypeReference for usage with Jackson DataBind
181     * @return TypeReference
182     */
183    public static com.fasterxml.jackson.core.type.TypeReference<CountryNotConfiguredInStoreError> typeReference() {
184        return new com.fasterxml.jackson.core.type.TypeReference<CountryNotConfiguredInStoreError>() {
185            @Override
186            public String toString() {
187                return "TypeReference<CountryNotConfiguredInStoreError>";
188            }
189        };
190    }
191}