001package com.box.sdkgen.schemas.signtemplate; 002 003import com.box.sdkgen.internal.Nullable; 004import com.box.sdkgen.internal.NullableFieldTracker; 005import com.box.sdkgen.internal.SerializableObject; 006import com.box.sdkgen.schemas.filemini.FileMini; 007import com.box.sdkgen.schemas.foldermini.FolderMini; 008import com.box.sdkgen.schemas.templatesigner.TemplateSigner; 009import com.box.sdkgen.serialization.json.EnumWrapper; 010import com.fasterxml.jackson.annotation.JsonFilter; 011import com.fasterxml.jackson.annotation.JsonProperty; 012import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 013import com.fasterxml.jackson.databind.annotation.JsonSerialize; 014import java.util.List; 015import java.util.Objects; 016 017/** A Box Sign template object. */ 018@JsonFilter("nullablePropertyFilter") 019public class SignTemplate extends SerializableObject { 020 021 /** The value will always be `sign-template`. */ 022 @JsonDeserialize(using = SignTemplateTypeField.SignTemplateTypeFieldDeserializer.class) 023 @JsonSerialize(using = SignTemplateTypeField.SignTemplateTypeFieldSerializer.class) 024 protected EnumWrapper<SignTemplateTypeField> type; 025 026 /** Template identifier. */ 027 protected String id; 028 029 /** The name of the template. */ 030 @Nullable protected String name; 031 032 /** 033 * Subject of signature request email. This is cleaned by sign request. If this field is not 034 * passed, a default subject will be used. 035 */ 036 @JsonProperty("email_subject") 037 @Nullable 038 protected String emailSubject; 039 040 /** 041 * Message to include in signature request email. The field is cleaned through sanitization of 042 * specific characters. However, some html tags are allowed. Links included in the message are 043 * also converted to hyperlinks in the email. The message may contain the following html tags 044 * including `a`, `abbr`, `acronym`, `b`, `blockquote`, `code`, `em`, `i`, `ul`, `li`, `ol`, and 045 * `strong`. Be aware that when the text to html ratio is too high, the email may end up in spam 046 * filters. Custom styles on these tags are not allowed. If this field is not passed, a default 047 * message will be used. 048 */ 049 @JsonProperty("email_message") 050 @Nullable 051 protected String emailMessage; 052 053 /** 054 * Set the number of days after which the created signature request will automatically expire if 055 * not completed. By default, we do not apply any expiration date on signature requests, and the 056 * signature request does not expire. 057 */ 058 @JsonProperty("days_valid") 059 @Nullable 060 protected Long daysValid; 061 062 @JsonProperty("parent_folder") 063 protected FolderMini parentFolder; 064 065 /** 066 * List of files to create a signing document from. Only the ID and type fields are required for 067 * each file. 068 */ 069 @JsonProperty("source_files") 070 protected List<FileMini> sourceFiles; 071 072 /** Indicates if the template input fields are editable or not. */ 073 @JsonProperty("are_fields_locked") 074 protected Boolean areFieldsLocked; 075 076 /** 077 * Indicates if the template document options are editable or not, for example renaming the 078 * document. 079 */ 080 @JsonProperty("are_options_locked") 081 protected Boolean areOptionsLocked; 082 083 /** Indicates if the template signers are editable or not. */ 084 @JsonProperty("are_recipients_locked") 085 protected Boolean areRecipientsLocked; 086 087 /** Indicates if the template email settings are editable or not. */ 088 @JsonProperty("are_email_settings_locked") 089 protected Boolean areEmailSettingsLocked; 090 091 /** 092 * Indicates if the template files are editable or not. This includes deleting or renaming 093 * template files. 094 */ 095 @JsonProperty("are_files_locked") 096 protected Boolean areFilesLocked; 097 098 /** 099 * Array of signers for the template. 100 * 101 * <p>**Note**: It may happen that some signers specified in the template belong to conflicting 102 * [segments](https://developer.box.com/reference/resources/shield-information-barrier-segment-member) 103 * (user groups). This means that due to the security policies, users are assigned to segments to 104 * prevent exchanges or communication that could lead to ethical conflicts. In such a case, an 105 * attempt to send a sign request based on a template that lists signers in conflicting segments 106 * will result in an error. 107 * 108 * <p>Read more about [segments and ethical 109 * walls](https://support.box.com/hc/en-us/articles/9920431507603-Understanding-Information-Barriers#h_01GFVJEHQA06N7XEZ4GCZ9GFAQ). 110 */ 111 protected List<TemplateSigner> signers; 112 113 /** Additional information on which fields are required and which fields are not editable. */ 114 @JsonProperty("additional_info") 115 protected SignTemplateAdditionalInfoField additionalInfo; 116 117 /** 118 * Box's ready-sign link feature enables you to create a link to a signature request that you've 119 * created from a template. Use this link when you want to post a signature request on a public 120 * form — such as an email, social media post, or web page — without knowing who the signers will 121 * be. Note: The ready-sign link feature is limited to Enterprise Plus customers and not available 122 * to Box Verified Enterprises. 123 */ 124 @JsonProperty("ready_sign_link") 125 @Nullable 126 protected SignTemplateReadySignLinkField readySignLink; 127 128 /** Custom branding applied to notifications and signature requests. */ 129 @JsonProperty("custom_branding") 130 @Nullable 131 protected SignTemplateCustomBrandingField customBranding; 132 133 /** 134 * The sign flow of sign requests created from the template. Values can include `standard` or 135 * `cfr11`. 136 */ 137 @JsonProperty("request_flow") 138 @Nullable 139 protected String requestFlow; 140 141 public SignTemplate() { 142 super(); 143 } 144 145 protected SignTemplate(Builder builder) { 146 super(); 147 this.type = builder.type; 148 this.id = builder.id; 149 this.name = builder.name; 150 this.emailSubject = builder.emailSubject; 151 this.emailMessage = builder.emailMessage; 152 this.daysValid = builder.daysValid; 153 this.parentFolder = builder.parentFolder; 154 this.sourceFiles = builder.sourceFiles; 155 this.areFieldsLocked = builder.areFieldsLocked; 156 this.areOptionsLocked = builder.areOptionsLocked; 157 this.areRecipientsLocked = builder.areRecipientsLocked; 158 this.areEmailSettingsLocked = builder.areEmailSettingsLocked; 159 this.areFilesLocked = builder.areFilesLocked; 160 this.signers = builder.signers; 161 this.additionalInfo = builder.additionalInfo; 162 this.readySignLink = builder.readySignLink; 163 this.customBranding = builder.customBranding; 164 this.requestFlow = builder.requestFlow; 165 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 166 } 167 168 public EnumWrapper<SignTemplateTypeField> getType() { 169 return type; 170 } 171 172 public String getId() { 173 return id; 174 } 175 176 public String getName() { 177 return name; 178 } 179 180 public String getEmailSubject() { 181 return emailSubject; 182 } 183 184 public String getEmailMessage() { 185 return emailMessage; 186 } 187 188 public Long getDaysValid() { 189 return daysValid; 190 } 191 192 public FolderMini getParentFolder() { 193 return parentFolder; 194 } 195 196 public List<FileMini> getSourceFiles() { 197 return sourceFiles; 198 } 199 200 public Boolean getAreFieldsLocked() { 201 return areFieldsLocked; 202 } 203 204 public Boolean getAreOptionsLocked() { 205 return areOptionsLocked; 206 } 207 208 public Boolean getAreRecipientsLocked() { 209 return areRecipientsLocked; 210 } 211 212 public Boolean getAreEmailSettingsLocked() { 213 return areEmailSettingsLocked; 214 } 215 216 public Boolean getAreFilesLocked() { 217 return areFilesLocked; 218 } 219 220 public List<TemplateSigner> getSigners() { 221 return signers; 222 } 223 224 public SignTemplateAdditionalInfoField getAdditionalInfo() { 225 return additionalInfo; 226 } 227 228 public SignTemplateReadySignLinkField getReadySignLink() { 229 return readySignLink; 230 } 231 232 public SignTemplateCustomBrandingField getCustomBranding() { 233 return customBranding; 234 } 235 236 public String getRequestFlow() { 237 return requestFlow; 238 } 239 240 @Override 241 public boolean equals(Object o) { 242 if (this == o) { 243 return true; 244 } 245 if (o == null || getClass() != o.getClass()) { 246 return false; 247 } 248 SignTemplate casted = (SignTemplate) o; 249 return Objects.equals(type, casted.type) 250 && Objects.equals(id, casted.id) 251 && Objects.equals(name, casted.name) 252 && Objects.equals(emailSubject, casted.emailSubject) 253 && Objects.equals(emailMessage, casted.emailMessage) 254 && Objects.equals(daysValid, casted.daysValid) 255 && Objects.equals(parentFolder, casted.parentFolder) 256 && Objects.equals(sourceFiles, casted.sourceFiles) 257 && Objects.equals(areFieldsLocked, casted.areFieldsLocked) 258 && Objects.equals(areOptionsLocked, casted.areOptionsLocked) 259 && Objects.equals(areRecipientsLocked, casted.areRecipientsLocked) 260 && Objects.equals(areEmailSettingsLocked, casted.areEmailSettingsLocked) 261 && Objects.equals(areFilesLocked, casted.areFilesLocked) 262 && Objects.equals(signers, casted.signers) 263 && Objects.equals(additionalInfo, casted.additionalInfo) 264 && Objects.equals(readySignLink, casted.readySignLink) 265 && Objects.equals(customBranding, casted.customBranding) 266 && Objects.equals(requestFlow, casted.requestFlow); 267 } 268 269 @Override 270 public int hashCode() { 271 return Objects.hash( 272 type, 273 id, 274 name, 275 emailSubject, 276 emailMessage, 277 daysValid, 278 parentFolder, 279 sourceFiles, 280 areFieldsLocked, 281 areOptionsLocked, 282 areRecipientsLocked, 283 areEmailSettingsLocked, 284 areFilesLocked, 285 signers, 286 additionalInfo, 287 readySignLink, 288 customBranding, 289 requestFlow); 290 } 291 292 @Override 293 public String toString() { 294 return "SignTemplate{" 295 + "type='" 296 + type 297 + '\'' 298 + ", " 299 + "id='" 300 + id 301 + '\'' 302 + ", " 303 + "name='" 304 + name 305 + '\'' 306 + ", " 307 + "emailSubject='" 308 + emailSubject 309 + '\'' 310 + ", " 311 + "emailMessage='" 312 + emailMessage 313 + '\'' 314 + ", " 315 + "daysValid='" 316 + daysValid 317 + '\'' 318 + ", " 319 + "parentFolder='" 320 + parentFolder 321 + '\'' 322 + ", " 323 + "sourceFiles='" 324 + sourceFiles 325 + '\'' 326 + ", " 327 + "areFieldsLocked='" 328 + areFieldsLocked 329 + '\'' 330 + ", " 331 + "areOptionsLocked='" 332 + areOptionsLocked 333 + '\'' 334 + ", " 335 + "areRecipientsLocked='" 336 + areRecipientsLocked 337 + '\'' 338 + ", " 339 + "areEmailSettingsLocked='" 340 + areEmailSettingsLocked 341 + '\'' 342 + ", " 343 + "areFilesLocked='" 344 + areFilesLocked 345 + '\'' 346 + ", " 347 + "signers='" 348 + signers 349 + '\'' 350 + ", " 351 + "additionalInfo='" 352 + additionalInfo 353 + '\'' 354 + ", " 355 + "readySignLink='" 356 + readySignLink 357 + '\'' 358 + ", " 359 + "customBranding='" 360 + customBranding 361 + '\'' 362 + ", " 363 + "requestFlow='" 364 + requestFlow 365 + '\'' 366 + "}"; 367 } 368 369 public static class Builder extends NullableFieldTracker { 370 371 protected EnumWrapper<SignTemplateTypeField> type; 372 373 protected String id; 374 375 protected String name; 376 377 protected String emailSubject; 378 379 protected String emailMessage; 380 381 protected Long daysValid; 382 383 protected FolderMini parentFolder; 384 385 protected List<FileMini> sourceFiles; 386 387 protected Boolean areFieldsLocked; 388 389 protected Boolean areOptionsLocked; 390 391 protected Boolean areRecipientsLocked; 392 393 protected Boolean areEmailSettingsLocked; 394 395 protected Boolean areFilesLocked; 396 397 protected List<TemplateSigner> signers; 398 399 protected SignTemplateAdditionalInfoField additionalInfo; 400 401 protected SignTemplateReadySignLinkField readySignLink; 402 403 protected SignTemplateCustomBrandingField customBranding; 404 405 protected String requestFlow; 406 407 public Builder type(SignTemplateTypeField type) { 408 this.type = new EnumWrapper<SignTemplateTypeField>(type); 409 return this; 410 } 411 412 public Builder type(EnumWrapper<SignTemplateTypeField> type) { 413 this.type = type; 414 return this; 415 } 416 417 public Builder id(String id) { 418 this.id = id; 419 return this; 420 } 421 422 public Builder name(String name) { 423 this.name = name; 424 this.markNullableFieldAsSet("name"); 425 return this; 426 } 427 428 public Builder emailSubject(String emailSubject) { 429 this.emailSubject = emailSubject; 430 this.markNullableFieldAsSet("email_subject"); 431 return this; 432 } 433 434 public Builder emailMessage(String emailMessage) { 435 this.emailMessage = emailMessage; 436 this.markNullableFieldAsSet("email_message"); 437 return this; 438 } 439 440 public Builder daysValid(Long daysValid) { 441 this.daysValid = daysValid; 442 this.markNullableFieldAsSet("days_valid"); 443 return this; 444 } 445 446 public Builder parentFolder(FolderMini parentFolder) { 447 this.parentFolder = parentFolder; 448 return this; 449 } 450 451 public Builder sourceFiles(List<FileMini> sourceFiles) { 452 this.sourceFiles = sourceFiles; 453 return this; 454 } 455 456 public Builder areFieldsLocked(Boolean areFieldsLocked) { 457 this.areFieldsLocked = areFieldsLocked; 458 return this; 459 } 460 461 public Builder areOptionsLocked(Boolean areOptionsLocked) { 462 this.areOptionsLocked = areOptionsLocked; 463 return this; 464 } 465 466 public Builder areRecipientsLocked(Boolean areRecipientsLocked) { 467 this.areRecipientsLocked = areRecipientsLocked; 468 return this; 469 } 470 471 public Builder areEmailSettingsLocked(Boolean areEmailSettingsLocked) { 472 this.areEmailSettingsLocked = areEmailSettingsLocked; 473 return this; 474 } 475 476 public Builder areFilesLocked(Boolean areFilesLocked) { 477 this.areFilesLocked = areFilesLocked; 478 return this; 479 } 480 481 public Builder signers(List<TemplateSigner> signers) { 482 this.signers = signers; 483 return this; 484 } 485 486 public Builder additionalInfo(SignTemplateAdditionalInfoField additionalInfo) { 487 this.additionalInfo = additionalInfo; 488 return this; 489 } 490 491 public Builder readySignLink(SignTemplateReadySignLinkField readySignLink) { 492 this.readySignLink = readySignLink; 493 this.markNullableFieldAsSet("ready_sign_link"); 494 return this; 495 } 496 497 public Builder customBranding(SignTemplateCustomBrandingField customBranding) { 498 this.customBranding = customBranding; 499 this.markNullableFieldAsSet("custom_branding"); 500 return this; 501 } 502 503 public Builder requestFlow(String requestFlow) { 504 this.requestFlow = requestFlow; 505 this.markNullableFieldAsSet("request_flow"); 506 return this; 507 } 508 509 public SignTemplate build() { 510 return new SignTemplate(this); 511 } 512 } 513}