001package com.box.sdkgen.schemas.userfull;
002
003import com.box.sdkgen.schemas.trackingcode.TrackingCode;
004import com.box.sdkgen.schemas.user.User;
005import com.box.sdkgen.schemas.user.UserNotificationEmailField;
006import com.box.sdkgen.schemas.user.UserStatusField;
007import com.box.sdkgen.schemas.userbase.UserBaseTypeField;
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.List;
015import java.util.Objects;
016
017/** A full representation of a user, as can be returned from any user API endpoint. */
018@JsonFilter("nullablePropertyFilter")
019public class UserFull extends User {
020
021  /** The user’s enterprise role. */
022  @JsonDeserialize(using = UserFullRoleField.UserFullRoleFieldDeserializer.class)
023  @JsonSerialize(using = UserFullRoleField.UserFullRoleFieldSerializer.class)
024  protected EnumWrapper<UserFullRoleField> role;
025
026  /**
027   * Tracking codes allow an admin to generate reports from the admin console and assign an
028   * attribute to a specific group of users. This setting must be enabled for an enterprise before
029   * it can be used.
030   */
031  @JsonProperty("tracking_codes")
032  protected List<TrackingCode> trackingCodes;
033
034  /** Whether the user can see other enterprise users in their contact list. */
035  @JsonProperty("can_see_managed_users")
036  protected Boolean canSeeManagedUsers;
037
038  /** Whether the user can use Box Sync. */
039  @JsonProperty("is_sync_enabled")
040  protected Boolean isSyncEnabled;
041
042  /** Whether the user is allowed to collaborate with users outside their enterprise. */
043  @JsonProperty("is_external_collab_restricted")
044  protected Boolean isExternalCollabRestricted;
045
046  /** Whether to exempt the user from Enterprise device limits. */
047  @JsonProperty("is_exempt_from_device_limits")
048  protected Boolean isExemptFromDeviceLimits;
049
050  /** Whether the user must use two-factor authentication. */
051  @JsonProperty("is_exempt_from_login_verification")
052  protected Boolean isExemptFromLoginVerification;
053
054  /**
055   * Whether collaborators can access content owned by the user when the user is inactive. This
056   * setting preserves existing collaborator access and does not grant new permissions.
057   */
058  @JsonProperty("is_collaborated_content_available_when_owner_inactive")
059  protected Boolean isCollaboratedContentAvailableWhenOwnerInactive;
060
061  protected UserFullEnterpriseField enterprise;
062
063  /**
064   * Tags for all files and folders owned by the user. Values returned will only contain tags that
065   * were set by the requester.
066   */
067  @JsonProperty("my_tags")
068  protected List<String> myTags;
069
070  /** The root (protocol, subdomain, domain) of any links that need to be generated for the user. */
071  protected String hostname;
072
073  /** Whether the user is an App User. */
074  @JsonProperty("is_platform_access_only")
075  protected Boolean isPlatformAccessOnly;
076
077  /**
078   * An external identifier for an app user, which can be used to look up the user. This can be used
079   * to tie user IDs from external identity providers to Box users.
080   */
081  @JsonProperty("external_app_user_id")
082  protected String externalAppUserId;
083
084  public UserFull(@JsonProperty("id") String id) {
085    super(id);
086  }
087
088  protected UserFull(Builder builder) {
089    super(builder);
090    this.role = builder.role;
091    this.trackingCodes = builder.trackingCodes;
092    this.canSeeManagedUsers = builder.canSeeManagedUsers;
093    this.isSyncEnabled = builder.isSyncEnabled;
094    this.isExternalCollabRestricted = builder.isExternalCollabRestricted;
095    this.isExemptFromDeviceLimits = builder.isExemptFromDeviceLimits;
096    this.isExemptFromLoginVerification = builder.isExemptFromLoginVerification;
097    this.isCollaboratedContentAvailableWhenOwnerInactive =
098        builder.isCollaboratedContentAvailableWhenOwnerInactive;
099    this.enterprise = builder.enterprise;
100    this.myTags = builder.myTags;
101    this.hostname = builder.hostname;
102    this.isPlatformAccessOnly = builder.isPlatformAccessOnly;
103    this.externalAppUserId = builder.externalAppUserId;
104    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
105  }
106
107  public EnumWrapper<UserFullRoleField> getRole() {
108    return role;
109  }
110
111  public List<TrackingCode> getTrackingCodes() {
112    return trackingCodes;
113  }
114
115  public Boolean getCanSeeManagedUsers() {
116    return canSeeManagedUsers;
117  }
118
119  public Boolean getIsSyncEnabled() {
120    return isSyncEnabled;
121  }
122
123  public Boolean getIsExternalCollabRestricted() {
124    return isExternalCollabRestricted;
125  }
126
127  public Boolean getIsExemptFromDeviceLimits() {
128    return isExemptFromDeviceLimits;
129  }
130
131  public Boolean getIsExemptFromLoginVerification() {
132    return isExemptFromLoginVerification;
133  }
134
135  public Boolean getIsCollaboratedContentAvailableWhenOwnerInactive() {
136    return isCollaboratedContentAvailableWhenOwnerInactive;
137  }
138
139  public UserFullEnterpriseField getEnterprise() {
140    return enterprise;
141  }
142
143  public List<String> getMyTags() {
144    return myTags;
145  }
146
147  public String getHostname() {
148    return hostname;
149  }
150
151  public Boolean getIsPlatformAccessOnly() {
152    return isPlatformAccessOnly;
153  }
154
155  public String getExternalAppUserId() {
156    return externalAppUserId;
157  }
158
159  @Override
160  public boolean equals(Object o) {
161    if (this == o) {
162      return true;
163    }
164    if (o == null || getClass() != o.getClass()) {
165      return false;
166    }
167    UserFull casted = (UserFull) o;
168    return Objects.equals(id, casted.id)
169        && Objects.equals(type, casted.type)
170        && Objects.equals(name, casted.name)
171        && Objects.equals(login, casted.login)
172        && Objects.equals(createdAt, casted.createdAt)
173        && Objects.equals(modifiedAt, casted.modifiedAt)
174        && Objects.equals(language, casted.language)
175        && Objects.equals(timezone, casted.timezone)
176        && Objects.equals(spaceAmount, casted.spaceAmount)
177        && Objects.equals(spaceUsed, casted.spaceUsed)
178        && Objects.equals(maxUploadSize, casted.maxUploadSize)
179        && Objects.equals(status, casted.status)
180        && Objects.equals(jobTitle, casted.jobTitle)
181        && Objects.equals(phone, casted.phone)
182        && Objects.equals(address, casted.address)
183        && Objects.equals(avatarUrl, casted.avatarUrl)
184        && Objects.equals(notificationEmail, casted.notificationEmail)
185        && Objects.equals(role, casted.role)
186        && Objects.equals(trackingCodes, casted.trackingCodes)
187        && Objects.equals(canSeeManagedUsers, casted.canSeeManagedUsers)
188        && Objects.equals(isSyncEnabled, casted.isSyncEnabled)
189        && Objects.equals(isExternalCollabRestricted, casted.isExternalCollabRestricted)
190        && Objects.equals(isExemptFromDeviceLimits, casted.isExemptFromDeviceLimits)
191        && Objects.equals(isExemptFromLoginVerification, casted.isExemptFromLoginVerification)
192        && Objects.equals(
193            isCollaboratedContentAvailableWhenOwnerInactive,
194            casted.isCollaboratedContentAvailableWhenOwnerInactive)
195        && Objects.equals(enterprise, casted.enterprise)
196        && Objects.equals(myTags, casted.myTags)
197        && Objects.equals(hostname, casted.hostname)
198        && Objects.equals(isPlatformAccessOnly, casted.isPlatformAccessOnly)
199        && Objects.equals(externalAppUserId, casted.externalAppUserId);
200  }
201
202  @Override
203  public int hashCode() {
204    return Objects.hash(
205        id,
206        type,
207        name,
208        login,
209        createdAt,
210        modifiedAt,
211        language,
212        timezone,
213        spaceAmount,
214        spaceUsed,
215        maxUploadSize,
216        status,
217        jobTitle,
218        phone,
219        address,
220        avatarUrl,
221        notificationEmail,
222        role,
223        trackingCodes,
224        canSeeManagedUsers,
225        isSyncEnabled,
226        isExternalCollabRestricted,
227        isExemptFromDeviceLimits,
228        isExemptFromLoginVerification,
229        isCollaboratedContentAvailableWhenOwnerInactive,
230        enterprise,
231        myTags,
232        hostname,
233        isPlatformAccessOnly,
234        externalAppUserId);
235  }
236
237  @Override
238  public String toString() {
239    return "UserFull{"
240        + "id='"
241        + id
242        + '\''
243        + ", "
244        + "type='"
245        + type
246        + '\''
247        + ", "
248        + "name='"
249        + name
250        + '\''
251        + ", "
252        + "login='"
253        + login
254        + '\''
255        + ", "
256        + "createdAt='"
257        + createdAt
258        + '\''
259        + ", "
260        + "modifiedAt='"
261        + modifiedAt
262        + '\''
263        + ", "
264        + "language='"
265        + language
266        + '\''
267        + ", "
268        + "timezone='"
269        + timezone
270        + '\''
271        + ", "
272        + "spaceAmount='"
273        + spaceAmount
274        + '\''
275        + ", "
276        + "spaceUsed='"
277        + spaceUsed
278        + '\''
279        + ", "
280        + "maxUploadSize='"
281        + maxUploadSize
282        + '\''
283        + ", "
284        + "status='"
285        + status
286        + '\''
287        + ", "
288        + "jobTitle='"
289        + jobTitle
290        + '\''
291        + ", "
292        + "phone='"
293        + phone
294        + '\''
295        + ", "
296        + "address='"
297        + address
298        + '\''
299        + ", "
300        + "avatarUrl='"
301        + avatarUrl
302        + '\''
303        + ", "
304        + "notificationEmail='"
305        + notificationEmail
306        + '\''
307        + ", "
308        + "role='"
309        + role
310        + '\''
311        + ", "
312        + "trackingCodes='"
313        + trackingCodes
314        + '\''
315        + ", "
316        + "canSeeManagedUsers='"
317        + canSeeManagedUsers
318        + '\''
319        + ", "
320        + "isSyncEnabled='"
321        + isSyncEnabled
322        + '\''
323        + ", "
324        + "isExternalCollabRestricted='"
325        + isExternalCollabRestricted
326        + '\''
327        + ", "
328        + "isExemptFromDeviceLimits='"
329        + isExemptFromDeviceLimits
330        + '\''
331        + ", "
332        + "isExemptFromLoginVerification='"
333        + isExemptFromLoginVerification
334        + '\''
335        + ", "
336        + "isCollaboratedContentAvailableWhenOwnerInactive='"
337        + isCollaboratedContentAvailableWhenOwnerInactive
338        + '\''
339        + ", "
340        + "enterprise='"
341        + enterprise
342        + '\''
343        + ", "
344        + "myTags='"
345        + myTags
346        + '\''
347        + ", "
348        + "hostname='"
349        + hostname
350        + '\''
351        + ", "
352        + "isPlatformAccessOnly='"
353        + isPlatformAccessOnly
354        + '\''
355        + ", "
356        + "externalAppUserId='"
357        + externalAppUserId
358        + '\''
359        + "}";
360  }
361
362  public static class Builder extends User.Builder {
363
364    protected EnumWrapper<UserFullRoleField> role;
365
366    protected List<TrackingCode> trackingCodes;
367
368    protected Boolean canSeeManagedUsers;
369
370    protected Boolean isSyncEnabled;
371
372    protected Boolean isExternalCollabRestricted;
373
374    protected Boolean isExemptFromDeviceLimits;
375
376    protected Boolean isExemptFromLoginVerification;
377
378    protected Boolean isCollaboratedContentAvailableWhenOwnerInactive;
379
380    protected UserFullEnterpriseField enterprise;
381
382    protected List<String> myTags;
383
384    protected String hostname;
385
386    protected Boolean isPlatformAccessOnly;
387
388    protected String externalAppUserId;
389
390    public Builder(String id) {
391      super(id);
392    }
393
394    public Builder role(UserFullRoleField role) {
395      this.role = new EnumWrapper<UserFullRoleField>(role);
396      return this;
397    }
398
399    public Builder role(EnumWrapper<UserFullRoleField> role) {
400      this.role = role;
401      return this;
402    }
403
404    public Builder trackingCodes(List<TrackingCode> trackingCodes) {
405      this.trackingCodes = trackingCodes;
406      return this;
407    }
408
409    public Builder canSeeManagedUsers(Boolean canSeeManagedUsers) {
410      this.canSeeManagedUsers = canSeeManagedUsers;
411      return this;
412    }
413
414    public Builder isSyncEnabled(Boolean isSyncEnabled) {
415      this.isSyncEnabled = isSyncEnabled;
416      return this;
417    }
418
419    public Builder isExternalCollabRestricted(Boolean isExternalCollabRestricted) {
420      this.isExternalCollabRestricted = isExternalCollabRestricted;
421      return this;
422    }
423
424    public Builder isExemptFromDeviceLimits(Boolean isExemptFromDeviceLimits) {
425      this.isExemptFromDeviceLimits = isExemptFromDeviceLimits;
426      return this;
427    }
428
429    public Builder isExemptFromLoginVerification(Boolean isExemptFromLoginVerification) {
430      this.isExemptFromLoginVerification = isExemptFromLoginVerification;
431      return this;
432    }
433
434    public Builder isCollaboratedContentAvailableWhenOwnerInactive(
435        Boolean isCollaboratedContentAvailableWhenOwnerInactive) {
436      this.isCollaboratedContentAvailableWhenOwnerInactive =
437          isCollaboratedContentAvailableWhenOwnerInactive;
438      return this;
439    }
440
441    public Builder enterprise(UserFullEnterpriseField enterprise) {
442      this.enterprise = enterprise;
443      return this;
444    }
445
446    public Builder myTags(List<String> myTags) {
447      this.myTags = myTags;
448      return this;
449    }
450
451    public Builder hostname(String hostname) {
452      this.hostname = hostname;
453      return this;
454    }
455
456    public Builder isPlatformAccessOnly(Boolean isPlatformAccessOnly) {
457      this.isPlatformAccessOnly = isPlatformAccessOnly;
458      return this;
459    }
460
461    public Builder externalAppUserId(String externalAppUserId) {
462      this.externalAppUserId = externalAppUserId;
463      return this;
464    }
465
466    @Override
467    public Builder type(UserBaseTypeField type) {
468      this.type = new EnumWrapper<UserBaseTypeField>(type);
469      return this;
470    }
471
472    @Override
473    public Builder type(EnumWrapper<UserBaseTypeField> type) {
474      this.type = type;
475      return this;
476    }
477
478    @Override
479    public Builder name(String name) {
480      this.name = name;
481      return this;
482    }
483
484    @Override
485    public Builder login(String login) {
486      this.login = login;
487      return this;
488    }
489
490    @Override
491    public Builder createdAt(OffsetDateTime createdAt) {
492      this.createdAt = createdAt;
493      return this;
494    }
495
496    @Override
497    public Builder modifiedAt(OffsetDateTime modifiedAt) {
498      this.modifiedAt = modifiedAt;
499      return this;
500    }
501
502    @Override
503    public Builder language(String language) {
504      this.language = language;
505      return this;
506    }
507
508    @Override
509    public Builder timezone(String timezone) {
510      this.timezone = timezone;
511      return this;
512    }
513
514    @Override
515    public Builder spaceAmount(Long spaceAmount) {
516      this.spaceAmount = spaceAmount;
517      return this;
518    }
519
520    @Override
521    public Builder spaceUsed(Long spaceUsed) {
522      this.spaceUsed = spaceUsed;
523      return this;
524    }
525
526    @Override
527    public Builder maxUploadSize(Long maxUploadSize) {
528      this.maxUploadSize = maxUploadSize;
529      return this;
530    }
531
532    @Override
533    public Builder status(UserStatusField status) {
534      this.status = new EnumWrapper<UserStatusField>(status);
535      return this;
536    }
537
538    @Override
539    public Builder status(EnumWrapper<UserStatusField> status) {
540      this.status = status;
541      return this;
542    }
543
544    @Override
545    public Builder jobTitle(String jobTitle) {
546      this.jobTitle = jobTitle;
547      return this;
548    }
549
550    @Override
551    public Builder phone(String phone) {
552      this.phone = phone;
553      return this;
554    }
555
556    @Override
557    public Builder address(String address) {
558      this.address = address;
559      return this;
560    }
561
562    @Override
563    public Builder avatarUrl(String avatarUrl) {
564      this.avatarUrl = avatarUrl;
565      return this;
566    }
567
568    @Override
569    public Builder notificationEmail(UserNotificationEmailField notificationEmail) {
570      this.notificationEmail = notificationEmail;
571      this.markNullableFieldAsSet("notification_email");
572      return this;
573    }
574
575    public UserFull build() {
576      if (this.type == null) {
577        this.type = new EnumWrapper<UserBaseTypeField>(UserBaseTypeField.USER);
578      }
579      return new UserFull(this);
580    }
581  }
582}