001package com.box.sdkgen.managers.usercollaborations;
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 UpdateCollaborationByIdRequestBody extends SerializableObject {
016
017  /** The level of access granted. */
018  @JsonDeserialize(
019      using =
020          UpdateCollaborationByIdRequestBodyRoleField
021              .UpdateCollaborationByIdRequestBodyRoleFieldDeserializer.class)
022  @JsonSerialize(
023      using =
024          UpdateCollaborationByIdRequestBodyRoleField
025              .UpdateCollaborationByIdRequestBodyRoleFieldSerializer.class)
026  protected EnumWrapper<UpdateCollaborationByIdRequestBodyRoleField> role;
027
028  /**
029   * Set the status of a `pending` collaboration invitation, effectively accepting, or rejecting the
030   * invite.
031   */
032  @JsonDeserialize(
033      using =
034          UpdateCollaborationByIdRequestBodyStatusField
035              .UpdateCollaborationByIdRequestBodyStatusFieldDeserializer.class)
036  @JsonSerialize(
037      using =
038          UpdateCollaborationByIdRequestBodyStatusField
039              .UpdateCollaborationByIdRequestBodyStatusFieldSerializer.class)
040  protected EnumWrapper<UpdateCollaborationByIdRequestBodyStatusField> status;
041
042  /**
043   * Update the expiration date for the collaboration. At this date, the collaboration will be
044   * automatically removed from the item.
045   *
046   * <p>This feature will only work if the **Automatically remove invited collaborators: Allow
047   * folder owners to extend the expiry date** setting has been enabled in the **Enterprise
048   * Settings** of the **Admin Console**. When the setting is not enabled, collaborations can not
049   * have an expiry date and a value for this field will be result in an error.
050   *
051   * <p>Additionally, a collaboration can only be given an expiration if it was created after the
052   * **Automatically remove invited collaborator** setting was enabled.
053   */
054  @JsonProperty("expires_at")
055  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
056  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
057  protected OffsetDateTime expiresAt;
058
059  /**
060   * Determines if the invited users can see the entire parent path to the associated folder. The
061   * user will not gain privileges in any parent folder and therefore can not see content the user
062   * is not collaborated on.
063   *
064   * <p>Be aware that this meaningfully increases the time required to load the invitee's **All
065   * Files** page. We recommend you limit the number of collaborations with `can_view_path` enabled
066   * to 1,000 per user.
067   *
068   * <p>Only an owner or co-owners can invite collaborators with a `can_view_path` of `true`. Only
069   * an owner can update `can_view_path` on existing collaborations.
070   *
071   * <p>`can_view_path` can only be used for folder collaborations.
072   *
073   * <p>When you delete a folder with `can_view_path=true`, collaborators may still see the parent
074   * path. For instructions on how to remove this, see [Even though a folder invited via
075   * can_view_path is deleted, the path remains
076   * displayed](https://support.box.com/hc/en-us/articles/37472814319891-Even-though-a-folder-invited-via-can-view-path-is-deleted-the-path-remains-displayed).
077   */
078  @JsonProperty("can_view_path")
079  protected Boolean canViewPath;
080
081  public UpdateCollaborationByIdRequestBody() {
082    super();
083  }
084
085  protected UpdateCollaborationByIdRequestBody(Builder builder) {
086    super();
087    this.role = builder.role;
088    this.status = builder.status;
089    this.expiresAt = builder.expiresAt;
090    this.canViewPath = builder.canViewPath;
091    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
092  }
093
094  public EnumWrapper<UpdateCollaborationByIdRequestBodyRoleField> getRole() {
095    return role;
096  }
097
098  public EnumWrapper<UpdateCollaborationByIdRequestBodyStatusField> getStatus() {
099    return status;
100  }
101
102  public OffsetDateTime getExpiresAt() {
103    return expiresAt;
104  }
105
106  public Boolean getCanViewPath() {
107    return canViewPath;
108  }
109
110  @Override
111  public boolean equals(Object o) {
112    if (this == o) {
113      return true;
114    }
115    if (o == null || getClass() != o.getClass()) {
116      return false;
117    }
118    UpdateCollaborationByIdRequestBody casted = (UpdateCollaborationByIdRequestBody) o;
119    return Objects.equals(role, casted.role)
120        && Objects.equals(status, casted.status)
121        && Objects.equals(expiresAt, casted.expiresAt)
122        && Objects.equals(canViewPath, casted.canViewPath);
123  }
124
125  @Override
126  public int hashCode() {
127    return Objects.hash(role, status, expiresAt, canViewPath);
128  }
129
130  @Override
131  public String toString() {
132    return "UpdateCollaborationByIdRequestBody{"
133        + "role='"
134        + role
135        + '\''
136        + ", "
137        + "status='"
138        + status
139        + '\''
140        + ", "
141        + "expiresAt='"
142        + expiresAt
143        + '\''
144        + ", "
145        + "canViewPath='"
146        + canViewPath
147        + '\''
148        + "}";
149  }
150
151  public static class Builder extends NullableFieldTracker {
152
153    protected EnumWrapper<UpdateCollaborationByIdRequestBodyRoleField> role;
154
155    protected EnumWrapper<UpdateCollaborationByIdRequestBodyStatusField> status;
156
157    protected OffsetDateTime expiresAt;
158
159    protected Boolean canViewPath;
160
161    public Builder role(UpdateCollaborationByIdRequestBodyRoleField role) {
162      this.role = new EnumWrapper<UpdateCollaborationByIdRequestBodyRoleField>(role);
163      return this;
164    }
165
166    public Builder role(EnumWrapper<UpdateCollaborationByIdRequestBodyRoleField> role) {
167      this.role = role;
168      return this;
169    }
170
171    public Builder status(UpdateCollaborationByIdRequestBodyStatusField status) {
172      this.status = new EnumWrapper<UpdateCollaborationByIdRequestBodyStatusField>(status);
173      return this;
174    }
175
176    public Builder status(EnumWrapper<UpdateCollaborationByIdRequestBodyStatusField> status) {
177      this.status = status;
178      return this;
179    }
180
181    public Builder expiresAt(OffsetDateTime expiresAt) {
182      this.expiresAt = expiresAt;
183      return this;
184    }
185
186    public Builder canViewPath(Boolean canViewPath) {
187      this.canViewPath = canViewPath;
188      return this;
189    }
190
191    public UpdateCollaborationByIdRequestBody build() {
192      return new UpdateCollaborationByIdRequestBody(this);
193    }
194  }
195}