001package com.box.sdkgen.schemas.filefull;
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.usermini.UserMini;
008import com.box.sdkgen.serialization.json.EnumWrapper;
009import com.fasterxml.jackson.annotation.JsonFilter;
010import com.fasterxml.jackson.annotation.JsonProperty;
011import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
012import com.fasterxml.jackson.databind.annotation.JsonSerialize;
013import java.time.OffsetDateTime;
014import java.util.Objects;
015
016@JsonFilter("nullablePropertyFilter")
017public class FileFullLockField extends SerializableObject {
018
019  /** The unique identifier for this lock. */
020  protected String id;
021
022  /** The value will always be `lock`. */
023  @JsonDeserialize(using = FileFullLockTypeField.FileFullLockTypeFieldDeserializer.class)
024  @JsonSerialize(using = FileFullLockTypeField.FileFullLockTypeFieldSerializer.class)
025  protected EnumWrapper<FileFullLockTypeField> type;
026
027  @JsonProperty("created_by")
028  protected UserMini createdBy;
029
030  /** The time this lock was created at. */
031  @JsonProperty("created_at")
032  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
033  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
034  protected OffsetDateTime createdAt;
035
036  /** The time this lock is to expire at, which might be in the past. */
037  @JsonProperty("expired_at")
038  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
039  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
040  protected OffsetDateTime expiredAt;
041
042  /** Whether or not the file can be downloaded while locked. */
043  @JsonProperty("is_download_prevented")
044  protected Boolean isDownloadPrevented;
045
046  /**
047   * If the lock is managed by an application rather than a user, this field identifies the type of
048   * the application that holds the lock. This is an open enum and may be extended with additional
049   * values in the future.
050   */
051  @JsonDeserialize(using = FileFullLockAppTypeField.FileFullLockAppTypeFieldDeserializer.class)
052  @JsonSerialize(using = FileFullLockAppTypeField.FileFullLockAppTypeFieldSerializer.class)
053  @JsonProperty("app_type")
054  @Nullable
055  protected EnumWrapper<FileFullLockAppTypeField> appType;
056
057  public FileFullLockField() {
058    super();
059  }
060
061  protected FileFullLockField(Builder builder) {
062    super();
063    this.id = builder.id;
064    this.type = builder.type;
065    this.createdBy = builder.createdBy;
066    this.createdAt = builder.createdAt;
067    this.expiredAt = builder.expiredAt;
068    this.isDownloadPrevented = builder.isDownloadPrevented;
069    this.appType = builder.appType;
070    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
071  }
072
073  public String getId() {
074    return id;
075  }
076
077  public EnumWrapper<FileFullLockTypeField> getType() {
078    return type;
079  }
080
081  public UserMini getCreatedBy() {
082    return createdBy;
083  }
084
085  public OffsetDateTime getCreatedAt() {
086    return createdAt;
087  }
088
089  public OffsetDateTime getExpiredAt() {
090    return expiredAt;
091  }
092
093  public Boolean getIsDownloadPrevented() {
094    return isDownloadPrevented;
095  }
096
097  public EnumWrapper<FileFullLockAppTypeField> getAppType() {
098    return appType;
099  }
100
101  @Override
102  public boolean equals(Object o) {
103    if (this == o) {
104      return true;
105    }
106    if (o == null || getClass() != o.getClass()) {
107      return false;
108    }
109    FileFullLockField casted = (FileFullLockField) o;
110    return Objects.equals(id, casted.id)
111        && Objects.equals(type, casted.type)
112        && Objects.equals(createdBy, casted.createdBy)
113        && Objects.equals(createdAt, casted.createdAt)
114        && Objects.equals(expiredAt, casted.expiredAt)
115        && Objects.equals(isDownloadPrevented, casted.isDownloadPrevented)
116        && Objects.equals(appType, casted.appType);
117  }
118
119  @Override
120  public int hashCode() {
121    return Objects.hash(id, type, createdBy, createdAt, expiredAt, isDownloadPrevented, appType);
122  }
123
124  @Override
125  public String toString() {
126    return "FileFullLockField{"
127        + "id='"
128        + id
129        + '\''
130        + ", "
131        + "type='"
132        + type
133        + '\''
134        + ", "
135        + "createdBy='"
136        + createdBy
137        + '\''
138        + ", "
139        + "createdAt='"
140        + createdAt
141        + '\''
142        + ", "
143        + "expiredAt='"
144        + expiredAt
145        + '\''
146        + ", "
147        + "isDownloadPrevented='"
148        + isDownloadPrevented
149        + '\''
150        + ", "
151        + "appType='"
152        + appType
153        + '\''
154        + "}";
155  }
156
157  public static class Builder extends NullableFieldTracker {
158
159    protected String id;
160
161    protected EnumWrapper<FileFullLockTypeField> type;
162
163    protected UserMini createdBy;
164
165    protected OffsetDateTime createdAt;
166
167    protected OffsetDateTime expiredAt;
168
169    protected Boolean isDownloadPrevented;
170
171    protected EnumWrapper<FileFullLockAppTypeField> appType;
172
173    public Builder id(String id) {
174      this.id = id;
175      return this;
176    }
177
178    public Builder type(FileFullLockTypeField type) {
179      this.type = new EnumWrapper<FileFullLockTypeField>(type);
180      return this;
181    }
182
183    public Builder type(EnumWrapper<FileFullLockTypeField> type) {
184      this.type = type;
185      return this;
186    }
187
188    public Builder createdBy(UserMini createdBy) {
189      this.createdBy = createdBy;
190      return this;
191    }
192
193    public Builder createdAt(OffsetDateTime createdAt) {
194      this.createdAt = createdAt;
195      return this;
196    }
197
198    public Builder expiredAt(OffsetDateTime expiredAt) {
199      this.expiredAt = expiredAt;
200      return this;
201    }
202
203    public Builder isDownloadPrevented(Boolean isDownloadPrevented) {
204      this.isDownloadPrevented = isDownloadPrevented;
205      return this;
206    }
207
208    public Builder appType(FileFullLockAppTypeField appType) {
209      this.appType = new EnumWrapper<FileFullLockAppTypeField>(appType);
210      this.markNullableFieldAsSet("app_type");
211      return this;
212    }
213
214    public Builder appType(EnumWrapper<FileFullLockAppTypeField> appType) {
215      this.appType = appType;
216      this.markNullableFieldAsSet("app_type");
217      return this;
218    }
219
220    public FileFullLockField build() {
221      return new FileFullLockField(this);
222    }
223  }
224}