001package com.box.sdkgen.managers.files;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.internal.utils.DateTimeUtils;
006import com.box.sdkgen.serialization.json.EnumWrapper;
007import com.fasterxml.jackson.annotation.JsonFilter;
008import com.fasterxml.jackson.annotation.JsonProperty;
009import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
010import com.fasterxml.jackson.databind.annotation.JsonSerialize;
011import java.time.OffsetDateTime;
012import java.util.Objects;
013
014@JsonFilter("nullablePropertyFilter")
015public class UpdateFileByIdRequestBodyLockField extends SerializableObject {
016
017  /** The type of this object. */
018  @JsonDeserialize(
019      using =
020          UpdateFileByIdRequestBodyLockAccessField
021              .UpdateFileByIdRequestBodyLockAccessFieldDeserializer.class)
022  @JsonSerialize(
023      using =
024          UpdateFileByIdRequestBodyLockAccessField
025              .UpdateFileByIdRequestBodyLockAccessFieldSerializer.class)
026  protected EnumWrapper<UpdateFileByIdRequestBodyLockAccessField> access;
027
028  /** Defines the time at which the lock expires. */
029  @JsonProperty("expires_at")
030  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
031  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
032  protected OffsetDateTime expiresAt;
033
034  /** Defines if the file can be downloaded while it is locked. */
035  @JsonProperty("is_download_prevented")
036  protected Boolean isDownloadPrevented;
037
038  public UpdateFileByIdRequestBodyLockField() {
039    super();
040  }
041
042  protected UpdateFileByIdRequestBodyLockField(Builder builder) {
043    super();
044    this.access = builder.access;
045    this.expiresAt = builder.expiresAt;
046    this.isDownloadPrevented = builder.isDownloadPrevented;
047    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
048  }
049
050  public EnumWrapper<UpdateFileByIdRequestBodyLockAccessField> getAccess() {
051    return access;
052  }
053
054  public OffsetDateTime getExpiresAt() {
055    return expiresAt;
056  }
057
058  public Boolean getIsDownloadPrevented() {
059    return isDownloadPrevented;
060  }
061
062  @Override
063  public boolean equals(Object o) {
064    if (this == o) {
065      return true;
066    }
067    if (o == null || getClass() != o.getClass()) {
068      return false;
069    }
070    UpdateFileByIdRequestBodyLockField casted = (UpdateFileByIdRequestBodyLockField) o;
071    return Objects.equals(access, casted.access)
072        && Objects.equals(expiresAt, casted.expiresAt)
073        && Objects.equals(isDownloadPrevented, casted.isDownloadPrevented);
074  }
075
076  @Override
077  public int hashCode() {
078    return Objects.hash(access, expiresAt, isDownloadPrevented);
079  }
080
081  @Override
082  public String toString() {
083    return "UpdateFileByIdRequestBodyLockField{"
084        + "access='"
085        + access
086        + '\''
087        + ", "
088        + "expiresAt='"
089        + expiresAt
090        + '\''
091        + ", "
092        + "isDownloadPrevented='"
093        + isDownloadPrevented
094        + '\''
095        + "}";
096  }
097
098  public static class Builder extends NullableFieldTracker {
099
100    protected EnumWrapper<UpdateFileByIdRequestBodyLockAccessField> access;
101
102    protected OffsetDateTime expiresAt;
103
104    protected Boolean isDownloadPrevented;
105
106    public Builder access(UpdateFileByIdRequestBodyLockAccessField access) {
107      this.access = new EnumWrapper<UpdateFileByIdRequestBodyLockAccessField>(access);
108      return this;
109    }
110
111    public Builder access(EnumWrapper<UpdateFileByIdRequestBodyLockAccessField> access) {
112      this.access = access;
113      return this;
114    }
115
116    public Builder expiresAt(OffsetDateTime expiresAt) {
117      this.expiresAt = expiresAt;
118      return this;
119    }
120
121    public Builder isDownloadPrevented(Boolean isDownloadPrevented) {
122      this.isDownloadPrevented = isDownloadPrevented;
123      return this;
124    }
125
126    public UpdateFileByIdRequestBodyLockField build() {
127      return new UpdateFileByIdRequestBodyLockField(this);
128    }
129  }
130}