001package com.box.sdkgen.schemas.usercollaborations;
002
003import com.box.sdkgen.schemas.userbase.UserBase;
004import com.box.sdkgen.schemas.userbase.UserBaseTypeField;
005import com.box.sdkgen.serialization.json.EnumWrapper;
006import com.fasterxml.jackson.annotation.JsonFilter;
007import com.fasterxml.jackson.annotation.JsonProperty;
008import java.util.Objects;
009
010/** A mini representation of a user, can be returned only when the status is `pending`. */
011@JsonFilter("nullablePropertyFilter")
012public class UserCollaborations extends UserBase {
013
014  /**
015   * The display name of this user. If the collaboration status is `pending`, an empty string is
016   * returned.
017   */
018  protected String name;
019
020  /**
021   * The primary email address of this user. If the collaboration status is `pending`, an empty
022   * string is returned.
023   */
024  protected String login;
025
026  /** If set to `false`, the user is either deactivated or deleted. */
027  @JsonProperty("is_active")
028  protected Boolean isActive;
029
030  public UserCollaborations(@JsonProperty("id") String id) {
031    super(id);
032  }
033
034  protected UserCollaborations(Builder builder) {
035    super(builder);
036    this.name = builder.name;
037    this.login = builder.login;
038    this.isActive = builder.isActive;
039    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
040  }
041
042  public String getName() {
043    return name;
044  }
045
046  public String getLogin() {
047    return login;
048  }
049
050  public Boolean getIsActive() {
051    return isActive;
052  }
053
054  @Override
055  public boolean equals(Object o) {
056    if (this == o) {
057      return true;
058    }
059    if (o == null || getClass() != o.getClass()) {
060      return false;
061    }
062    UserCollaborations casted = (UserCollaborations) o;
063    return Objects.equals(id, casted.id)
064        && Objects.equals(type, casted.type)
065        && Objects.equals(name, casted.name)
066        && Objects.equals(login, casted.login)
067        && Objects.equals(isActive, casted.isActive);
068  }
069
070  @Override
071  public int hashCode() {
072    return Objects.hash(id, type, name, login, isActive);
073  }
074
075  @Override
076  public String toString() {
077    return "UserCollaborations{"
078        + "id='"
079        + id
080        + '\''
081        + ", "
082        + "type='"
083        + type
084        + '\''
085        + ", "
086        + "name='"
087        + name
088        + '\''
089        + ", "
090        + "login='"
091        + login
092        + '\''
093        + ", "
094        + "isActive='"
095        + isActive
096        + '\''
097        + "}";
098  }
099
100  public static class Builder extends UserBase.Builder {
101
102    protected String name;
103
104    protected String login;
105
106    protected Boolean isActive;
107
108    public Builder(String id) {
109      super(id);
110    }
111
112    public Builder name(String name) {
113      this.name = name;
114      return this;
115    }
116
117    public Builder login(String login) {
118      this.login = login;
119      return this;
120    }
121
122    public Builder isActive(Boolean isActive) {
123      this.isActive = isActive;
124      return this;
125    }
126
127    @Override
128    public Builder type(UserBaseTypeField type) {
129      this.type = new EnumWrapper<UserBaseTypeField>(type);
130      return this;
131    }
132
133    @Override
134    public Builder type(EnumWrapper<UserBaseTypeField> type) {
135      this.type = type;
136      return this;
137    }
138
139    public UserCollaborations build() {
140      if (this.type == null) {
141        this.type = new EnumWrapper<UserBaseTypeField>(UserBaseTypeField.USER);
142      }
143      return new UserCollaborations(this);
144    }
145  }
146}