001package com.box.sdkgen.schemas.groupmini;
002
003import com.box.sdkgen.schemas.groupbase.GroupBase;
004import com.box.sdkgen.schemas.groupbase.GroupBaseTypeField;
005import com.box.sdkgen.serialization.json.EnumWrapper;
006import com.fasterxml.jackson.annotation.JsonFilter;
007import com.fasterxml.jackson.annotation.JsonProperty;
008import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
009import com.fasterxml.jackson.databind.annotation.JsonSerialize;
010import java.util.Objects;
011
012/** Mini representation of a group, including id and name of group. */
013@JsonFilter("nullablePropertyFilter")
014public class GroupMini extends GroupBase {
015
016  /** The name of the group. */
017  protected String name;
018
019  /** The type of the group. */
020  @JsonDeserialize(using = GroupMiniGroupTypeField.GroupMiniGroupTypeFieldDeserializer.class)
021  @JsonSerialize(using = GroupMiniGroupTypeField.GroupMiniGroupTypeFieldSerializer.class)
022  @JsonProperty("group_type")
023  protected EnumWrapper<GroupMiniGroupTypeField> groupType;
024
025  public GroupMini(@JsonProperty("id") String id) {
026    super(id);
027  }
028
029  protected GroupMini(Builder builder) {
030    super(builder);
031    this.name = builder.name;
032    this.groupType = builder.groupType;
033    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
034  }
035
036  public String getName() {
037    return name;
038  }
039
040  public EnumWrapper<GroupMiniGroupTypeField> getGroupType() {
041    return groupType;
042  }
043
044  @Override
045  public boolean equals(Object o) {
046    if (this == o) {
047      return true;
048    }
049    if (o == null || getClass() != o.getClass()) {
050      return false;
051    }
052    GroupMini casted = (GroupMini) o;
053    return Objects.equals(id, casted.id)
054        && Objects.equals(type, casted.type)
055        && Objects.equals(name, casted.name)
056        && Objects.equals(groupType, casted.groupType);
057  }
058
059  @Override
060  public int hashCode() {
061    return Objects.hash(id, type, name, groupType);
062  }
063
064  @Override
065  public String toString() {
066    return "GroupMini{"
067        + "id='"
068        + id
069        + '\''
070        + ", "
071        + "type='"
072        + type
073        + '\''
074        + ", "
075        + "name='"
076        + name
077        + '\''
078        + ", "
079        + "groupType='"
080        + groupType
081        + '\''
082        + "}";
083  }
084
085  public static class Builder extends GroupBase.Builder {
086
087    protected String name;
088
089    protected EnumWrapper<GroupMiniGroupTypeField> groupType;
090
091    public Builder(String id) {
092      super(id);
093    }
094
095    public Builder name(String name) {
096      this.name = name;
097      return this;
098    }
099
100    public Builder groupType(GroupMiniGroupTypeField groupType) {
101      this.groupType = new EnumWrapper<GroupMiniGroupTypeField>(groupType);
102      return this;
103    }
104
105    public Builder groupType(EnumWrapper<GroupMiniGroupTypeField> groupType) {
106      this.groupType = groupType;
107      return this;
108    }
109
110    @Override
111    public Builder type(GroupBaseTypeField type) {
112      this.type = new EnumWrapper<GroupBaseTypeField>(type);
113      return this;
114    }
115
116    @Override
117    public Builder type(EnumWrapper<GroupBaseTypeField> type) {
118      this.type = type;
119      return this;
120    }
121
122    public GroupMini build() {
123      if (this.type == null) {
124        this.type = new EnumWrapper<GroupBaseTypeField>(GroupBaseTypeField.GROUP);
125      }
126      return new GroupMini(this);
127    }
128  }
129}