001 002package com.commercetools.api.models.error; 003 004import java.util.*; 005import java.util.function.Function; 006 007import javax.annotation.Nullable; 008 009import io.vrap.rmf.base.client.Builder; 010import io.vrap.rmf.base.client.utils.Generated; 011 012/** 013 * GraphQLDuplicateStandalonePriceScopeErrorBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * GraphQLDuplicateStandalonePriceScopeError graphQLDuplicateStandalonePriceScopeError = GraphQLDuplicateStandalonePriceScopeError.builder() 019 * .conflictingStandalonePrice(conflictingStandalonePriceBuilder -> conflictingStandalonePriceBuilder) 020 * .sku("{sku}") 021 * .currency("{currency}") 022 * .build() 023 * </code></pre> 024 * </div> 025 */ 026@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 027public class GraphQLDuplicateStandalonePriceScopeErrorBuilder 028 implements Builder<GraphQLDuplicateStandalonePriceScopeError> { 029 030 private Map<String, java.lang.Object> values = new HashMap<>(); 031 032 private com.commercetools.api.models.standalone_price.StandalonePriceReference conflictingStandalonePrice; 033 034 private String sku; 035 036 private String currency; 037 038 @Nullable 039 private String country; 040 041 @Nullable 042 private com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier customerGroup; 043 044 @Nullable 045 private com.commercetools.api.models.channel.ChannelResourceIdentifier channel; 046 047 @Nullable 048 private java.time.ZonedDateTime validFrom; 049 050 @Nullable 051 private java.time.ZonedDateTime validUntil; 052 053 /** 054 * <p>Error-specific additional fields.</p> 055 * @param values properties to be set 056 * @return Builder 057 */ 058 059 public GraphQLDuplicateStandalonePriceScopeErrorBuilder values(final Map<String, java.lang.Object> values) { 060 this.values = values; 061 return this; 062 } 063 064 /** 065 * <p>Error-specific additional fields.</p> 066 * @param key property name 067 * @param value property value 068 * @return Builder 069 */ 070 071 public GraphQLDuplicateStandalonePriceScopeErrorBuilder addValue(final String key, final java.lang.Object value) { 072 if (this.values == null) { 073 values = new HashMap<>(); 074 } 075 values.put(key, value); 076 return this; 077 } 078 079 /** 080 * <p>Reference to the conflicting Standalone Price.</p> 081 * @param builder function to build the conflictingStandalonePrice value 082 * @return Builder 083 */ 084 085 public GraphQLDuplicateStandalonePriceScopeErrorBuilder conflictingStandalonePrice( 086 Function<com.commercetools.api.models.standalone_price.StandalonePriceReferenceBuilder, com.commercetools.api.models.standalone_price.StandalonePriceReferenceBuilder> builder) { 087 this.conflictingStandalonePrice = builder 088 .apply(com.commercetools.api.models.standalone_price.StandalonePriceReferenceBuilder.of()) 089 .build(); 090 return this; 091 } 092 093 /** 094 * <p>Reference to the conflicting Standalone Price.</p> 095 * @param builder function to build the conflictingStandalonePrice value 096 * @return Builder 097 */ 098 099 public GraphQLDuplicateStandalonePriceScopeErrorBuilder withConflictingStandalonePrice( 100 Function<com.commercetools.api.models.standalone_price.StandalonePriceReferenceBuilder, com.commercetools.api.models.standalone_price.StandalonePriceReference> builder) { 101 this.conflictingStandalonePrice = builder 102 .apply(com.commercetools.api.models.standalone_price.StandalonePriceReferenceBuilder.of()); 103 return this; 104 } 105 106 /** 107 * <p>Reference to the conflicting Standalone Price.</p> 108 * @param conflictingStandalonePrice value to be set 109 * @return Builder 110 */ 111 112 public GraphQLDuplicateStandalonePriceScopeErrorBuilder conflictingStandalonePrice( 113 final com.commercetools.api.models.standalone_price.StandalonePriceReference conflictingStandalonePrice) { 114 this.conflictingStandalonePrice = conflictingStandalonePrice; 115 return this; 116 } 117 118 /** 119 * <p>SKU of the ProductVariant to which the conflicting Standalone Price is associated.</p> 120 * @param sku value to be set 121 * @return Builder 122 */ 123 124 public GraphQLDuplicateStandalonePriceScopeErrorBuilder sku(final String sku) { 125 this.sku = sku; 126 return this; 127 } 128 129 /** 130 * <p>Currency code of the country.</p> 131 * @param currency value to be set 132 * @return Builder 133 */ 134 135 public GraphQLDuplicateStandalonePriceScopeErrorBuilder currency(final String currency) { 136 this.currency = currency; 137 return this; 138 } 139 140 /** 141 * <p>Country code of the geographic location.</p> 142 * @param country value to be set 143 * @return Builder 144 */ 145 146 public GraphQLDuplicateStandalonePriceScopeErrorBuilder country(@Nullable final String country) { 147 this.country = country; 148 return this; 149 } 150 151 /** 152 * <p>CustomerGroup for which the Standalone Price is valid.</p> 153 * @param builder function to build the customerGroup value 154 * @return Builder 155 */ 156 157 public GraphQLDuplicateStandalonePriceScopeErrorBuilder customerGroup( 158 Function<com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifierBuilder, com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifierBuilder> builder) { 159 this.customerGroup = builder 160 .apply(com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifierBuilder.of()) 161 .build(); 162 return this; 163 } 164 165 /** 166 * <p>CustomerGroup for which the Standalone Price is valid.</p> 167 * @param builder function to build the customerGroup value 168 * @return Builder 169 */ 170 171 public GraphQLDuplicateStandalonePriceScopeErrorBuilder withCustomerGroup( 172 Function<com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifierBuilder, com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier> builder) { 173 this.customerGroup = builder 174 .apply(com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifierBuilder.of()); 175 return this; 176 } 177 178 /** 179 * <p>CustomerGroup for which the Standalone Price is valid.</p> 180 * @param customerGroup value to be set 181 * @return Builder 182 */ 183 184 public GraphQLDuplicateStandalonePriceScopeErrorBuilder customerGroup( 185 @Nullable final com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier customerGroup) { 186 this.customerGroup = customerGroup; 187 return this; 188 } 189 190 /** 191 * <p>Channel for which the Standalone Price is valid.</p> 192 * @param builder function to build the channel value 193 * @return Builder 194 */ 195 196 public GraphQLDuplicateStandalonePriceScopeErrorBuilder channel( 197 Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder> builder) { 198 this.channel = builder.apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of()) 199 .build(); 200 return this; 201 } 202 203 /** 204 * <p>Channel for which the Standalone Price is valid.</p> 205 * @param builder function to build the channel value 206 * @return Builder 207 */ 208 209 public GraphQLDuplicateStandalonePriceScopeErrorBuilder withChannel( 210 Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifier> builder) { 211 this.channel = builder.apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of()); 212 return this; 213 } 214 215 /** 216 * <p>Channel for which the Standalone Price is valid.</p> 217 * @param channel value to be set 218 * @return Builder 219 */ 220 221 public GraphQLDuplicateStandalonePriceScopeErrorBuilder channel( 222 @Nullable final com.commercetools.api.models.channel.ChannelResourceIdentifier channel) { 223 this.channel = channel; 224 return this; 225 } 226 227 /** 228 * <p>Date and time (UTC) from which the Standalone Price is valid.</p> 229 * @param validFrom value to be set 230 * @return Builder 231 */ 232 233 public GraphQLDuplicateStandalonePriceScopeErrorBuilder validFrom( 234 @Nullable final java.time.ZonedDateTime validFrom) { 235 this.validFrom = validFrom; 236 return this; 237 } 238 239 /** 240 * <p>Date and time (UTC) until which the Standalone Price is valid.</p> 241 * @param validUntil value to be set 242 * @return Builder 243 */ 244 245 public GraphQLDuplicateStandalonePriceScopeErrorBuilder validUntil( 246 @Nullable final java.time.ZonedDateTime validUntil) { 247 this.validUntil = validUntil; 248 return this; 249 } 250 251 /** 252 * <p>Error-specific additional fields.</p> 253 * @return pattern properties 254 */ 255 256 public Map<String, java.lang.Object> getValues() { 257 return this.values; 258 } 259 260 /** 261 * <p>Reference to the conflicting Standalone Price.</p> 262 * @return conflictingStandalonePrice 263 */ 264 265 public com.commercetools.api.models.standalone_price.StandalonePriceReference getConflictingStandalonePrice() { 266 return this.conflictingStandalonePrice; 267 } 268 269 /** 270 * <p>SKU of the ProductVariant to which the conflicting Standalone Price is associated.</p> 271 * @return sku 272 */ 273 274 public String getSku() { 275 return this.sku; 276 } 277 278 /** 279 * <p>Currency code of the country.</p> 280 * @return currency 281 */ 282 283 public String getCurrency() { 284 return this.currency; 285 } 286 287 /** 288 * <p>Country code of the geographic location.</p> 289 * @return country 290 */ 291 292 @Nullable 293 public String getCountry() { 294 return this.country; 295 } 296 297 /** 298 * <p>CustomerGroup for which the Standalone Price is valid.</p> 299 * @return customerGroup 300 */ 301 302 @Nullable 303 public com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier getCustomerGroup() { 304 return this.customerGroup; 305 } 306 307 /** 308 * <p>Channel for which the Standalone Price is valid.</p> 309 * @return channel 310 */ 311 312 @Nullable 313 public com.commercetools.api.models.channel.ChannelResourceIdentifier getChannel() { 314 return this.channel; 315 } 316 317 /** 318 * <p>Date and time (UTC) from which the Standalone Price is valid.</p> 319 * @return validFrom 320 */ 321 322 @Nullable 323 public java.time.ZonedDateTime getValidFrom() { 324 return this.validFrom; 325 } 326 327 /** 328 * <p>Date and time (UTC) until which the Standalone Price is valid.</p> 329 * @return validUntil 330 */ 331 332 @Nullable 333 public java.time.ZonedDateTime getValidUntil() { 334 return this.validUntil; 335 } 336 337 /** 338 * builds GraphQLDuplicateStandalonePriceScopeError with checking for non-null required values 339 * @return GraphQLDuplicateStandalonePriceScopeError 340 */ 341 public GraphQLDuplicateStandalonePriceScopeError build() { 342 Objects.requireNonNull(conflictingStandalonePrice, 343 GraphQLDuplicateStandalonePriceScopeError.class + ": conflictingStandalonePrice is missing"); 344 Objects.requireNonNull(sku, GraphQLDuplicateStandalonePriceScopeError.class + ": sku is missing"); 345 Objects.requireNonNull(currency, GraphQLDuplicateStandalonePriceScopeError.class + ": currency is missing"); 346 return new GraphQLDuplicateStandalonePriceScopeErrorImpl(values, conflictingStandalonePrice, sku, currency, 347 country, customerGroup, channel, validFrom, validUntil); 348 } 349 350 /** 351 * builds GraphQLDuplicateStandalonePriceScopeError without checking for non-null required values 352 * @return GraphQLDuplicateStandalonePriceScopeError 353 */ 354 public GraphQLDuplicateStandalonePriceScopeError buildUnchecked() { 355 return new GraphQLDuplicateStandalonePriceScopeErrorImpl(values, conflictingStandalonePrice, sku, currency, 356 country, customerGroup, channel, validFrom, validUntil); 357 } 358 359 /** 360 * factory method for an instance of GraphQLDuplicateStandalonePriceScopeErrorBuilder 361 * @return builder 362 */ 363 public static GraphQLDuplicateStandalonePriceScopeErrorBuilder of() { 364 return new GraphQLDuplicateStandalonePriceScopeErrorBuilder(); 365 } 366 367 /** 368 * create builder for GraphQLDuplicateStandalonePriceScopeError instance 369 * @param template instance with prefilled values for the builder 370 * @return builder 371 */ 372 public static GraphQLDuplicateStandalonePriceScopeErrorBuilder of( 373 final GraphQLDuplicateStandalonePriceScopeError template) { 374 GraphQLDuplicateStandalonePriceScopeErrorBuilder builder = new GraphQLDuplicateStandalonePriceScopeErrorBuilder(); 375 builder.values = template.values(); 376 builder.conflictingStandalonePrice = template.getConflictingStandalonePrice(); 377 builder.sku = template.getSku(); 378 builder.currency = template.getCurrency(); 379 builder.country = template.getCountry(); 380 builder.customerGroup = template.getCustomerGroup(); 381 builder.channel = template.getChannel(); 382 builder.validFrom = template.getValidFrom(); 383 builder.validUntil = template.getValidUntil(); 384 return builder; 385 } 386 387}