001package com.box.sdkgen.managers.folders;
002
003import com.box.sdkgen.internal.Nullable;
004import com.box.sdkgen.internal.NullableFieldTracker;
005import com.box.sdkgen.internal.SerializableObject;
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.util.List;
012import java.util.Objects;
013
014@JsonFilter("nullablePropertyFilter")
015public class UpdateFolderByIdRequestBody extends SerializableObject {
016
017  /**
018   * The optional new name for this folder.
019   *
020   * <p>The following restrictions to folder names apply: names containing non-printable ASCII
021   * characters, forward and backward slashes (`/`, `\`), names with trailing spaces, and names `.`
022   * and `..` are not allowed.
023   *
024   * <p>Folder names must be unique within their parent folder. The name check is case-insensitive,
025   * so a folder named `New Folder` cannot be created in a parent folder that already contains a
026   * folder named `new folder`.
027   */
028  protected String name;
029
030  /** The optional description of this folder. */
031  protected String description;
032
033  /**
034   * Specifies whether a folder should be synced to a user's device or not. This is used by Box Sync
035   * (discontinued) and is not used by Box Drive.
036   */
037  @JsonDeserialize(
038      using =
039          UpdateFolderByIdRequestBodySyncStateField
040              .UpdateFolderByIdRequestBodySyncStateFieldDeserializer.class)
041  @JsonSerialize(
042      using =
043          UpdateFolderByIdRequestBodySyncStateField
044              .UpdateFolderByIdRequestBodySyncStateFieldSerializer.class)
045  @JsonProperty("sync_state")
046  protected EnumWrapper<UpdateFolderByIdRequestBodySyncStateField> syncState;
047
048  /**
049   * Specifies if users who are not the owner of the folder can invite new collaborators to the
050   * folder.
051   */
052  @JsonProperty("can_non_owners_invite")
053  protected Boolean canNonOwnersInvite;
054
055  protected UpdateFolderByIdRequestBodyParentField parent;
056
057  @JsonProperty("shared_link")
058  protected UpdateFolderByIdRequestBodySharedLinkField sharedLink;
059
060  @JsonProperty("folder_upload_email")
061  @Nullable
062  protected UpdateFolderByIdRequestBodyFolderUploadEmailField folderUploadEmail;
063
064  /**
065   * The tags for this item. These tags are shown in the Box web app and mobile apps next to an
066   * item.
067   *
068   * <p>To add or remove a tag, retrieve the item's current tags, modify them, and then update this
069   * field.
070   *
071   * <p>There is a limit of 100 tags per item, and 10,000 unique tags per enterprise.
072   */
073  protected List<String> tags;
074
075  /**
076   * Specifies if new invites to this folder are restricted to users within the enterprise. This
077   * does not affect existing collaborations.
078   */
079  @JsonProperty("is_collaboration_restricted_to_enterprise")
080  protected Boolean isCollaborationRestrictedToEnterprise;
081
082  /**
083   * An array of collections to make this folder a member of. Currently we only support the
084   * `favorites` collection.
085   *
086   * <p>To get the ID for a collection, use the [List all collections][1] endpoint.
087   *
088   * <p>Passing an empty array `[]` or `null` will remove the folder from all collections.
089   *
090   * <p>[1]: https://developer.box.com/reference/get-collections
091   */
092  @Nullable protected List<UpdateFolderByIdRequestBodyCollectionsField> collections;
093
094  /**
095   * Restricts collaborators who are not the owner of this folder from viewing other collaborations
096   * on this folder.
097   *
098   * <p>It also restricts non-owners from inviting new collaborators.
099   *
100   * <p>When setting this field to `false`, it is required to also set
101   * `can_non_owners_invite_collaborators` to `false` if it has not already been set.
102   */
103  @JsonProperty("can_non_owners_view_collaborators")
104  protected Boolean canNonOwnersViewCollaborators;
105
106  public UpdateFolderByIdRequestBody() {
107    super();
108  }
109
110  protected UpdateFolderByIdRequestBody(Builder builder) {
111    super();
112    this.name = builder.name;
113    this.description = builder.description;
114    this.syncState = builder.syncState;
115    this.canNonOwnersInvite = builder.canNonOwnersInvite;
116    this.parent = builder.parent;
117    this.sharedLink = builder.sharedLink;
118    this.folderUploadEmail = builder.folderUploadEmail;
119    this.tags = builder.tags;
120    this.isCollaborationRestrictedToEnterprise = builder.isCollaborationRestrictedToEnterprise;
121    this.collections = builder.collections;
122    this.canNonOwnersViewCollaborators = builder.canNonOwnersViewCollaborators;
123    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
124  }
125
126  public String getName() {
127    return name;
128  }
129
130  public String getDescription() {
131    return description;
132  }
133
134  public EnumWrapper<UpdateFolderByIdRequestBodySyncStateField> getSyncState() {
135    return syncState;
136  }
137
138  public Boolean getCanNonOwnersInvite() {
139    return canNonOwnersInvite;
140  }
141
142  public UpdateFolderByIdRequestBodyParentField getParent() {
143    return parent;
144  }
145
146  public UpdateFolderByIdRequestBodySharedLinkField getSharedLink() {
147    return sharedLink;
148  }
149
150  public UpdateFolderByIdRequestBodyFolderUploadEmailField getFolderUploadEmail() {
151    return folderUploadEmail;
152  }
153
154  public List<String> getTags() {
155    return tags;
156  }
157
158  public Boolean getIsCollaborationRestrictedToEnterprise() {
159    return isCollaborationRestrictedToEnterprise;
160  }
161
162  public List<UpdateFolderByIdRequestBodyCollectionsField> getCollections() {
163    return collections;
164  }
165
166  public Boolean getCanNonOwnersViewCollaborators() {
167    return canNonOwnersViewCollaborators;
168  }
169
170  @Override
171  public boolean equals(Object o) {
172    if (this == o) {
173      return true;
174    }
175    if (o == null || getClass() != o.getClass()) {
176      return false;
177    }
178    UpdateFolderByIdRequestBody casted = (UpdateFolderByIdRequestBody) o;
179    return Objects.equals(name, casted.name)
180        && Objects.equals(description, casted.description)
181        && Objects.equals(syncState, casted.syncState)
182        && Objects.equals(canNonOwnersInvite, casted.canNonOwnersInvite)
183        && Objects.equals(parent, casted.parent)
184        && Objects.equals(sharedLink, casted.sharedLink)
185        && Objects.equals(folderUploadEmail, casted.folderUploadEmail)
186        && Objects.equals(tags, casted.tags)
187        && Objects.equals(
188            isCollaborationRestrictedToEnterprise, casted.isCollaborationRestrictedToEnterprise)
189        && Objects.equals(collections, casted.collections)
190        && Objects.equals(canNonOwnersViewCollaborators, casted.canNonOwnersViewCollaborators);
191  }
192
193  @Override
194  public int hashCode() {
195    return Objects.hash(
196        name,
197        description,
198        syncState,
199        canNonOwnersInvite,
200        parent,
201        sharedLink,
202        folderUploadEmail,
203        tags,
204        isCollaborationRestrictedToEnterprise,
205        collections,
206        canNonOwnersViewCollaborators);
207  }
208
209  @Override
210  public String toString() {
211    return "UpdateFolderByIdRequestBody{"
212        + "name='"
213        + name
214        + '\''
215        + ", "
216        + "description='"
217        + description
218        + '\''
219        + ", "
220        + "syncState='"
221        + syncState
222        + '\''
223        + ", "
224        + "canNonOwnersInvite='"
225        + canNonOwnersInvite
226        + '\''
227        + ", "
228        + "parent='"
229        + parent
230        + '\''
231        + ", "
232        + "sharedLink='"
233        + sharedLink
234        + '\''
235        + ", "
236        + "folderUploadEmail='"
237        + folderUploadEmail
238        + '\''
239        + ", "
240        + "tags='"
241        + tags
242        + '\''
243        + ", "
244        + "isCollaborationRestrictedToEnterprise='"
245        + isCollaborationRestrictedToEnterprise
246        + '\''
247        + ", "
248        + "collections='"
249        + collections
250        + '\''
251        + ", "
252        + "canNonOwnersViewCollaborators='"
253        + canNonOwnersViewCollaborators
254        + '\''
255        + "}";
256  }
257
258  public static class Builder extends NullableFieldTracker {
259
260    protected String name;
261
262    protected String description;
263
264    protected EnumWrapper<UpdateFolderByIdRequestBodySyncStateField> syncState;
265
266    protected Boolean canNonOwnersInvite;
267
268    protected UpdateFolderByIdRequestBodyParentField parent;
269
270    protected UpdateFolderByIdRequestBodySharedLinkField sharedLink;
271
272    protected UpdateFolderByIdRequestBodyFolderUploadEmailField folderUploadEmail;
273
274    protected List<String> tags;
275
276    protected Boolean isCollaborationRestrictedToEnterprise;
277
278    protected List<UpdateFolderByIdRequestBodyCollectionsField> collections;
279
280    protected Boolean canNonOwnersViewCollaborators;
281
282    public Builder name(String name) {
283      this.name = name;
284      return this;
285    }
286
287    public Builder description(String description) {
288      this.description = description;
289      return this;
290    }
291
292    public Builder syncState(UpdateFolderByIdRequestBodySyncStateField syncState) {
293      this.syncState = new EnumWrapper<UpdateFolderByIdRequestBodySyncStateField>(syncState);
294      return this;
295    }
296
297    public Builder syncState(EnumWrapper<UpdateFolderByIdRequestBodySyncStateField> syncState) {
298      this.syncState = syncState;
299      return this;
300    }
301
302    public Builder canNonOwnersInvite(Boolean canNonOwnersInvite) {
303      this.canNonOwnersInvite = canNonOwnersInvite;
304      return this;
305    }
306
307    public Builder parent(UpdateFolderByIdRequestBodyParentField parent) {
308      this.parent = parent;
309      return this;
310    }
311
312    public Builder sharedLink(UpdateFolderByIdRequestBodySharedLinkField sharedLink) {
313      this.sharedLink = sharedLink;
314      return this;
315    }
316
317    public Builder folderUploadEmail(
318        UpdateFolderByIdRequestBodyFolderUploadEmailField folderUploadEmail) {
319      this.folderUploadEmail = folderUploadEmail;
320      this.markNullableFieldAsSet("folder_upload_email");
321      return this;
322    }
323
324    public Builder tags(List<String> tags) {
325      this.tags = tags;
326      return this;
327    }
328
329    public Builder isCollaborationRestrictedToEnterprise(
330        Boolean isCollaborationRestrictedToEnterprise) {
331      this.isCollaborationRestrictedToEnterprise = isCollaborationRestrictedToEnterprise;
332      return this;
333    }
334
335    public Builder collections(List<UpdateFolderByIdRequestBodyCollectionsField> collections) {
336      this.collections = collections;
337      this.markNullableFieldAsSet("collections");
338      return this;
339    }
340
341    public Builder canNonOwnersViewCollaborators(Boolean canNonOwnersViewCollaborators) {
342      this.canNonOwnersViewCollaborators = canNonOwnersViewCollaborators;
343      return this;
344    }
345
346    public UpdateFolderByIdRequestBody build() {
347      return new UpdateFolderByIdRequestBody(this);
348    }
349  }
350}