001package com.box.sdkgen.schemas.userintegrationmappings;
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/**
011 * A user representation for integration mappings API purposes. Fields name and login are not
012 * required.
013 */
014@JsonFilter("nullablePropertyFilter")
015public class UserIntegrationMappings extends UserBase {
016
017  /** The display name of this user. */
018  protected String name;
019
020  /** The primary email address of this user. */
021  protected String login;
022
023  public UserIntegrationMappings(@JsonProperty("id") String id) {
024    super(id);
025  }
026
027  protected UserIntegrationMappings(Builder builder) {
028    super(builder);
029    this.name = builder.name;
030    this.login = builder.login;
031    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
032  }
033
034  public String getName() {
035    return name;
036  }
037
038  public String getLogin() {
039    return login;
040  }
041
042  @Override
043  public boolean equals(Object o) {
044    if (this == o) {
045      return true;
046    }
047    if (o == null || getClass() != o.getClass()) {
048      return false;
049    }
050    UserIntegrationMappings casted = (UserIntegrationMappings) o;
051    return Objects.equals(id, casted.id)
052        && Objects.equals(type, casted.type)
053        && Objects.equals(name, casted.name)
054        && Objects.equals(login, casted.login);
055  }
056
057  @Override
058  public int hashCode() {
059    return Objects.hash(id, type, name, login);
060  }
061
062  @Override
063  public String toString() {
064    return "UserIntegrationMappings{"
065        + "id='"
066        + id
067        + '\''
068        + ", "
069        + "type='"
070        + type
071        + '\''
072        + ", "
073        + "name='"
074        + name
075        + '\''
076        + ", "
077        + "login='"
078        + login
079        + '\''
080        + "}";
081  }
082
083  public static class Builder extends UserBase.Builder {
084
085    protected String name;
086
087    protected String login;
088
089    public Builder(String id) {
090      super(id);
091    }
092
093    public Builder name(String name) {
094      this.name = name;
095      return this;
096    }
097
098    public Builder login(String login) {
099      this.login = login;
100      return this;
101    }
102
103    @Override
104    public Builder type(UserBaseTypeField type) {
105      this.type = new EnumWrapper<UserBaseTypeField>(type);
106      return this;
107    }
108
109    @Override
110    public Builder type(EnumWrapper<UserBaseTypeField> type) {
111      this.type = type;
112      return this;
113    }
114
115    public UserIntegrationMappings build() {
116      if (this.type == null) {
117        this.type = new EnumWrapper<UserBaseTypeField>(UserBaseTypeField.USER);
118      }
119      return new UserIntegrationMappings(this);
120    }
121  }
122}