001package com.box.sdkgen.schemas.templatesignerinput; 002 003import com.box.sdkgen.internal.Nullable; 004import com.box.sdkgen.schemas.signrequestprefilltag.SignRequestPrefillTag; 005import com.box.sdkgen.schemas.signrequestsignerinputcustomvalidation.SignRequestSignerInputCustomValidation; 006import com.box.sdkgen.schemas.signrequestsignerinputdateasiavalidation.SignRequestSignerInputDateAsiaValidation; 007import com.box.sdkgen.schemas.signrequestsignerinputdateeuvalidation.SignRequestSignerInputDateEuValidation; 008import com.box.sdkgen.schemas.signrequestsignerinputdateisovalidation.SignRequestSignerInputDateIsoValidation; 009import com.box.sdkgen.schemas.signrequestsignerinputdateusvalidation.SignRequestSignerInputDateUsValidation; 010import com.box.sdkgen.schemas.signrequestsignerinputemailvalidation.SignRequestSignerInputEmailValidation; 011import com.box.sdkgen.schemas.signrequestsignerinputnumberwithcommavalidation.SignRequestSignerInputNumberWithCommaValidation; 012import com.box.sdkgen.schemas.signrequestsignerinputnumberwithperiodvalidation.SignRequestSignerInputNumberWithPeriodValidation; 013import com.box.sdkgen.schemas.signrequestsignerinputssnvalidation.SignRequestSignerInputSsnValidation; 014import com.box.sdkgen.schemas.signrequestsignerinputvalidation.SignRequestSignerInputValidation; 015import com.box.sdkgen.schemas.signrequestsignerinputzip4validation.SignRequestSignerInputZip4Validation; 016import com.box.sdkgen.schemas.signrequestsignerinputzipvalidation.SignRequestSignerInputZipValidation; 017import com.box.sdkgen.serialization.json.EnumWrapper; 018import com.fasterxml.jackson.annotation.JsonFilter; 019import com.fasterxml.jackson.annotation.JsonProperty; 020import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 021import com.fasterxml.jackson.databind.annotation.JsonSerialize; 022import java.time.OffsetDateTime; 023import java.util.List; 024import java.util.Objects; 025 026/** Input created by a Signer on a Template. */ 027@JsonFilter("nullablePropertyFilter") 028public class TemplateSignerInput extends SignRequestPrefillTag { 029 030 /** Type of input. */ 031 @JsonDeserialize( 032 using = TemplateSignerInputTypeField.TemplateSignerInputTypeFieldDeserializer.class) 033 @JsonSerialize(using = TemplateSignerInputTypeField.TemplateSignerInputTypeFieldSerializer.class) 034 protected EnumWrapper<TemplateSignerInputTypeField> type; 035 036 /** Content type of input. */ 037 @JsonDeserialize( 038 using = 039 TemplateSignerInputContentTypeField.TemplateSignerInputContentTypeFieldDeserializer.class) 040 @JsonSerialize( 041 using = 042 TemplateSignerInputContentTypeField.TemplateSignerInputContentTypeFieldSerializer.class) 043 @JsonProperty("content_type") 044 protected EnumWrapper<TemplateSignerInputContentTypeField> contentType; 045 046 /** Whether or not the input is required. */ 047 @JsonProperty("is_required") 048 protected Boolean isRequired; 049 050 /** Index of page that the input is on. */ 051 @JsonProperty("page_index") 052 protected final long pageIndex; 053 054 /** Document identifier. */ 055 @JsonProperty("document_id") 056 @Nullable 057 protected String documentId; 058 059 /** 060 * When the input is of the type `dropdown` this values will be filled with all the dropdown 061 * options. 062 */ 063 @JsonProperty("dropdown_choices") 064 @Nullable 065 protected List<String> dropdownChoices; 066 067 /** When the input is of type `radio` they can be grouped to gather with this identifier. */ 068 @JsonProperty("group_id") 069 @Nullable 070 protected String groupId; 071 072 /** Where the input is located on a page. */ 073 protected TemplateSignerInputCoordinatesField coordinates; 074 075 /** The size of the input. */ 076 protected TemplateSignerInputDimensionsField dimensions; 077 078 /** The label field is used especially for text, attachment, radio, and checkbox type inputs. */ 079 @Nullable protected String label; 080 081 /** Indicates whether this input is read-only (cannot be modified by signers). */ 082 @JsonProperty("read_only") 083 protected Boolean readOnly; 084 085 /** 086 * Specifies the formatting rules that signers must follow for text field inputs. If set, this 087 * validation is mandatory. 088 */ 089 protected SignRequestSignerInputValidation validation; 090 091 public TemplateSignerInput(@JsonProperty("page_index") long pageIndex) { 092 super(); 093 this.pageIndex = pageIndex; 094 } 095 096 protected TemplateSignerInput(Builder builder) { 097 super(builder); 098 this.type = builder.type; 099 this.contentType = builder.contentType; 100 this.isRequired = builder.isRequired; 101 this.pageIndex = builder.pageIndex; 102 this.documentId = builder.documentId; 103 this.dropdownChoices = builder.dropdownChoices; 104 this.groupId = builder.groupId; 105 this.coordinates = builder.coordinates; 106 this.dimensions = builder.dimensions; 107 this.label = builder.label; 108 this.readOnly = builder.readOnly; 109 this.validation = builder.validation; 110 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 111 } 112 113 public EnumWrapper<TemplateSignerInputTypeField> getType() { 114 return type; 115 } 116 117 public EnumWrapper<TemplateSignerInputContentTypeField> getContentType() { 118 return contentType; 119 } 120 121 public Boolean getIsRequired() { 122 return isRequired; 123 } 124 125 public long getPageIndex() { 126 return pageIndex; 127 } 128 129 public String getDocumentId() { 130 return documentId; 131 } 132 133 public List<String> getDropdownChoices() { 134 return dropdownChoices; 135 } 136 137 public String getGroupId() { 138 return groupId; 139 } 140 141 public TemplateSignerInputCoordinatesField getCoordinates() { 142 return coordinates; 143 } 144 145 public TemplateSignerInputDimensionsField getDimensions() { 146 return dimensions; 147 } 148 149 public String getLabel() { 150 return label; 151 } 152 153 public Boolean getReadOnly() { 154 return readOnly; 155 } 156 157 public SignRequestSignerInputValidation getValidation() { 158 return validation; 159 } 160 161 @Override 162 public boolean equals(Object o) { 163 if (this == o) { 164 return true; 165 } 166 if (o == null || getClass() != o.getClass()) { 167 return false; 168 } 169 TemplateSignerInput casted = (TemplateSignerInput) o; 170 return Objects.equals(documentTagId, casted.documentTagId) 171 && Objects.equals(textValue, casted.textValue) 172 && Objects.equals(checkboxValue, casted.checkboxValue) 173 && Objects.equals(dateValue, casted.dateValue) 174 && Objects.equals(type, casted.type) 175 && Objects.equals(contentType, casted.contentType) 176 && Objects.equals(isRequired, casted.isRequired) 177 && Objects.equals(pageIndex, casted.pageIndex) 178 && Objects.equals(documentId, casted.documentId) 179 && Objects.equals(dropdownChoices, casted.dropdownChoices) 180 && Objects.equals(groupId, casted.groupId) 181 && Objects.equals(coordinates, casted.coordinates) 182 && Objects.equals(dimensions, casted.dimensions) 183 && Objects.equals(label, casted.label) 184 && Objects.equals(readOnly, casted.readOnly) 185 && Objects.equals(validation, casted.validation); 186 } 187 188 @Override 189 public int hashCode() { 190 return Objects.hash( 191 documentTagId, 192 textValue, 193 checkboxValue, 194 dateValue, 195 type, 196 contentType, 197 isRequired, 198 pageIndex, 199 documentId, 200 dropdownChoices, 201 groupId, 202 coordinates, 203 dimensions, 204 label, 205 readOnly, 206 validation); 207 } 208 209 @Override 210 public String toString() { 211 return "TemplateSignerInput{" 212 + "documentTagId='" 213 + documentTagId 214 + '\'' 215 + ", " 216 + "textValue='" 217 + textValue 218 + '\'' 219 + ", " 220 + "checkboxValue='" 221 + checkboxValue 222 + '\'' 223 + ", " 224 + "dateValue='" 225 + dateValue 226 + '\'' 227 + ", " 228 + "type='" 229 + type 230 + '\'' 231 + ", " 232 + "contentType='" 233 + contentType 234 + '\'' 235 + ", " 236 + "isRequired='" 237 + isRequired 238 + '\'' 239 + ", " 240 + "pageIndex='" 241 + pageIndex 242 + '\'' 243 + ", " 244 + "documentId='" 245 + documentId 246 + '\'' 247 + ", " 248 + "dropdownChoices='" 249 + dropdownChoices 250 + '\'' 251 + ", " 252 + "groupId='" 253 + groupId 254 + '\'' 255 + ", " 256 + "coordinates='" 257 + coordinates 258 + '\'' 259 + ", " 260 + "dimensions='" 261 + dimensions 262 + '\'' 263 + ", " 264 + "label='" 265 + label 266 + '\'' 267 + ", " 268 + "readOnly='" 269 + readOnly 270 + '\'' 271 + ", " 272 + "validation='" 273 + validation 274 + '\'' 275 + "}"; 276 } 277 278 public static class Builder extends SignRequestPrefillTag.Builder { 279 280 protected EnumWrapper<TemplateSignerInputTypeField> type; 281 282 protected EnumWrapper<TemplateSignerInputContentTypeField> contentType; 283 284 protected Boolean isRequired; 285 286 protected final long pageIndex; 287 288 protected String documentId; 289 290 protected List<String> dropdownChoices; 291 292 protected String groupId; 293 294 protected TemplateSignerInputCoordinatesField coordinates; 295 296 protected TemplateSignerInputDimensionsField dimensions; 297 298 protected String label; 299 300 protected Boolean readOnly; 301 302 protected SignRequestSignerInputValidation validation; 303 304 public Builder(long pageIndex) { 305 super(); 306 this.pageIndex = pageIndex; 307 } 308 309 public Builder type(TemplateSignerInputTypeField type) { 310 this.type = new EnumWrapper<TemplateSignerInputTypeField>(type); 311 return this; 312 } 313 314 public Builder type(EnumWrapper<TemplateSignerInputTypeField> type) { 315 this.type = type; 316 return this; 317 } 318 319 public Builder contentType(TemplateSignerInputContentTypeField contentType) { 320 this.contentType = new EnumWrapper<TemplateSignerInputContentTypeField>(contentType); 321 return this; 322 } 323 324 public Builder contentType(EnumWrapper<TemplateSignerInputContentTypeField> contentType) { 325 this.contentType = contentType; 326 return this; 327 } 328 329 public Builder isRequired(Boolean isRequired) { 330 this.isRequired = isRequired; 331 return this; 332 } 333 334 public Builder documentId(String documentId) { 335 this.documentId = documentId; 336 this.markNullableFieldAsSet("document_id"); 337 return this; 338 } 339 340 public Builder dropdownChoices(List<String> dropdownChoices) { 341 this.dropdownChoices = dropdownChoices; 342 this.markNullableFieldAsSet("dropdown_choices"); 343 return this; 344 } 345 346 public Builder groupId(String groupId) { 347 this.groupId = groupId; 348 this.markNullableFieldAsSet("group_id"); 349 return this; 350 } 351 352 public Builder coordinates(TemplateSignerInputCoordinatesField coordinates) { 353 this.coordinates = coordinates; 354 return this; 355 } 356 357 public Builder dimensions(TemplateSignerInputDimensionsField dimensions) { 358 this.dimensions = dimensions; 359 return this; 360 } 361 362 public Builder label(String label) { 363 this.label = label; 364 this.markNullableFieldAsSet("label"); 365 return this; 366 } 367 368 public Builder readOnly(Boolean readOnly) { 369 this.readOnly = readOnly; 370 return this; 371 } 372 373 public Builder validation(SignRequestSignerInputEmailValidation validation) { 374 this.validation = new SignRequestSignerInputValidation(validation); 375 return this; 376 } 377 378 public Builder validation(SignRequestSignerInputCustomValidation validation) { 379 this.validation = new SignRequestSignerInputValidation(validation); 380 return this; 381 } 382 383 public Builder validation(SignRequestSignerInputZipValidation validation) { 384 this.validation = new SignRequestSignerInputValidation(validation); 385 return this; 386 } 387 388 public Builder validation(SignRequestSignerInputZip4Validation validation) { 389 this.validation = new SignRequestSignerInputValidation(validation); 390 return this; 391 } 392 393 public Builder validation(SignRequestSignerInputSsnValidation validation) { 394 this.validation = new SignRequestSignerInputValidation(validation); 395 return this; 396 } 397 398 public Builder validation(SignRequestSignerInputNumberWithPeriodValidation validation) { 399 this.validation = new SignRequestSignerInputValidation(validation); 400 return this; 401 } 402 403 public Builder validation(SignRequestSignerInputNumberWithCommaValidation validation) { 404 this.validation = new SignRequestSignerInputValidation(validation); 405 return this; 406 } 407 408 public Builder validation(SignRequestSignerInputDateIsoValidation validation) { 409 this.validation = new SignRequestSignerInputValidation(validation); 410 return this; 411 } 412 413 public Builder validation(SignRequestSignerInputDateUsValidation validation) { 414 this.validation = new SignRequestSignerInputValidation(validation); 415 return this; 416 } 417 418 public Builder validation(SignRequestSignerInputDateEuValidation validation) { 419 this.validation = new SignRequestSignerInputValidation(validation); 420 return this; 421 } 422 423 public Builder validation(SignRequestSignerInputDateAsiaValidation validation) { 424 this.validation = new SignRequestSignerInputValidation(validation); 425 return this; 426 } 427 428 public Builder validation(SignRequestSignerInputValidation validation) { 429 this.validation = validation; 430 return this; 431 } 432 433 @Override 434 public Builder documentTagId(String documentTagId) { 435 this.documentTagId = documentTagId; 436 this.markNullableFieldAsSet("document_tag_id"); 437 return this; 438 } 439 440 @Override 441 public Builder textValue(String textValue) { 442 this.textValue = textValue; 443 this.markNullableFieldAsSet("text_value"); 444 return this; 445 } 446 447 @Override 448 public Builder checkboxValue(Boolean checkboxValue) { 449 this.checkboxValue = checkboxValue; 450 this.markNullableFieldAsSet("checkbox_value"); 451 return this; 452 } 453 454 @Override 455 public Builder dateValue(OffsetDateTime dateValue) { 456 this.dateValue = dateValue; 457 this.markNullableFieldAsSet("date_value"); 458 return this; 459 } 460 461 public TemplateSignerInput build() { 462 return new TemplateSignerInput(this); 463 } 464 } 465}