001package com.box.sdkgen.schemas.trashfilerestored; 002 003import com.box.sdkgen.internal.Nullable; 004import com.box.sdkgen.internal.NullableFieldTracker; 005import com.box.sdkgen.internal.SerializableObject; 006import com.box.sdkgen.internal.utils.DateTimeUtils; 007import com.box.sdkgen.schemas.fileversionmini.FileVersionMini; 008import com.box.sdkgen.schemas.foldermini.FolderMini; 009import com.box.sdkgen.schemas.usermini.UserMini; 010import com.box.sdkgen.serialization.json.EnumWrapper; 011import com.fasterxml.jackson.annotation.JsonFilter; 012import com.fasterxml.jackson.annotation.JsonProperty; 013import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 014import com.fasterxml.jackson.databind.annotation.JsonSerialize; 015import java.time.OffsetDateTime; 016import java.util.Objects; 017 018/** Represents a file restored from the trash. */ 019@JsonFilter("nullablePropertyFilter") 020public class TrashFileRestored extends SerializableObject { 021 022 /** 023 * The unique identifier that represent a file. 024 * 025 * <p>The ID for any file can be determined by visiting a file in the web application and copying 026 * the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id` 027 * is `123`. 028 */ 029 protected final String id; 030 031 /** 032 * The HTTP `etag` of this file. This can be used within some API endpoints in the `If-Match` and 033 * `If-None-Match` headers to only perform changes on the file if (no) changes have happened. 034 */ 035 @Nullable protected String etag; 036 037 /** The value will always be `file`. */ 038 @JsonDeserialize(using = TrashFileRestoredTypeField.TrashFileRestoredTypeFieldDeserializer.class) 039 @JsonSerialize(using = TrashFileRestoredTypeField.TrashFileRestoredTypeFieldSerializer.class) 040 protected EnumWrapper<TrashFileRestoredTypeField> type; 041 042 @JsonProperty("sequence_id") 043 protected final String sequenceId; 044 045 /** The name of the file. */ 046 protected String name; 047 048 /** 049 * The SHA1 hash of the file. This can be used to compare the contents of a file on Box with a 050 * local file. 051 */ 052 protected final String sha1; 053 054 @JsonProperty("file_version") 055 protected FileVersionMini fileVersion; 056 057 /** The optional description of this file. */ 058 protected final String description; 059 060 /** 061 * The file size in bytes. Be careful parsing this integer as it can get very large and cause an 062 * integer overflow. 063 */ 064 protected final long size; 065 066 @JsonProperty("path_collection") 067 protected final TrashFileRestoredPathCollectionField pathCollection; 068 069 /** The date and time when the file was created on Box. */ 070 @JsonProperty("created_at") 071 @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class) 072 @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class) 073 protected final OffsetDateTime createdAt; 074 075 /** The date and time when the file was last updated on Box. */ 076 @JsonProperty("modified_at") 077 @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class) 078 @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class) 079 protected final OffsetDateTime modifiedAt; 080 081 /** The time at which this file was put in the trash - becomes `null` after restore. */ 082 @JsonProperty("trashed_at") 083 @Nullable 084 protected String trashedAt; 085 086 /** 087 * The time at which this file is expected to be purged from the trash - becomes `null` after 088 * restore. 089 */ 090 @JsonProperty("purged_at") 091 @Nullable 092 protected String purgedAt; 093 094 /** 095 * The date and time at which this file was originally created, which might be before it was 096 * uploaded to Box. 097 */ 098 @JsonProperty("content_created_at") 099 @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class) 100 @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class) 101 @Nullable 102 protected OffsetDateTime contentCreatedAt; 103 104 /** 105 * The date and time at which this file was last updated, which might be before it was uploaded to 106 * Box. 107 */ 108 @JsonProperty("content_modified_at") 109 @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class) 110 @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class) 111 @Nullable 112 protected OffsetDateTime contentModifiedAt; 113 114 @JsonProperty("created_by") 115 protected UserMini createdBy; 116 117 @JsonProperty("modified_by") 118 protected final UserMini modifiedBy; 119 120 @JsonProperty("owned_by") 121 protected final UserMini ownedBy; 122 123 /** 124 * The shared link for this file. This will be `null` if a file had been trashed, even though the 125 * original shared link does become active again. 126 */ 127 @JsonProperty("shared_link") 128 @Nullable 129 protected String sharedLink; 130 131 protected FolderMini parent; 132 133 /** 134 * Defines if this item has been deleted or not. 135 * 136 * <p>* `active` when the item has is not in the trash * `trashed` when the item has been moved to 137 * the trash but not deleted * `deleted` when the item has been permanently deleted. 138 */ 139 @JsonDeserialize( 140 using = TrashFileRestoredItemStatusField.TrashFileRestoredItemStatusFieldDeserializer.class) 141 @JsonSerialize( 142 using = TrashFileRestoredItemStatusField.TrashFileRestoredItemStatusFieldSerializer.class) 143 @JsonProperty("item_status") 144 protected final EnumWrapper<TrashFileRestoredItemStatusField> itemStatus; 145 146 public TrashFileRestored( 147 String id, 148 String sequenceId, 149 String sha1, 150 String description, 151 long size, 152 TrashFileRestoredPathCollectionField pathCollection, 153 OffsetDateTime createdAt, 154 OffsetDateTime modifiedAt, 155 UserMini modifiedBy, 156 UserMini ownedBy, 157 TrashFileRestoredItemStatusField itemStatus) { 158 super(); 159 this.id = id; 160 this.sequenceId = sequenceId; 161 this.sha1 = sha1; 162 this.description = description; 163 this.size = size; 164 this.pathCollection = pathCollection; 165 this.createdAt = createdAt; 166 this.modifiedAt = modifiedAt; 167 this.modifiedBy = modifiedBy; 168 this.ownedBy = ownedBy; 169 this.itemStatus = new EnumWrapper<TrashFileRestoredItemStatusField>(itemStatus); 170 this.type = new EnumWrapper<TrashFileRestoredTypeField>(TrashFileRestoredTypeField.FILE); 171 } 172 173 public TrashFileRestored( 174 @JsonProperty("id") String id, 175 @JsonProperty("sequence_id") String sequenceId, 176 @JsonProperty("sha1") String sha1, 177 @JsonProperty("description") String description, 178 @JsonProperty("size") long size, 179 @JsonProperty("path_collection") TrashFileRestoredPathCollectionField pathCollection, 180 @JsonProperty("created_at") OffsetDateTime createdAt, 181 @JsonProperty("modified_at") OffsetDateTime modifiedAt, 182 @JsonProperty("modified_by") UserMini modifiedBy, 183 @JsonProperty("owned_by") UserMini ownedBy, 184 @JsonProperty("item_status") EnumWrapper<TrashFileRestoredItemStatusField> itemStatus) { 185 super(); 186 this.id = id; 187 this.sequenceId = sequenceId; 188 this.sha1 = sha1; 189 this.description = description; 190 this.size = size; 191 this.pathCollection = pathCollection; 192 this.createdAt = createdAt; 193 this.modifiedAt = modifiedAt; 194 this.modifiedBy = modifiedBy; 195 this.ownedBy = ownedBy; 196 this.itemStatus = itemStatus; 197 this.type = new EnumWrapper<TrashFileRestoredTypeField>(TrashFileRestoredTypeField.FILE); 198 } 199 200 protected TrashFileRestored(Builder builder) { 201 super(); 202 this.id = builder.id; 203 this.etag = builder.etag; 204 this.type = builder.type; 205 this.sequenceId = builder.sequenceId; 206 this.name = builder.name; 207 this.sha1 = builder.sha1; 208 this.fileVersion = builder.fileVersion; 209 this.description = builder.description; 210 this.size = builder.size; 211 this.pathCollection = builder.pathCollection; 212 this.createdAt = builder.createdAt; 213 this.modifiedAt = builder.modifiedAt; 214 this.trashedAt = builder.trashedAt; 215 this.purgedAt = builder.purgedAt; 216 this.contentCreatedAt = builder.contentCreatedAt; 217 this.contentModifiedAt = builder.contentModifiedAt; 218 this.createdBy = builder.createdBy; 219 this.modifiedBy = builder.modifiedBy; 220 this.ownedBy = builder.ownedBy; 221 this.sharedLink = builder.sharedLink; 222 this.parent = builder.parent; 223 this.itemStatus = builder.itemStatus; 224 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 225 } 226 227 public String getId() { 228 return id; 229 } 230 231 public String getEtag() { 232 return etag; 233 } 234 235 public EnumWrapper<TrashFileRestoredTypeField> getType() { 236 return type; 237 } 238 239 public String getSequenceId() { 240 return sequenceId; 241 } 242 243 public String getName() { 244 return name; 245 } 246 247 public String getSha1() { 248 return sha1; 249 } 250 251 public FileVersionMini getFileVersion() { 252 return fileVersion; 253 } 254 255 public String getDescription() { 256 return description; 257 } 258 259 public long getSize() { 260 return size; 261 } 262 263 public TrashFileRestoredPathCollectionField getPathCollection() { 264 return pathCollection; 265 } 266 267 public OffsetDateTime getCreatedAt() { 268 return createdAt; 269 } 270 271 public OffsetDateTime getModifiedAt() { 272 return modifiedAt; 273 } 274 275 public String getTrashedAt() { 276 return trashedAt; 277 } 278 279 public String getPurgedAt() { 280 return purgedAt; 281 } 282 283 public OffsetDateTime getContentCreatedAt() { 284 return contentCreatedAt; 285 } 286 287 public OffsetDateTime getContentModifiedAt() { 288 return contentModifiedAt; 289 } 290 291 public UserMini getCreatedBy() { 292 return createdBy; 293 } 294 295 public UserMini getModifiedBy() { 296 return modifiedBy; 297 } 298 299 public UserMini getOwnedBy() { 300 return ownedBy; 301 } 302 303 public String getSharedLink() { 304 return sharedLink; 305 } 306 307 public FolderMini getParent() { 308 return parent; 309 } 310 311 public EnumWrapper<TrashFileRestoredItemStatusField> getItemStatus() { 312 return itemStatus; 313 } 314 315 @Override 316 public boolean equals(Object o) { 317 if (this == o) { 318 return true; 319 } 320 if (o == null || getClass() != o.getClass()) { 321 return false; 322 } 323 TrashFileRestored casted = (TrashFileRestored) o; 324 return Objects.equals(id, casted.id) 325 && Objects.equals(etag, casted.etag) 326 && Objects.equals(type, casted.type) 327 && Objects.equals(sequenceId, casted.sequenceId) 328 && Objects.equals(name, casted.name) 329 && Objects.equals(sha1, casted.sha1) 330 && Objects.equals(fileVersion, casted.fileVersion) 331 && Objects.equals(description, casted.description) 332 && Objects.equals(size, casted.size) 333 && Objects.equals(pathCollection, casted.pathCollection) 334 && Objects.equals(createdAt, casted.createdAt) 335 && Objects.equals(modifiedAt, casted.modifiedAt) 336 && Objects.equals(trashedAt, casted.trashedAt) 337 && Objects.equals(purgedAt, casted.purgedAt) 338 && Objects.equals(contentCreatedAt, casted.contentCreatedAt) 339 && Objects.equals(contentModifiedAt, casted.contentModifiedAt) 340 && Objects.equals(createdBy, casted.createdBy) 341 && Objects.equals(modifiedBy, casted.modifiedBy) 342 && Objects.equals(ownedBy, casted.ownedBy) 343 && Objects.equals(sharedLink, casted.sharedLink) 344 && Objects.equals(parent, casted.parent) 345 && Objects.equals(itemStatus, casted.itemStatus); 346 } 347 348 @Override 349 public int hashCode() { 350 return Objects.hash( 351 id, 352 etag, 353 type, 354 sequenceId, 355 name, 356 sha1, 357 fileVersion, 358 description, 359 size, 360 pathCollection, 361 createdAt, 362 modifiedAt, 363 trashedAt, 364 purgedAt, 365 contentCreatedAt, 366 contentModifiedAt, 367 createdBy, 368 modifiedBy, 369 ownedBy, 370 sharedLink, 371 parent, 372 itemStatus); 373 } 374 375 @Override 376 public String toString() { 377 return "TrashFileRestored{" 378 + "id='" 379 + id 380 + '\'' 381 + ", " 382 + "etag='" 383 + etag 384 + '\'' 385 + ", " 386 + "type='" 387 + type 388 + '\'' 389 + ", " 390 + "sequenceId='" 391 + sequenceId 392 + '\'' 393 + ", " 394 + "name='" 395 + name 396 + '\'' 397 + ", " 398 + "sha1='" 399 + sha1 400 + '\'' 401 + ", " 402 + "fileVersion='" 403 + fileVersion 404 + '\'' 405 + ", " 406 + "description='" 407 + description 408 + '\'' 409 + ", " 410 + "size='" 411 + size 412 + '\'' 413 + ", " 414 + "pathCollection='" 415 + pathCollection 416 + '\'' 417 + ", " 418 + "createdAt='" 419 + createdAt 420 + '\'' 421 + ", " 422 + "modifiedAt='" 423 + modifiedAt 424 + '\'' 425 + ", " 426 + "trashedAt='" 427 + trashedAt 428 + '\'' 429 + ", " 430 + "purgedAt='" 431 + purgedAt 432 + '\'' 433 + ", " 434 + "contentCreatedAt='" 435 + contentCreatedAt 436 + '\'' 437 + ", " 438 + "contentModifiedAt='" 439 + contentModifiedAt 440 + '\'' 441 + ", " 442 + "createdBy='" 443 + createdBy 444 + '\'' 445 + ", " 446 + "modifiedBy='" 447 + modifiedBy 448 + '\'' 449 + ", " 450 + "ownedBy='" 451 + ownedBy 452 + '\'' 453 + ", " 454 + "sharedLink='" 455 + sharedLink 456 + '\'' 457 + ", " 458 + "parent='" 459 + parent 460 + '\'' 461 + ", " 462 + "itemStatus='" 463 + itemStatus 464 + '\'' 465 + "}"; 466 } 467 468 public static class Builder extends NullableFieldTracker { 469 470 protected final String id; 471 472 protected String etag; 473 474 protected EnumWrapper<TrashFileRestoredTypeField> type; 475 476 protected final String sequenceId; 477 478 protected String name; 479 480 protected final String sha1; 481 482 protected FileVersionMini fileVersion; 483 484 protected final String description; 485 486 protected final long size; 487 488 protected final TrashFileRestoredPathCollectionField pathCollection; 489 490 protected final OffsetDateTime createdAt; 491 492 protected final OffsetDateTime modifiedAt; 493 494 protected String trashedAt; 495 496 protected String purgedAt; 497 498 protected OffsetDateTime contentCreatedAt; 499 500 protected OffsetDateTime contentModifiedAt; 501 502 protected UserMini createdBy; 503 504 protected final UserMini modifiedBy; 505 506 protected final UserMini ownedBy; 507 508 protected String sharedLink; 509 510 protected FolderMini parent; 511 512 protected final EnumWrapper<TrashFileRestoredItemStatusField> itemStatus; 513 514 public Builder( 515 String id, 516 String sequenceId, 517 String sha1, 518 String description, 519 long size, 520 TrashFileRestoredPathCollectionField pathCollection, 521 OffsetDateTime createdAt, 522 OffsetDateTime modifiedAt, 523 UserMini modifiedBy, 524 UserMini ownedBy, 525 TrashFileRestoredItemStatusField itemStatus) { 526 super(); 527 this.id = id; 528 this.sequenceId = sequenceId; 529 this.sha1 = sha1; 530 this.description = description; 531 this.size = size; 532 this.pathCollection = pathCollection; 533 this.createdAt = createdAt; 534 this.modifiedAt = modifiedAt; 535 this.modifiedBy = modifiedBy; 536 this.ownedBy = ownedBy; 537 this.itemStatus = new EnumWrapper<TrashFileRestoredItemStatusField>(itemStatus); 538 } 539 540 public Builder( 541 String id, 542 String sequenceId, 543 String sha1, 544 String description, 545 long size, 546 TrashFileRestoredPathCollectionField pathCollection, 547 OffsetDateTime createdAt, 548 OffsetDateTime modifiedAt, 549 UserMini modifiedBy, 550 UserMini ownedBy, 551 EnumWrapper<TrashFileRestoredItemStatusField> itemStatus) { 552 super(); 553 this.id = id; 554 this.sequenceId = sequenceId; 555 this.sha1 = sha1; 556 this.description = description; 557 this.size = size; 558 this.pathCollection = pathCollection; 559 this.createdAt = createdAt; 560 this.modifiedAt = modifiedAt; 561 this.modifiedBy = modifiedBy; 562 this.ownedBy = ownedBy; 563 this.itemStatus = itemStatus; 564 } 565 566 public Builder etag(String etag) { 567 this.etag = etag; 568 this.markNullableFieldAsSet("etag"); 569 return this; 570 } 571 572 public Builder type(TrashFileRestoredTypeField type) { 573 this.type = new EnumWrapper<TrashFileRestoredTypeField>(type); 574 return this; 575 } 576 577 public Builder type(EnumWrapper<TrashFileRestoredTypeField> type) { 578 this.type = type; 579 return this; 580 } 581 582 public Builder name(String name) { 583 this.name = name; 584 return this; 585 } 586 587 public Builder fileVersion(FileVersionMini fileVersion) { 588 this.fileVersion = fileVersion; 589 return this; 590 } 591 592 public Builder trashedAt(String trashedAt) { 593 this.trashedAt = trashedAt; 594 this.markNullableFieldAsSet("trashed_at"); 595 return this; 596 } 597 598 public Builder purgedAt(String purgedAt) { 599 this.purgedAt = purgedAt; 600 this.markNullableFieldAsSet("purged_at"); 601 return this; 602 } 603 604 public Builder contentCreatedAt(OffsetDateTime contentCreatedAt) { 605 this.contentCreatedAt = contentCreatedAt; 606 this.markNullableFieldAsSet("content_created_at"); 607 return this; 608 } 609 610 public Builder contentModifiedAt(OffsetDateTime contentModifiedAt) { 611 this.contentModifiedAt = contentModifiedAt; 612 this.markNullableFieldAsSet("content_modified_at"); 613 return this; 614 } 615 616 public Builder createdBy(UserMini createdBy) { 617 this.createdBy = createdBy; 618 return this; 619 } 620 621 public Builder sharedLink(String sharedLink) { 622 this.sharedLink = sharedLink; 623 this.markNullableFieldAsSet("shared_link"); 624 return this; 625 } 626 627 public Builder parent(FolderMini parent) { 628 this.parent = parent; 629 return this; 630 } 631 632 public TrashFileRestored build() { 633 if (this.type == null) { 634 this.type = new EnumWrapper<TrashFileRestoredTypeField>(TrashFileRestoredTypeField.FILE); 635 } 636 return new TrashFileRestored(this); 637 } 638 } 639}