001package com.box.sdkgen.schemas.signrequestbase;
002
003import com.box.sdkgen.internal.Nullable;
004import com.box.sdkgen.internal.NullableFieldTracker;
005import com.box.sdkgen.internal.SerializableObject;
006import com.box.sdkgen.schemas.signrequestprefilltag.SignRequestPrefillTag;
007import com.fasterxml.jackson.annotation.JsonFilter;
008import com.fasterxml.jackson.annotation.JsonProperty;
009import java.util.List;
010import java.util.Objects;
011
012/** A standard representation of a signature request object. */
013@JsonFilter("nullablePropertyFilter")
014public class SignRequestBase extends SerializableObject {
015
016  /**
017   * Indicates if the sender should receive a `prepare_url` in the response to complete document
018   * preparation using the UI.
019   */
020  @JsonProperty("is_document_preparation_needed")
021  protected Boolean isDocumentPreparationNeeded;
022
023  /**
024   * When specified, the signature request will be redirected to this url when a document is signed.
025   */
026  @JsonProperty("redirect_url")
027  @Nullable
028  protected String redirectUrl;
029
030  /** The uri that a signer will be redirected to after declining to sign a document. */
031  @JsonProperty("declined_redirect_url")
032  @Nullable
033  protected String declinedRedirectUrl;
034
035  /** Disables the usage of signatures generated by typing (text). */
036  @JsonProperty("are_text_signatures_enabled")
037  protected Boolean areTextSignaturesEnabled;
038
039  /**
040   * Subject of sign request email. This is cleaned by sign request. If this field is not passed, a
041   * default subject will be used.
042   */
043  @JsonProperty("email_subject")
044  @Nullable
045  protected String emailSubject;
046
047  /**
048   * Message to include in sign request email. The field is cleaned through sanitization of specific
049   * characters. However, some html tags are allowed. Links included in the message are also
050   * converted to hyperlinks in the email. The message may contain the following html tags including
051   * `a`, `abbr`, `acronym`, `b`, `blockquote`, `code`, `em`, `i`, `ul`, `li`, `ol`, and `strong`.
052   * Be aware that when the text to html ratio is too high, the email may end up in spam filters.
053   * Custom styles on these tags are not allowed. If this field is not passed, a default message
054   * will be used.
055   */
056  @JsonProperty("email_message")
057  @Nullable
058  protected String emailMessage;
059
060  /**
061   * Reminds signers to sign a document on day 3, 8, 13 and 18. Reminders are only sent to
062   * outstanding signers.
063   */
064  @JsonProperty("are_reminders_enabled")
065  protected Boolean areRemindersEnabled;
066
067  /** Name of the signature request. */
068  protected String name;
069
070  /**
071   * When a document contains sign-related tags in the content, you can prefill them using this
072   * `prefill_tags` by referencing the 'id' of the tag as the `external_id` field of the prefill
073   * tag.
074   */
075  @JsonProperty("prefill_tags")
076  protected List<SignRequestPrefillTag> prefillTags;
077
078  /**
079   * Set the number of days after which the created signature request will automatically expire if
080   * not completed. By default, we do not apply any expiration date on signature requests, and the
081   * signature request does not expire.
082   */
083  @JsonProperty("days_valid")
084  @Nullable
085  protected Long daysValid;
086
087  /**
088   * This can be used to reference an ID in an external system that the sign request is related to.
089   */
090  @JsonProperty("external_id")
091  @Nullable
092  protected String externalId;
093
094  /**
095   * When a signature request is created from a template this field will indicate the id of that
096   * template.
097   */
098  @JsonProperty("template_id")
099  @Nullable
100  protected String templateId;
101
102  /**
103   * Used as an optional system name to appear in the signature log next to the signers who have
104   * been assigned the `embed_url_external_id`.
105   */
106  @JsonProperty("external_system_name")
107  @Nullable
108  protected String externalSystemName;
109
110  /**
111   * The flow type of the sign request. Values can include `standard` or `cfr11`. When not specified
112   * during creation, a default is chosen based on admin settings.
113   */
114  @JsonProperty("request_flow")
115  @Nullable
116  protected String requestFlow;
117
118  public SignRequestBase() {
119    super();
120  }
121
122  protected SignRequestBase(Builder builder) {
123    super();
124    this.isDocumentPreparationNeeded = builder.isDocumentPreparationNeeded;
125    this.redirectUrl = builder.redirectUrl;
126    this.declinedRedirectUrl = builder.declinedRedirectUrl;
127    this.areTextSignaturesEnabled = builder.areTextSignaturesEnabled;
128    this.emailSubject = builder.emailSubject;
129    this.emailMessage = builder.emailMessage;
130    this.areRemindersEnabled = builder.areRemindersEnabled;
131    this.name = builder.name;
132    this.prefillTags = builder.prefillTags;
133    this.daysValid = builder.daysValid;
134    this.externalId = builder.externalId;
135    this.templateId = builder.templateId;
136    this.externalSystemName = builder.externalSystemName;
137    this.requestFlow = builder.requestFlow;
138    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
139  }
140
141  public Boolean getIsDocumentPreparationNeeded() {
142    return isDocumentPreparationNeeded;
143  }
144
145  public String getRedirectUrl() {
146    return redirectUrl;
147  }
148
149  public String getDeclinedRedirectUrl() {
150    return declinedRedirectUrl;
151  }
152
153  public Boolean getAreTextSignaturesEnabled() {
154    return areTextSignaturesEnabled;
155  }
156
157  public String getEmailSubject() {
158    return emailSubject;
159  }
160
161  public String getEmailMessage() {
162    return emailMessage;
163  }
164
165  public Boolean getAreRemindersEnabled() {
166    return areRemindersEnabled;
167  }
168
169  public String getName() {
170    return name;
171  }
172
173  public List<SignRequestPrefillTag> getPrefillTags() {
174    return prefillTags;
175  }
176
177  public Long getDaysValid() {
178    return daysValid;
179  }
180
181  public String getExternalId() {
182    return externalId;
183  }
184
185  public String getTemplateId() {
186    return templateId;
187  }
188
189  public String getExternalSystemName() {
190    return externalSystemName;
191  }
192
193  public String getRequestFlow() {
194    return requestFlow;
195  }
196
197  @Override
198  public boolean equals(Object o) {
199    if (this == o) {
200      return true;
201    }
202    if (o == null || getClass() != o.getClass()) {
203      return false;
204    }
205    SignRequestBase casted = (SignRequestBase) o;
206    return Objects.equals(isDocumentPreparationNeeded, casted.isDocumentPreparationNeeded)
207        && Objects.equals(redirectUrl, casted.redirectUrl)
208        && Objects.equals(declinedRedirectUrl, casted.declinedRedirectUrl)
209        && Objects.equals(areTextSignaturesEnabled, casted.areTextSignaturesEnabled)
210        && Objects.equals(emailSubject, casted.emailSubject)
211        && Objects.equals(emailMessage, casted.emailMessage)
212        && Objects.equals(areRemindersEnabled, casted.areRemindersEnabled)
213        && Objects.equals(name, casted.name)
214        && Objects.equals(prefillTags, casted.prefillTags)
215        && Objects.equals(daysValid, casted.daysValid)
216        && Objects.equals(externalId, casted.externalId)
217        && Objects.equals(templateId, casted.templateId)
218        && Objects.equals(externalSystemName, casted.externalSystemName)
219        && Objects.equals(requestFlow, casted.requestFlow);
220  }
221
222  @Override
223  public int hashCode() {
224    return Objects.hash(
225        isDocumentPreparationNeeded,
226        redirectUrl,
227        declinedRedirectUrl,
228        areTextSignaturesEnabled,
229        emailSubject,
230        emailMessage,
231        areRemindersEnabled,
232        name,
233        prefillTags,
234        daysValid,
235        externalId,
236        templateId,
237        externalSystemName,
238        requestFlow);
239  }
240
241  @Override
242  public String toString() {
243    return "SignRequestBase{"
244        + "isDocumentPreparationNeeded='"
245        + isDocumentPreparationNeeded
246        + '\''
247        + ", "
248        + "redirectUrl='"
249        + redirectUrl
250        + '\''
251        + ", "
252        + "declinedRedirectUrl='"
253        + declinedRedirectUrl
254        + '\''
255        + ", "
256        + "areTextSignaturesEnabled='"
257        + areTextSignaturesEnabled
258        + '\''
259        + ", "
260        + "emailSubject='"
261        + emailSubject
262        + '\''
263        + ", "
264        + "emailMessage='"
265        + emailMessage
266        + '\''
267        + ", "
268        + "areRemindersEnabled='"
269        + areRemindersEnabled
270        + '\''
271        + ", "
272        + "name='"
273        + name
274        + '\''
275        + ", "
276        + "prefillTags='"
277        + prefillTags
278        + '\''
279        + ", "
280        + "daysValid='"
281        + daysValid
282        + '\''
283        + ", "
284        + "externalId='"
285        + externalId
286        + '\''
287        + ", "
288        + "templateId='"
289        + templateId
290        + '\''
291        + ", "
292        + "externalSystemName='"
293        + externalSystemName
294        + '\''
295        + ", "
296        + "requestFlow='"
297        + requestFlow
298        + '\''
299        + "}";
300  }
301
302  public static class Builder extends NullableFieldTracker {
303
304    protected Boolean isDocumentPreparationNeeded;
305
306    protected String redirectUrl;
307
308    protected String declinedRedirectUrl;
309
310    protected Boolean areTextSignaturesEnabled;
311
312    protected String emailSubject;
313
314    protected String emailMessage;
315
316    protected Boolean areRemindersEnabled;
317
318    protected String name;
319
320    protected List<SignRequestPrefillTag> prefillTags;
321
322    protected Long daysValid;
323
324    protected String externalId;
325
326    protected String templateId;
327
328    protected String externalSystemName;
329
330    protected String requestFlow;
331
332    public Builder isDocumentPreparationNeeded(Boolean isDocumentPreparationNeeded) {
333      this.isDocumentPreparationNeeded = isDocumentPreparationNeeded;
334      return this;
335    }
336
337    public Builder redirectUrl(String redirectUrl) {
338      this.redirectUrl = redirectUrl;
339      this.markNullableFieldAsSet("redirect_url");
340      return this;
341    }
342
343    public Builder declinedRedirectUrl(String declinedRedirectUrl) {
344      this.declinedRedirectUrl = declinedRedirectUrl;
345      this.markNullableFieldAsSet("declined_redirect_url");
346      return this;
347    }
348
349    public Builder areTextSignaturesEnabled(Boolean areTextSignaturesEnabled) {
350      this.areTextSignaturesEnabled = areTextSignaturesEnabled;
351      return this;
352    }
353
354    public Builder emailSubject(String emailSubject) {
355      this.emailSubject = emailSubject;
356      this.markNullableFieldAsSet("email_subject");
357      return this;
358    }
359
360    public Builder emailMessage(String emailMessage) {
361      this.emailMessage = emailMessage;
362      this.markNullableFieldAsSet("email_message");
363      return this;
364    }
365
366    public Builder areRemindersEnabled(Boolean areRemindersEnabled) {
367      this.areRemindersEnabled = areRemindersEnabled;
368      return this;
369    }
370
371    public Builder name(String name) {
372      this.name = name;
373      return this;
374    }
375
376    public Builder prefillTags(List<SignRequestPrefillTag> prefillTags) {
377      this.prefillTags = prefillTags;
378      return this;
379    }
380
381    public Builder daysValid(Long daysValid) {
382      this.daysValid = daysValid;
383      this.markNullableFieldAsSet("days_valid");
384      return this;
385    }
386
387    public Builder externalId(String externalId) {
388      this.externalId = externalId;
389      this.markNullableFieldAsSet("external_id");
390      return this;
391    }
392
393    public Builder templateId(String templateId) {
394      this.templateId = templateId;
395      this.markNullableFieldAsSet("template_id");
396      return this;
397    }
398
399    public Builder externalSystemName(String externalSystemName) {
400      this.externalSystemName = externalSystemName;
401      this.markNullableFieldAsSet("external_system_name");
402      return this;
403    }
404
405    public Builder requestFlow(String requestFlow) {
406      this.requestFlow = requestFlow;
407      this.markNullableFieldAsSet("request_flow");
408      return this;
409    }
410
411    public SignRequestBase build() {
412      return new SignRequestBase(this);
413    }
414  }
415}