001package com.plivo.api.models.address;
002
003import com.plivo.api.models.base.Creator;
004import com.plivo.api.util.Utils;
005import retrofit2.Call;
006
007public class AddressCreator extends Creator<AddressCreateResponse> {
008
009  private String countryIso;
010  private String alias;
011  private String salutation;
012  private String firstName;
013  private String lastName;
014  private String addressLine1;
015  private String addressLine2;
016  private String city;
017  private String region;
018  private String postalCode;
019  private String file;
020  private Boolean autoCorrectAddress;
021  private String addressProofType;
022
023  public String countryIso() {
024    return countryIso;
025  }
026
027  public String salutation() {
028    return salutation;
029  }
030
031  public String firstName() {
032    return firstName;
033  }
034
035  public String lastName() {
036    return lastName;
037  }
038
039  public String addressLine1() {
040    return addressLine1;
041  }
042
043  public String addressLine2() {
044    return addressLine2;
045  }
046
047  public String city() {
048    return city;
049  }
050
051  public String region() {
052    return region;
053  }
054
055  public String postalCode() {
056    return postalCode;
057  }
058
059  public String file() {
060    return file;
061  }
062
063  public Boolean autoCorrectAddress() {
064    return autoCorrectAddress;
065  }
066
067  public String addressProofType() {
068    return addressProofType;
069  }
070
071  public AddressCreator(String countryIso, String salutation, String firstName, String lastName,
072                        String addressLine1, String addressLine2, String city, String region, String postalCode) {
073    if (!Utils.allNotNull(countryIso, salutation, firstName, lastName,
074      addressLine1, addressLine2, city, region, postalCode)) {
075      throw new IllegalArgumentException("countryIso, salutation, firstName, lastName," +
076        "addressLine1, addressLine2, city, region and postalCode must not be null");
077    }
078    this.countryIso = countryIso;
079    this.salutation = salutation;
080    this.firstName = firstName;
081    this.lastName = lastName;
082    this.addressLine1 = addressLine1;
083    this.addressLine2 = addressLine2;
084    this.city = city;
085    this.region = region;
086    this.postalCode = postalCode;
087  }
088
089  public AddressCreator countryIso(String countryIso) {
090    this.countryIso = countryIso;
091    return this;
092  }
093
094  public AddressCreator alias(String alias) {
095    this.alias = alias;
096    return this;
097  }
098
099  public AddressCreator salutation(String salutation) {
100    this.salutation = salutation;
101    return this;
102  }
103
104  public AddressCreator firstName(String firstName) {
105    this.firstName = firstName;
106    return this;
107  }
108
109  public AddressCreator lastName(String lastName) {
110    this.lastName = lastName;
111    return this;
112  }
113
114  public AddressCreator addressLine1(String addressLine1) {
115    this.addressLine1 = addressLine1;
116    return this;
117  }
118
119  public AddressCreator addressLine2(String addressLine2) {
120    this.addressLine2 = addressLine2;
121    return this;
122  }
123
124  public AddressCreator city(String city) {
125    this.city = city;
126    return this;
127  }
128
129  public AddressCreator region(String region) {
130    this.region = region;
131    return this;
132  }
133
134  public AddressCreator postalCode(String postalCode) {
135    this.postalCode = postalCode;
136    return this;
137  }
138
139  public AddressCreator file(String file) {
140    this.file = file;
141    return this;
142  }
143
144  public AddressCreator autoCorrectAddress(Boolean autoCorrectAddress) {
145    this.autoCorrectAddress = autoCorrectAddress;
146    return this;
147  }
148
149  public AddressCreator addressProofType(String addressProofType) {
150    this.addressProofType = addressProofType;
151    return this;
152  }
153
154  @Override
155  protected Call<AddressCreateResponse> obtainCall() {
156    return client().getApiService().addressCreate(client().getAuthId(), this);
157  }
158}
159
160