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 public SignTemplate() { 134 super(); 135 } 136 137 protected SignTemplate(Builder builder) { 138 super(); 139 this.type = builder.type; 140 this.id = builder.id; 141 this.name = builder.name; 142 this.emailSubject = builder.emailSubject; 143 this.emailMessage = builder.emailMessage; 144 this.daysValid = builder.daysValid; 145 this.parentFolder = builder.parentFolder; 146 this.sourceFiles = builder.sourceFiles; 147 this.areFieldsLocked = builder.areFieldsLocked; 148 this.areOptionsLocked = builder.areOptionsLocked; 149 this.areRecipientsLocked = builder.areRecipientsLocked; 150 this.areEmailSettingsLocked = builder.areEmailSettingsLocked; 151 this.areFilesLocked = builder.areFilesLocked; 152 this.signers = builder.signers; 153 this.additionalInfo = builder.additionalInfo; 154 this.readySignLink = builder.readySignLink; 155 this.customBranding = builder.customBranding; 156 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 157 } 158 159 public EnumWrapper<SignTemplateTypeField> getType() { 160 return type; 161 } 162 163 public String getId() { 164 return id; 165 } 166 167 public String getName() { 168 return name; 169 } 170 171 public String getEmailSubject() { 172 return emailSubject; 173 } 174 175 public String getEmailMessage() { 176 return emailMessage; 177 } 178 179 public Long getDaysValid() { 180 return daysValid; 181 } 182 183 public FolderMini getParentFolder() { 184 return parentFolder; 185 } 186 187 public List<FileMini> getSourceFiles() { 188 return sourceFiles; 189 } 190 191 public Boolean getAreFieldsLocked() { 192 return areFieldsLocked; 193 } 194 195 public Boolean getAreOptionsLocked() { 196 return areOptionsLocked; 197 } 198 199 public Boolean getAreRecipientsLocked() { 200 return areRecipientsLocked; 201 } 202 203 public Boolean getAreEmailSettingsLocked() { 204 return areEmailSettingsLocked; 205 } 206 207 public Boolean getAreFilesLocked() { 208 return areFilesLocked; 209 } 210 211 public List<TemplateSigner> getSigners() { 212 return signers; 213 } 214 215 public SignTemplateAdditionalInfoField getAdditionalInfo() { 216 return additionalInfo; 217 } 218 219 public SignTemplateReadySignLinkField getReadySignLink() { 220 return readySignLink; 221 } 222 223 public SignTemplateCustomBrandingField getCustomBranding() { 224 return customBranding; 225 } 226 227 @Override 228 public boolean equals(Object o) { 229 if (this == o) { 230 return true; 231 } 232 if (o == null || getClass() != o.getClass()) { 233 return false; 234 } 235 SignTemplate casted = (SignTemplate) o; 236 return Objects.equals(type, casted.type) 237 && Objects.equals(id, casted.id) 238 && Objects.equals(name, casted.name) 239 && Objects.equals(emailSubject, casted.emailSubject) 240 && Objects.equals(emailMessage, casted.emailMessage) 241 && Objects.equals(daysValid, casted.daysValid) 242 && Objects.equals(parentFolder, casted.parentFolder) 243 && Objects.equals(sourceFiles, casted.sourceFiles) 244 && Objects.equals(areFieldsLocked, casted.areFieldsLocked) 245 && Objects.equals(areOptionsLocked, casted.areOptionsLocked) 246 && Objects.equals(areRecipientsLocked, casted.areRecipientsLocked) 247 && Objects.equals(areEmailSettingsLocked, casted.areEmailSettingsLocked) 248 && Objects.equals(areFilesLocked, casted.areFilesLocked) 249 && Objects.equals(signers, casted.signers) 250 && Objects.equals(additionalInfo, casted.additionalInfo) 251 && Objects.equals(readySignLink, casted.readySignLink) 252 && Objects.equals(customBranding, casted.customBranding); 253 } 254 255 @Override 256 public int hashCode() { 257 return Objects.hash( 258 type, 259 id, 260 name, 261 emailSubject, 262 emailMessage, 263 daysValid, 264 parentFolder, 265 sourceFiles, 266 areFieldsLocked, 267 areOptionsLocked, 268 areRecipientsLocked, 269 areEmailSettingsLocked, 270 areFilesLocked, 271 signers, 272 additionalInfo, 273 readySignLink, 274 customBranding); 275 } 276 277 @Override 278 public String toString() { 279 return "SignTemplate{" 280 + "type='" 281 + type 282 + '\'' 283 + ", " 284 + "id='" 285 + id 286 + '\'' 287 + ", " 288 + "name='" 289 + name 290 + '\'' 291 + ", " 292 + "emailSubject='" 293 + emailSubject 294 + '\'' 295 + ", " 296 + "emailMessage='" 297 + emailMessage 298 + '\'' 299 + ", " 300 + "daysValid='" 301 + daysValid 302 + '\'' 303 + ", " 304 + "parentFolder='" 305 + parentFolder 306 + '\'' 307 + ", " 308 + "sourceFiles='" 309 + sourceFiles 310 + '\'' 311 + ", " 312 + "areFieldsLocked='" 313 + areFieldsLocked 314 + '\'' 315 + ", " 316 + "areOptionsLocked='" 317 + areOptionsLocked 318 + '\'' 319 + ", " 320 + "areRecipientsLocked='" 321 + areRecipientsLocked 322 + '\'' 323 + ", " 324 + "areEmailSettingsLocked='" 325 + areEmailSettingsLocked 326 + '\'' 327 + ", " 328 + "areFilesLocked='" 329 + areFilesLocked 330 + '\'' 331 + ", " 332 + "signers='" 333 + signers 334 + '\'' 335 + ", " 336 + "additionalInfo='" 337 + additionalInfo 338 + '\'' 339 + ", " 340 + "readySignLink='" 341 + readySignLink 342 + '\'' 343 + ", " 344 + "customBranding='" 345 + customBranding 346 + '\'' 347 + "}"; 348 } 349 350 public static class Builder extends NullableFieldTracker { 351 352 protected EnumWrapper<SignTemplateTypeField> type; 353 354 protected String id; 355 356 protected String name; 357 358 protected String emailSubject; 359 360 protected String emailMessage; 361 362 protected Long daysValid; 363 364 protected FolderMini parentFolder; 365 366 protected List<FileMini> sourceFiles; 367 368 protected Boolean areFieldsLocked; 369 370 protected Boolean areOptionsLocked; 371 372 protected Boolean areRecipientsLocked; 373 374 protected Boolean areEmailSettingsLocked; 375 376 protected Boolean areFilesLocked; 377 378 protected List<TemplateSigner> signers; 379 380 protected SignTemplateAdditionalInfoField additionalInfo; 381 382 protected SignTemplateReadySignLinkField readySignLink; 383 384 protected SignTemplateCustomBrandingField customBranding; 385 386 public Builder type(SignTemplateTypeField type) { 387 this.type = new EnumWrapper<SignTemplateTypeField>(type); 388 return this; 389 } 390 391 public Builder type(EnumWrapper<SignTemplateTypeField> type) { 392 this.type = type; 393 return this; 394 } 395 396 public Builder id(String id) { 397 this.id = id; 398 return this; 399 } 400 401 public Builder name(String name) { 402 this.name = name; 403 this.markNullableFieldAsSet("name"); 404 return this; 405 } 406 407 public Builder emailSubject(String emailSubject) { 408 this.emailSubject = emailSubject; 409 this.markNullableFieldAsSet("email_subject"); 410 return this; 411 } 412 413 public Builder emailMessage(String emailMessage) { 414 this.emailMessage = emailMessage; 415 this.markNullableFieldAsSet("email_message"); 416 return this; 417 } 418 419 public Builder daysValid(Long daysValid) { 420 this.daysValid = daysValid; 421 this.markNullableFieldAsSet("days_valid"); 422 return this; 423 } 424 425 public Builder parentFolder(FolderMini parentFolder) { 426 this.parentFolder = parentFolder; 427 return this; 428 } 429 430 public Builder sourceFiles(List<FileMini> sourceFiles) { 431 this.sourceFiles = sourceFiles; 432 return this; 433 } 434 435 public Builder areFieldsLocked(Boolean areFieldsLocked) { 436 this.areFieldsLocked = areFieldsLocked; 437 return this; 438 } 439 440 public Builder areOptionsLocked(Boolean areOptionsLocked) { 441 this.areOptionsLocked = areOptionsLocked; 442 return this; 443 } 444 445 public Builder areRecipientsLocked(Boolean areRecipientsLocked) { 446 this.areRecipientsLocked = areRecipientsLocked; 447 return this; 448 } 449 450 public Builder areEmailSettingsLocked(Boolean areEmailSettingsLocked) { 451 this.areEmailSettingsLocked = areEmailSettingsLocked; 452 return this; 453 } 454 455 public Builder areFilesLocked(Boolean areFilesLocked) { 456 this.areFilesLocked = areFilesLocked; 457 return this; 458 } 459 460 public Builder signers(List<TemplateSigner> signers) { 461 this.signers = signers; 462 return this; 463 } 464 465 public Builder additionalInfo(SignTemplateAdditionalInfoField additionalInfo) { 466 this.additionalInfo = additionalInfo; 467 return this; 468 } 469 470 public Builder readySignLink(SignTemplateReadySignLinkField readySignLink) { 471 this.readySignLink = readySignLink; 472 this.markNullableFieldAsSet("ready_sign_link"); 473 return this; 474 } 475 476 public Builder customBranding(SignTemplateCustomBrandingField customBranding) { 477 this.customBranding = customBranding; 478 this.markNullableFieldAsSet("custom_branding"); 479 return this; 480 } 481 482 public SignTemplate build() { 483 return new SignTemplate(this); 484 } 485 } 486}