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 * GraphQLCountryNotConfiguredInStoreError graphQLCountryNotConfiguredInStoreError = GraphQLCountryNotConfiguredInStoreError.builder() 035 * .plusStoreCountries(storeCountriesBuilder -> storeCountriesBuilder) 036 * .country("{country}") 037 * .build() 038 * </code></pre> 039 * </div> 040 */ 041@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 042@JsonDeserialize(as = GraphQLCountryNotConfiguredInStoreErrorImpl.class) 043public interface GraphQLCountryNotConfiguredInStoreError extends GraphQLErrorObject { 044 045 /** 046 * discriminator value for GraphQLCountryNotConfiguredInStoreError 047 */ 048 String COUNTRY_NOT_CONFIGURED_IN_STORE = "CountryNotConfiguredInStore"; 049 050 /** 051 * 052 * @return code 053 */ 054 @NotNull 055 @JsonProperty("code") 056 public String getCode(); 057 058 /** 059 * <p>Countries configured for the Store.</p> 060 * @return storeCountries 061 */ 062 @NotNull 063 @JsonProperty("storeCountries") 064 public List<String> getStoreCountries(); 065 066 /** 067 * <p>The country that is not configured for the Store but referenced on the Cart or Order.</p> 068 * @return country 069 */ 070 @NotNull 071 @JsonProperty("country") 072 public String getCountry(); 073 074 /** 075 * <p>Countries configured for the Store.</p> 076 * @param storeCountries values to be set 077 */ 078 079 @JsonIgnore 080 public void setStoreCountries(final String... storeCountries); 081 082 /** 083 * <p>Countries configured for the Store.</p> 084 * @param storeCountries values to be set 085 */ 086 087 public void setStoreCountries(final List<String> storeCountries); 088 089 /** 090 * <p>The country that is not configured for the Store but referenced on the Cart or Order.</p> 091 * @param country value to be set 092 */ 093 094 public void setCountry(final String country); 095 096 /** 097 * factory method 098 * @return instance of GraphQLCountryNotConfiguredInStoreError 099 */ 100 public static GraphQLCountryNotConfiguredInStoreError of() { 101 return new GraphQLCountryNotConfiguredInStoreErrorImpl(); 102 } 103 104 /** 105 * factory method to create a shallow copy GraphQLCountryNotConfiguredInStoreError 106 * @param template instance to be copied 107 * @return copy instance 108 */ 109 public static GraphQLCountryNotConfiguredInStoreError of(final GraphQLCountryNotConfiguredInStoreError template) { 110 GraphQLCountryNotConfiguredInStoreErrorImpl instance = new GraphQLCountryNotConfiguredInStoreErrorImpl(); 111 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 112 instance.setStoreCountries(template.getStoreCountries()); 113 instance.setCountry(template.getCountry()); 114 return instance; 115 } 116 117 /** 118 * factory method to create a deep copy of GraphQLCountryNotConfiguredInStoreError 119 * @param template instance to be copied 120 * @return copy instance 121 */ 122 @Nullable 123 public static GraphQLCountryNotConfiguredInStoreError deepCopy( 124 @Nullable final GraphQLCountryNotConfiguredInStoreError template) { 125 if (template == null) { 126 return null; 127 } 128 GraphQLCountryNotConfiguredInStoreErrorImpl instance = new GraphQLCountryNotConfiguredInStoreErrorImpl(); 129 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 130 instance.setStoreCountries(Optional.ofNullable(template.getStoreCountries()).map(ArrayList::new).orElse(null)); 131 instance.setCountry(template.getCountry()); 132 return instance; 133 } 134 135 /** 136 * builder factory method for GraphQLCountryNotConfiguredInStoreError 137 * @return builder 138 */ 139 public static GraphQLCountryNotConfiguredInStoreErrorBuilder builder() { 140 return GraphQLCountryNotConfiguredInStoreErrorBuilder.of(); 141 } 142 143 /** 144 * create builder for GraphQLCountryNotConfiguredInStoreError instance 145 * @param template instance with prefilled values for the builder 146 * @return builder 147 */ 148 public static GraphQLCountryNotConfiguredInStoreErrorBuilder builder( 149 final GraphQLCountryNotConfiguredInStoreError template) { 150 return GraphQLCountryNotConfiguredInStoreErrorBuilder.of(template); 151 } 152 153 /** 154 * accessor map function 155 * @param <T> mapped type 156 * @param helper function to map the object 157 * @return mapped value 158 */ 159 default <T> T withGraphQLCountryNotConfiguredInStoreError( 160 Function<GraphQLCountryNotConfiguredInStoreError, T> helper) { 161 return helper.apply(this); 162 } 163 164 /** 165 * gives a TypeReference for usage with Jackson DataBind 166 * @return TypeReference 167 */ 168 public static com.fasterxml.jackson.core.type.TypeReference<GraphQLCountryNotConfiguredInStoreError> typeReference() { 169 return new com.fasterxml.jackson.core.type.TypeReference<GraphQLCountryNotConfiguredInStoreError>() { 170 @Override 171 public String toString() { 172 return "TypeReference<GraphQLCountryNotConfiguredInStoreError>"; 173 } 174 }; 175 } 176}