001package com.box.sdkgen.schemas.signrequestcreatesigner;
002
003import com.box.sdkgen.internal.Nullable;
004import com.box.sdkgen.internal.NullableFieldTracker;
005import com.box.sdkgen.internal.SerializableObject;
006import com.box.sdkgen.serialization.json.EnumWrapper;
007import com.fasterxml.jackson.annotation.JsonFilter;
008import com.fasterxml.jackson.annotation.JsonProperty;
009import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
010import com.fasterxml.jackson.databind.annotation.JsonSerialize;
011import java.util.Objects;
012
013/** The schema for a Signer object used in for creating a Box Sign request object. */
014@JsonFilter("nullablePropertyFilter")
015public class SignRequestCreateSigner extends SerializableObject {
016
017  /**
018   * Email address of the signer. The email address of the signer is required when making signature
019   * requests, except when using templates that are configured to include emails.
020   */
021  @Nullable protected String email;
022
023  /**
024   * Defines the role of the signer in the signature request. A `signer` must sign the document and
025   * an `approver` must approve the document. A `final_copy_reader` only receives the final signed
026   * document and signing log.
027   */
028  @JsonDeserialize(
029      using = SignRequestCreateSignerRoleField.SignRequestCreateSignerRoleFieldDeserializer.class)
030  @JsonSerialize(
031      using = SignRequestCreateSignerRoleField.SignRequestCreateSignerRoleFieldSerializer.class)
032  protected EnumWrapper<SignRequestCreateSignerRoleField> role;
033
034  /**
035   * Used in combination with an embed URL for a sender. After the sender signs, they are redirected
036   * to the next `in_person` signer.
037   */
038  @JsonProperty("is_in_person")
039  protected Boolean isInPerson;
040
041  /** Order of the signer. */
042  protected Long order;
043
044  /**
045   * User ID for the signer in an external application responsible for authentication when accessing
046   * the embed URL.
047   */
048  @JsonProperty("embed_url_external_user_id")
049  @Nullable
050  protected String embedUrlExternalUserId;
051
052  /**
053   * The URL that a signer will be redirected to after signing a document. Defining this URL
054   * overrides default or global redirect URL settings for a specific signer. If no declined
055   * redirect URL is specified, this URL will be used for decline actions as well.
056   */
057  @JsonProperty("redirect_url")
058  @Nullable
059  protected String redirectUrl;
060
061  /**
062   * The URL that a signer will be redirect to after declining to sign a document. Defining this URL
063   * overrides default or global declined redirect URL settings for a specific signer.
064   */
065  @JsonProperty("declined_redirect_url")
066  @Nullable
067  protected String declinedRedirectUrl;
068
069  /**
070   * If set to true, the signer will need to log in to a Box account before signing the request. If
071   * the signer does not have an existing account, they will have the option to create a free Box
072   * account.
073   */
074  @JsonProperty("login_required")
075  @Nullable
076  protected Boolean loginRequired;
077
078  /**
079   * If set, this phone number will be used to verify the signer via two-factor authentication
080   * before they are able to sign the document. Cannot be selected in combination with
081   * `login_required`.
082   */
083  @JsonProperty("verification_phone_number")
084  @Nullable
085  protected String verificationPhoneNumber;
086
087  /**
088   * If set, the signer is required to enter the password before they are able to sign a document.
089   * This field is write only.
090   */
091  @Nullable protected String password;
092
093  /**
094   * If set, signers who have the same value will be assigned to the same input and to the same
095   * signer group. A signer group is not a Box Group. It is an entity that belongs to a Sign Request
096   * and can only be used/accessed within this Sign Request. A signer group is expected to have more
097   * than one signer. If the provided value is only used for one signer, this value will be ignored
098   * and request will be handled as it was intended for an individual signer. The value provided can
099   * be any string and only used to determine which signers belongs to same group. A successful
100   * response will provide a generated UUID value instead for signers in the same signer group.
101   */
102  @JsonProperty("signer_group_id")
103  @Nullable
104  protected String signerGroupId;
105
106  /** If true, no emails about the sign request will be sent. */
107  @JsonProperty("suppress_notifications")
108  @Nullable
109  protected Boolean suppressNotifications;
110
111  /**
112   * The language of the user, formatted in modified version of the [ISO
113   * 639-1](https://developer.box.com/guides/api-calls/language-codes) format.
114   */
115  @Nullable protected String language;
116
117  public SignRequestCreateSigner() {
118    super();
119  }
120
121  protected SignRequestCreateSigner(Builder builder) {
122    super();
123    this.email = builder.email;
124    this.role = builder.role;
125    this.isInPerson = builder.isInPerson;
126    this.order = builder.order;
127    this.embedUrlExternalUserId = builder.embedUrlExternalUserId;
128    this.redirectUrl = builder.redirectUrl;
129    this.declinedRedirectUrl = builder.declinedRedirectUrl;
130    this.loginRequired = builder.loginRequired;
131    this.verificationPhoneNumber = builder.verificationPhoneNumber;
132    this.password = builder.password;
133    this.signerGroupId = builder.signerGroupId;
134    this.suppressNotifications = builder.suppressNotifications;
135    this.language = builder.language;
136    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
137  }
138
139  public String getEmail() {
140    return email;
141  }
142
143  public EnumWrapper<SignRequestCreateSignerRoleField> getRole() {
144    return role;
145  }
146
147  public Boolean getIsInPerson() {
148    return isInPerson;
149  }
150
151  public Long getOrder() {
152    return order;
153  }
154
155  public String getEmbedUrlExternalUserId() {
156    return embedUrlExternalUserId;
157  }
158
159  public String getRedirectUrl() {
160    return redirectUrl;
161  }
162
163  public String getDeclinedRedirectUrl() {
164    return declinedRedirectUrl;
165  }
166
167  public Boolean getLoginRequired() {
168    return loginRequired;
169  }
170
171  public String getVerificationPhoneNumber() {
172    return verificationPhoneNumber;
173  }
174
175  public String getPassword() {
176    return password;
177  }
178
179  public String getSignerGroupId() {
180    return signerGroupId;
181  }
182
183  public Boolean getSuppressNotifications() {
184    return suppressNotifications;
185  }
186
187  public String getLanguage() {
188    return language;
189  }
190
191  @Override
192  public boolean equals(Object o) {
193    if (this == o) {
194      return true;
195    }
196    if (o == null || getClass() != o.getClass()) {
197      return false;
198    }
199    SignRequestCreateSigner casted = (SignRequestCreateSigner) o;
200    return Objects.equals(email, casted.email)
201        && Objects.equals(role, casted.role)
202        && Objects.equals(isInPerson, casted.isInPerson)
203        && Objects.equals(order, casted.order)
204        && Objects.equals(embedUrlExternalUserId, casted.embedUrlExternalUserId)
205        && Objects.equals(redirectUrl, casted.redirectUrl)
206        && Objects.equals(declinedRedirectUrl, casted.declinedRedirectUrl)
207        && Objects.equals(loginRequired, casted.loginRequired)
208        && Objects.equals(verificationPhoneNumber, casted.verificationPhoneNumber)
209        && Objects.equals(password, casted.password)
210        && Objects.equals(signerGroupId, casted.signerGroupId)
211        && Objects.equals(suppressNotifications, casted.suppressNotifications)
212        && Objects.equals(language, casted.language);
213  }
214
215  @Override
216  public int hashCode() {
217    return Objects.hash(
218        email,
219        role,
220        isInPerson,
221        order,
222        embedUrlExternalUserId,
223        redirectUrl,
224        declinedRedirectUrl,
225        loginRequired,
226        verificationPhoneNumber,
227        password,
228        signerGroupId,
229        suppressNotifications,
230        language);
231  }
232
233  @Override
234  public String toString() {
235    return "SignRequestCreateSigner{"
236        + "email='"
237        + email
238        + '\''
239        + ", "
240        + "role='"
241        + role
242        + '\''
243        + ", "
244        + "isInPerson='"
245        + isInPerson
246        + '\''
247        + ", "
248        + "order='"
249        + order
250        + '\''
251        + ", "
252        + "embedUrlExternalUserId='"
253        + embedUrlExternalUserId
254        + '\''
255        + ", "
256        + "redirectUrl='"
257        + redirectUrl
258        + '\''
259        + ", "
260        + "declinedRedirectUrl='"
261        + declinedRedirectUrl
262        + '\''
263        + ", "
264        + "loginRequired='"
265        + loginRequired
266        + '\''
267        + ", "
268        + "verificationPhoneNumber='"
269        + verificationPhoneNumber
270        + '\''
271        + ", "
272        + "password='"
273        + password
274        + '\''
275        + ", "
276        + "signerGroupId='"
277        + signerGroupId
278        + '\''
279        + ", "
280        + "suppressNotifications='"
281        + suppressNotifications
282        + '\''
283        + ", "
284        + "language='"
285        + language
286        + '\''
287        + "}";
288  }
289
290  public static class Builder extends NullableFieldTracker {
291
292    protected String email;
293
294    protected EnumWrapper<SignRequestCreateSignerRoleField> role;
295
296    protected Boolean isInPerson;
297
298    protected Long order;
299
300    protected String embedUrlExternalUserId;
301
302    protected String redirectUrl;
303
304    protected String declinedRedirectUrl;
305
306    protected Boolean loginRequired;
307
308    protected String verificationPhoneNumber;
309
310    protected String password;
311
312    protected String signerGroupId;
313
314    protected Boolean suppressNotifications;
315
316    protected String language;
317
318    public Builder email(String email) {
319      this.email = email;
320      this.markNullableFieldAsSet("email");
321      return this;
322    }
323
324    public Builder role(SignRequestCreateSignerRoleField role) {
325      this.role = new EnumWrapper<SignRequestCreateSignerRoleField>(role);
326      return this;
327    }
328
329    public Builder role(EnumWrapper<SignRequestCreateSignerRoleField> role) {
330      this.role = role;
331      return this;
332    }
333
334    public Builder isInPerson(Boolean isInPerson) {
335      this.isInPerson = isInPerson;
336      return this;
337    }
338
339    public Builder order(Long order) {
340      this.order = order;
341      return this;
342    }
343
344    public Builder embedUrlExternalUserId(String embedUrlExternalUserId) {
345      this.embedUrlExternalUserId = embedUrlExternalUserId;
346      this.markNullableFieldAsSet("embed_url_external_user_id");
347      return this;
348    }
349
350    public Builder redirectUrl(String redirectUrl) {
351      this.redirectUrl = redirectUrl;
352      this.markNullableFieldAsSet("redirect_url");
353      return this;
354    }
355
356    public Builder declinedRedirectUrl(String declinedRedirectUrl) {
357      this.declinedRedirectUrl = declinedRedirectUrl;
358      this.markNullableFieldAsSet("declined_redirect_url");
359      return this;
360    }
361
362    public Builder loginRequired(Boolean loginRequired) {
363      this.loginRequired = loginRequired;
364      this.markNullableFieldAsSet("login_required");
365      return this;
366    }
367
368    public Builder verificationPhoneNumber(String verificationPhoneNumber) {
369      this.verificationPhoneNumber = verificationPhoneNumber;
370      this.markNullableFieldAsSet("verification_phone_number");
371      return this;
372    }
373
374    public Builder password(String password) {
375      this.password = password;
376      this.markNullableFieldAsSet("password");
377      return this;
378    }
379
380    public Builder signerGroupId(String signerGroupId) {
381      this.signerGroupId = signerGroupId;
382      this.markNullableFieldAsSet("signer_group_id");
383      return this;
384    }
385
386    public Builder suppressNotifications(Boolean suppressNotifications) {
387      this.suppressNotifications = suppressNotifications;
388      this.markNullableFieldAsSet("suppress_notifications");
389      return this;
390    }
391
392    public Builder language(String language) {
393      this.language = language;
394      this.markNullableFieldAsSet("language");
395      return this;
396    }
397
398    public SignRequestCreateSigner build() {
399      return new SignRequestCreateSigner(this);
400    }
401  }
402}