001
002package com.commercetools.api.models.customer;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009
010import com.fasterxml.jackson.annotation.*;
011import com.fasterxml.jackson.databind.annotation.*;
012
013import io.vrap.rmf.base.client.utils.Generated;
014
015/**
016 *  <p>Sets the default billing address from <code>addresses</code>. The action adds the <code>id</code> of the specified Address to the <code>billingAddressIds</code> if not contained already. Either <code>addressId</code> or <code>addressKey</code> is required.</p>
017 *
018 * <hr>
019 * Example to create an instance using the builder pattern
020 * <div class=code-example>
021 * <pre><code class='java'>
022 *     CustomerSetDefaultBillingAddressAction customerSetDefaultBillingAddressAction = CustomerSetDefaultBillingAddressAction.builder()
023 *             .build()
024 * </code></pre>
025 * </div>
026 */
027@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
028@JsonDeserialize(as = CustomerSetDefaultBillingAddressActionImpl.class)
029public interface CustomerSetDefaultBillingAddressAction extends CustomerUpdateAction {
030
031    /**
032     * discriminator value for CustomerSetDefaultBillingAddressAction
033     */
034    String SET_DEFAULT_BILLING_ADDRESS = "setDefaultBillingAddress";
035
036    /**
037     *  <p><code>id</code> of the Address to become the default billing address.</p>
038     * @return addressId
039     */
040
041    @JsonProperty("addressId")
042    public String getAddressId();
043
044    /**
045     *  <p><code>key</code> of the Address to become the default billing address.</p>
046     * @return addressKey
047     */
048
049    @JsonProperty("addressKey")
050    public String getAddressKey();
051
052    /**
053     *  <p><code>id</code> of the Address to become the default billing address.</p>
054     * @param addressId value to be set
055     */
056
057    public void setAddressId(final String addressId);
058
059    /**
060     *  <p><code>key</code> of the Address to become the default billing address.</p>
061     * @param addressKey value to be set
062     */
063
064    public void setAddressKey(final String addressKey);
065
066    /**
067     * factory method
068     * @return instance of CustomerSetDefaultBillingAddressAction
069     */
070    public static CustomerSetDefaultBillingAddressAction of() {
071        return new CustomerSetDefaultBillingAddressActionImpl();
072    }
073
074    /**
075     * factory method to create a shallow copy CustomerSetDefaultBillingAddressAction
076     * @param template instance to be copied
077     * @return copy instance
078     */
079    public static CustomerSetDefaultBillingAddressAction of(final CustomerSetDefaultBillingAddressAction template) {
080        CustomerSetDefaultBillingAddressActionImpl instance = new CustomerSetDefaultBillingAddressActionImpl();
081        instance.setAddressId(template.getAddressId());
082        instance.setAddressKey(template.getAddressKey());
083        return instance;
084    }
085
086    /**
087     * factory method to create a deep copy of CustomerSetDefaultBillingAddressAction
088     * @param template instance to be copied
089     * @return copy instance
090     */
091    @Nullable
092    public static CustomerSetDefaultBillingAddressAction deepCopy(
093            @Nullable final CustomerSetDefaultBillingAddressAction template) {
094        if (template == null) {
095            return null;
096        }
097        CustomerSetDefaultBillingAddressActionImpl instance = new CustomerSetDefaultBillingAddressActionImpl();
098        instance.setAddressId(template.getAddressId());
099        instance.setAddressKey(template.getAddressKey());
100        return instance;
101    }
102
103    /**
104     * builder factory method for CustomerSetDefaultBillingAddressAction
105     * @return builder
106     */
107    public static CustomerSetDefaultBillingAddressActionBuilder builder() {
108        return CustomerSetDefaultBillingAddressActionBuilder.of();
109    }
110
111    /**
112     * create builder for CustomerSetDefaultBillingAddressAction instance
113     * @param template instance with prefilled values for the builder
114     * @return builder
115     */
116    public static CustomerSetDefaultBillingAddressActionBuilder builder(
117            final CustomerSetDefaultBillingAddressAction template) {
118        return CustomerSetDefaultBillingAddressActionBuilder.of(template);
119    }
120
121    /**
122     * accessor map function
123     * @param <T> mapped type
124     * @param helper function to map the object
125     * @return mapped value
126     */
127    default <T> T withCustomerSetDefaultBillingAddressAction(
128            Function<CustomerSetDefaultBillingAddressAction, T> helper) {
129        return helper.apply(this);
130    }
131
132    /**
133     * gives a TypeReference for usage with Jackson DataBind
134     * @return TypeReference
135     */
136    public static com.fasterxml.jackson.core.type.TypeReference<CustomerSetDefaultBillingAddressAction> typeReference() {
137        return new com.fasterxml.jackson.core.type.TypeReference<CustomerSetDefaultBillingAddressAction>() {
138            @Override
139            public String toString() {
140                return "TypeReference<CustomerSetDefaultBillingAddressAction>";
141            }
142        };
143    }
144}