001package com.box.sdkgen.schemas.groupfull;
002
003import com.box.sdkgen.schemas.group.Group;
004import com.box.sdkgen.schemas.groupbase.GroupBaseTypeField;
005import com.box.sdkgen.schemas.groupmini.GroupMiniGroupTypeField;
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/**
015 * Groups contain a set of users, and can be used in place of users in some operations, such as
016 * collaborations.
017 */
018@JsonFilter("nullablePropertyFilter")
019public class GroupFull extends Group {
020
021  /**
022   * Keeps track of which external source this group is coming from (e.g. "Active Directory",
023   * "Google Groups", "Facebook Groups"). Setting this will also prevent Box users from editing the
024   * group name and its members directly via the Box web application. This is desirable for one-way
025   * syncing of groups.
026   */
027  protected String provenance;
028
029  /**
030   * An arbitrary identifier that can be used by external group sync tools to link this Box Group to
031   * an external group. Example values of this field could be an Active Directory Object ID or a
032   * Google Group ID. We recommend you use of this field in order to avoid issues when group names
033   * are updated in either Box or external systems.
034   */
035  @JsonProperty("external_sync_identifier")
036  protected String externalSyncIdentifier;
037
038  /** Human readable description of the group. */
039  protected String description;
040
041  /**
042   * Specifies who can invite the group to collaborate on items.
043   *
044   * <p>When set to `admins_only` the enterprise admin, co-admins, and the group's admin can invite
045   * the group.
046   *
047   * <p>When set to `admins_and_members` all the admins listed above and group members can invite
048   * the group.
049   *
050   * <p>When set to `all_managed_users` all managed users in the enterprise can invite the group.
051   */
052  @JsonDeserialize(
053      using = GroupFullInvitabilityLevelField.GroupFullInvitabilityLevelFieldDeserializer.class)
054  @JsonSerialize(
055      using = GroupFullInvitabilityLevelField.GroupFullInvitabilityLevelFieldSerializer.class)
056  @JsonProperty("invitability_level")
057  protected EnumWrapper<GroupFullInvitabilityLevelField> invitabilityLevel;
058
059  /**
060   * Specifies who can view the members of the group (Get Memberships for Group).
061   *
062   * <p>* `admins_only` - the enterprise admin, co-admins, group's group admin. *
063   * `admins_and_members` - all admins and group members. * `all_managed_users` - all managed users
064   * in the enterprise.
065   */
066  @JsonDeserialize(
067      using =
068          GroupFullMemberViewabilityLevelField.GroupFullMemberViewabilityLevelFieldDeserializer
069              .class)
070  @JsonSerialize(
071      using =
072          GroupFullMemberViewabilityLevelField.GroupFullMemberViewabilityLevelFieldSerializer.class)
073  @JsonProperty("member_viewability_level")
074  protected EnumWrapper<GroupFullMemberViewabilityLevelField> memberViewabilityLevel;
075
076  protected GroupFullPermissionsField permissions;
077
078  public GroupFull(@JsonProperty("id") String id) {
079    super(id);
080  }
081
082  protected GroupFull(Builder builder) {
083    super(builder);
084    this.provenance = builder.provenance;
085    this.externalSyncIdentifier = builder.externalSyncIdentifier;
086    this.description = builder.description;
087    this.invitabilityLevel = builder.invitabilityLevel;
088    this.memberViewabilityLevel = builder.memberViewabilityLevel;
089    this.permissions = builder.permissions;
090    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
091  }
092
093  public String getProvenance() {
094    return provenance;
095  }
096
097  public String getExternalSyncIdentifier() {
098    return externalSyncIdentifier;
099  }
100
101  public String getDescription() {
102    return description;
103  }
104
105  public EnumWrapper<GroupFullInvitabilityLevelField> getInvitabilityLevel() {
106    return invitabilityLevel;
107  }
108
109  public EnumWrapper<GroupFullMemberViewabilityLevelField> getMemberViewabilityLevel() {
110    return memberViewabilityLevel;
111  }
112
113  public GroupFullPermissionsField getPermissions() {
114    return permissions;
115  }
116
117  @Override
118  public boolean equals(Object o) {
119    if (this == o) {
120      return true;
121    }
122    if (o == null || getClass() != o.getClass()) {
123      return false;
124    }
125    GroupFull casted = (GroupFull) o;
126    return Objects.equals(id, casted.id)
127        && Objects.equals(type, casted.type)
128        && Objects.equals(name, casted.name)
129        && Objects.equals(groupType, casted.groupType)
130        && Objects.equals(createdAt, casted.createdAt)
131        && Objects.equals(modifiedAt, casted.modifiedAt)
132        && Objects.equals(provenance, casted.provenance)
133        && Objects.equals(externalSyncIdentifier, casted.externalSyncIdentifier)
134        && Objects.equals(description, casted.description)
135        && Objects.equals(invitabilityLevel, casted.invitabilityLevel)
136        && Objects.equals(memberViewabilityLevel, casted.memberViewabilityLevel)
137        && Objects.equals(permissions, casted.permissions);
138  }
139
140  @Override
141  public int hashCode() {
142    return Objects.hash(
143        id,
144        type,
145        name,
146        groupType,
147        createdAt,
148        modifiedAt,
149        provenance,
150        externalSyncIdentifier,
151        description,
152        invitabilityLevel,
153        memberViewabilityLevel,
154        permissions);
155  }
156
157  @Override
158  public String toString() {
159    return "GroupFull{"
160        + "id='"
161        + id
162        + '\''
163        + ", "
164        + "type='"
165        + type
166        + '\''
167        + ", "
168        + "name='"
169        + name
170        + '\''
171        + ", "
172        + "groupType='"
173        + groupType
174        + '\''
175        + ", "
176        + "createdAt='"
177        + createdAt
178        + '\''
179        + ", "
180        + "modifiedAt='"
181        + modifiedAt
182        + '\''
183        + ", "
184        + "provenance='"
185        + provenance
186        + '\''
187        + ", "
188        + "externalSyncIdentifier='"
189        + externalSyncIdentifier
190        + '\''
191        + ", "
192        + "description='"
193        + description
194        + '\''
195        + ", "
196        + "invitabilityLevel='"
197        + invitabilityLevel
198        + '\''
199        + ", "
200        + "memberViewabilityLevel='"
201        + memberViewabilityLevel
202        + '\''
203        + ", "
204        + "permissions='"
205        + permissions
206        + '\''
207        + "}";
208  }
209
210  public static class Builder extends Group.Builder {
211
212    protected String provenance;
213
214    protected String externalSyncIdentifier;
215
216    protected String description;
217
218    protected EnumWrapper<GroupFullInvitabilityLevelField> invitabilityLevel;
219
220    protected EnumWrapper<GroupFullMemberViewabilityLevelField> memberViewabilityLevel;
221
222    protected GroupFullPermissionsField permissions;
223
224    public Builder(String id) {
225      super(id);
226    }
227
228    public Builder provenance(String provenance) {
229      this.provenance = provenance;
230      return this;
231    }
232
233    public Builder externalSyncIdentifier(String externalSyncIdentifier) {
234      this.externalSyncIdentifier = externalSyncIdentifier;
235      return this;
236    }
237
238    public Builder description(String description) {
239      this.description = description;
240      return this;
241    }
242
243    public Builder invitabilityLevel(GroupFullInvitabilityLevelField invitabilityLevel) {
244      this.invitabilityLevel = new EnumWrapper<GroupFullInvitabilityLevelField>(invitabilityLevel);
245      return this;
246    }
247
248    public Builder invitabilityLevel(
249        EnumWrapper<GroupFullInvitabilityLevelField> invitabilityLevel) {
250      this.invitabilityLevel = invitabilityLevel;
251      return this;
252    }
253
254    public Builder memberViewabilityLevel(
255        GroupFullMemberViewabilityLevelField memberViewabilityLevel) {
256      this.memberViewabilityLevel =
257          new EnumWrapper<GroupFullMemberViewabilityLevelField>(memberViewabilityLevel);
258      return this;
259    }
260
261    public Builder memberViewabilityLevel(
262        EnumWrapper<GroupFullMemberViewabilityLevelField> memberViewabilityLevel) {
263      this.memberViewabilityLevel = memberViewabilityLevel;
264      return this;
265    }
266
267    public Builder permissions(GroupFullPermissionsField permissions) {
268      this.permissions = permissions;
269      return this;
270    }
271
272    @Override
273    public Builder type(GroupBaseTypeField type) {
274      this.type = new EnumWrapper<GroupBaseTypeField>(type);
275      return this;
276    }
277
278    @Override
279    public Builder type(EnumWrapper<GroupBaseTypeField> type) {
280      this.type = type;
281      return this;
282    }
283
284    @Override
285    public Builder name(String name) {
286      this.name = name;
287      return this;
288    }
289
290    @Override
291    public Builder groupType(GroupMiniGroupTypeField groupType) {
292      this.groupType = new EnumWrapper<GroupMiniGroupTypeField>(groupType);
293      return this;
294    }
295
296    @Override
297    public Builder groupType(EnumWrapper<GroupMiniGroupTypeField> groupType) {
298      this.groupType = groupType;
299      return this;
300    }
301
302    @Override
303    public Builder createdAt(OffsetDateTime createdAt) {
304      this.createdAt = createdAt;
305      return this;
306    }
307
308    @Override
309    public Builder modifiedAt(OffsetDateTime modifiedAt) {
310      this.modifiedAt = modifiedAt;
311      return this;
312    }
313
314    public GroupFull build() {
315      if (this.type == null) {
316        this.type = new EnumWrapper<GroupBaseTypeField>(GroupBaseTypeField.GROUP);
317      }
318      return new GroupFull(this);
319    }
320  }
321}