001 002package com.commercetools.api.models.error; 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.ChannelResourceIdentifier; 014import com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier; 015import com.commercetools.api.models.standalone_price.StandalonePriceReference; 016import com.fasterxml.jackson.annotation.*; 017import com.fasterxml.jackson.databind.annotation.*; 018 019import io.vrap.rmf.base.client.utils.Generated; 020 021/** 022 * <p>Returned when a given Price validity period conflicts with an existing one. Every Standalone Price associated with the same SKU and with the same combination of currency, country, Customer Group, and Channel, must have non-overlapping validity periods (<code>validFrom</code> and <code>validUntil</code>).</p> 023 * <p>The error is returned as a failed response to the Create StandalonePrice request.</p> 024 * 025 * <hr> 026 * Example to create an instance using the builder pattern 027 * <div class=code-example> 028 * <pre><code class='java'> 029 * GraphQLOverlappingStandalonePriceValidityError graphQLOverlappingStandalonePriceValidityError = GraphQLOverlappingStandalonePriceValidityError.builder() 030 * .conflictingStandalonePrice(conflictingStandalonePriceBuilder -> conflictingStandalonePriceBuilder) 031 * .sku("{sku}") 032 * .currency("{currency}") 033 * .build() 034 * </code></pre> 035 * </div> 036 */ 037@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 038@JsonDeserialize(as = GraphQLOverlappingStandalonePriceValidityErrorImpl.class) 039public interface GraphQLOverlappingStandalonePriceValidityError extends GraphQLErrorObject { 040 041 /** 042 * discriminator value for GraphQLOverlappingStandalonePriceValidityError 043 */ 044 String OVERLAPPING_STANDALONE_PRICE_VALIDITY = "OverlappingStandalonePriceValidity"; 045 046 /** 047 * 048 * @return code 049 */ 050 @NotNull 051 @JsonProperty("code") 052 public String getCode(); 053 054 /** 055 * <p>Reference to the conflicting Standalone Price.</p> 056 * @return conflictingStandalonePrice 057 */ 058 @NotNull 059 @Valid 060 @JsonProperty("conflictingStandalonePrice") 061 public StandalonePriceReference getConflictingStandalonePrice(); 062 063 /** 064 * <p>SKU of the ProductVariant to which the conflicting Standalone Price is associated.</p> 065 * @return sku 066 */ 067 @NotNull 068 @JsonProperty("sku") 069 public String getSku(); 070 071 /** 072 * <p>Currency code of the country.</p> 073 * @return currency 074 */ 075 @NotNull 076 @JsonProperty("currency") 077 public String getCurrency(); 078 079 /** 080 * <p>Country code of the geographic location.</p> 081 * @return country 082 */ 083 084 @JsonProperty("country") 085 public String getCountry(); 086 087 /** 088 * <p>CustomerGroup for which the Standalone Price is valid.</p> 089 * @return customerGroup 090 */ 091 @Valid 092 @JsonProperty("customerGroup") 093 public CustomerGroupResourceIdentifier getCustomerGroup(); 094 095 /** 096 * <p>Channel for which the Standalone Price is valid.</p> 097 * @return channel 098 */ 099 @Valid 100 @JsonProperty("channel") 101 public ChannelResourceIdentifier getChannel(); 102 103 /** 104 * <p>Date and time (UTC) from which the Standalone Price is valid.</p> 105 * @return validFrom 106 */ 107 108 @JsonProperty("validFrom") 109 public ZonedDateTime getValidFrom(); 110 111 /** 112 * <p>Date and time (UTC) until which the Standalone Price is valid.</p> 113 * @return validUntil 114 */ 115 116 @JsonProperty("validUntil") 117 public ZonedDateTime getValidUntil(); 118 119 /** 120 * <p>Date and time (UTC) from which the conflicting Standalone Price is valid.</p> 121 * @return conflictingValidFrom 122 */ 123 124 @JsonProperty("conflictingValidFrom") 125 public ZonedDateTime getConflictingValidFrom(); 126 127 /** 128 * <p>Date and time (UTC) until which the conflicting Standalone Price is valid.</p> 129 * @return conflictingValidUntil 130 */ 131 132 @JsonProperty("conflictingValidUntil") 133 public ZonedDateTime getConflictingValidUntil(); 134 135 /** 136 * <p>Reference to the conflicting Standalone Price.</p> 137 * @param conflictingStandalonePrice value to be set 138 */ 139 140 public void setConflictingStandalonePrice(final StandalonePriceReference conflictingStandalonePrice); 141 142 /** 143 * <p>SKU of the ProductVariant to which the conflicting Standalone Price is associated.</p> 144 * @param sku value to be set 145 */ 146 147 public void setSku(final String sku); 148 149 /** 150 * <p>Currency code of the country.</p> 151 * @param currency value to be set 152 */ 153 154 public void setCurrency(final String currency); 155 156 /** 157 * <p>Country code of the geographic location.</p> 158 * @param country value to be set 159 */ 160 161 public void setCountry(final String country); 162 163 /** 164 * <p>CustomerGroup for which the Standalone Price is valid.</p> 165 * @param customerGroup value to be set 166 */ 167 168 public void setCustomerGroup(final CustomerGroupResourceIdentifier customerGroup); 169 170 /** 171 * <p>Channel for which the Standalone Price is valid.</p> 172 * @param channel value to be set 173 */ 174 175 public void setChannel(final ChannelResourceIdentifier channel); 176 177 /** 178 * <p>Date and time (UTC) from which the Standalone Price is valid.</p> 179 * @param validFrom value to be set 180 */ 181 182 public void setValidFrom(final ZonedDateTime validFrom); 183 184 /** 185 * <p>Date and time (UTC) until which the Standalone Price is valid.</p> 186 * @param validUntil value to be set 187 */ 188 189 public void setValidUntil(final ZonedDateTime validUntil); 190 191 /** 192 * <p>Date and time (UTC) from which the conflicting Standalone Price is valid.</p> 193 * @param conflictingValidFrom value to be set 194 */ 195 196 public void setConflictingValidFrom(final ZonedDateTime conflictingValidFrom); 197 198 /** 199 * <p>Date and time (UTC) until which the conflicting Standalone Price is valid.</p> 200 * @param conflictingValidUntil value to be set 201 */ 202 203 public void setConflictingValidUntil(final ZonedDateTime conflictingValidUntil); 204 205 /** 206 * factory method 207 * @return instance of GraphQLOverlappingStandalonePriceValidityError 208 */ 209 public static GraphQLOverlappingStandalonePriceValidityError of() { 210 return new GraphQLOverlappingStandalonePriceValidityErrorImpl(); 211 } 212 213 /** 214 * factory method to create a shallow copy GraphQLOverlappingStandalonePriceValidityError 215 * @param template instance to be copied 216 * @return copy instance 217 */ 218 public static GraphQLOverlappingStandalonePriceValidityError of( 219 final GraphQLOverlappingStandalonePriceValidityError template) { 220 GraphQLOverlappingStandalonePriceValidityErrorImpl instance = new GraphQLOverlappingStandalonePriceValidityErrorImpl(); 221 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 222 instance.setConflictingStandalonePrice(template.getConflictingStandalonePrice()); 223 instance.setSku(template.getSku()); 224 instance.setCurrency(template.getCurrency()); 225 instance.setCountry(template.getCountry()); 226 instance.setCustomerGroup(template.getCustomerGroup()); 227 instance.setChannel(template.getChannel()); 228 instance.setValidFrom(template.getValidFrom()); 229 instance.setValidUntil(template.getValidUntil()); 230 instance.setConflictingValidFrom(template.getConflictingValidFrom()); 231 instance.setConflictingValidUntil(template.getConflictingValidUntil()); 232 return instance; 233 } 234 235 /** 236 * factory method to create a deep copy of GraphQLOverlappingStandalonePriceValidityError 237 * @param template instance to be copied 238 * @return copy instance 239 */ 240 @Nullable 241 public static GraphQLOverlappingStandalonePriceValidityError deepCopy( 242 @Nullable final GraphQLOverlappingStandalonePriceValidityError template) { 243 if (template == null) { 244 return null; 245 } 246 GraphQLOverlappingStandalonePriceValidityErrorImpl instance = new GraphQLOverlappingStandalonePriceValidityErrorImpl(); 247 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 248 instance.setConflictingStandalonePrice(com.commercetools.api.models.standalone_price.StandalonePriceReference 249 .deepCopy(template.getConflictingStandalonePrice())); 250 instance.setSku(template.getSku()); 251 instance.setCurrency(template.getCurrency()); 252 instance.setCountry(template.getCountry()); 253 instance.setCustomerGroup(com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier 254 .deepCopy(template.getCustomerGroup())); 255 instance.setChannel( 256 com.commercetools.api.models.channel.ChannelResourceIdentifier.deepCopy(template.getChannel())); 257 instance.setValidFrom(template.getValidFrom()); 258 instance.setValidUntil(template.getValidUntil()); 259 instance.setConflictingValidFrom(template.getConflictingValidFrom()); 260 instance.setConflictingValidUntil(template.getConflictingValidUntil()); 261 return instance; 262 } 263 264 /** 265 * builder factory method for GraphQLOverlappingStandalonePriceValidityError 266 * @return builder 267 */ 268 public static GraphQLOverlappingStandalonePriceValidityErrorBuilder builder() { 269 return GraphQLOverlappingStandalonePriceValidityErrorBuilder.of(); 270 } 271 272 /** 273 * create builder for GraphQLOverlappingStandalonePriceValidityError instance 274 * @param template instance with prefilled values for the builder 275 * @return builder 276 */ 277 public static GraphQLOverlappingStandalonePriceValidityErrorBuilder builder( 278 final GraphQLOverlappingStandalonePriceValidityError template) { 279 return GraphQLOverlappingStandalonePriceValidityErrorBuilder.of(template); 280 } 281 282 /** 283 * accessor map function 284 * @param <T> mapped type 285 * @param helper function to map the object 286 * @return mapped value 287 */ 288 default <T> T withGraphQLOverlappingStandalonePriceValidityError( 289 Function<GraphQLOverlappingStandalonePriceValidityError, T> helper) { 290 return helper.apply(this); 291 } 292 293 /** 294 * gives a TypeReference for usage with Jackson DataBind 295 * @return TypeReference 296 */ 297 public static com.fasterxml.jackson.core.type.TypeReference<GraphQLOverlappingStandalonePriceValidityError> typeReference() { 298 return new com.fasterxml.jackson.core.type.TypeReference<GraphQLOverlappingStandalonePriceValidityError>() { 299 @Override 300 public String toString() { 301 return "TypeReference<GraphQLOverlappingStandalonePriceValidityError>"; 302 } 303 }; 304 } 305}