001package com.box.sdkgen.schemas.v2025r0.userorgroupreferencev2025r0;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.serialization.json.EnumWrapper;
006import com.fasterxml.jackson.annotation.JsonFilter;
007import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
008import com.fasterxml.jackson.databind.annotation.JsonSerialize;
009import java.util.Objects;
010
011/** A reference to a user or group. */
012@JsonFilter("nullablePropertyFilter")
013public class UserOrGroupReferenceV2025R0 extends SerializableObject {
014
015  /** The type `user` or `group`. */
016  @JsonDeserialize(
017      using =
018          UserOrGroupReferenceV2025R0TypeField.UserOrGroupReferenceV2025R0TypeFieldDeserializer
019              .class)
020  @JsonSerialize(
021      using =
022          UserOrGroupReferenceV2025R0TypeField.UserOrGroupReferenceV2025R0TypeFieldSerializer.class)
023  protected EnumWrapper<UserOrGroupReferenceV2025R0TypeField> type;
024
025  /** The identifier of the user or group. */
026  protected String id;
027
028  public UserOrGroupReferenceV2025R0() {
029    super();
030  }
031
032  protected UserOrGroupReferenceV2025R0(Builder builder) {
033    super();
034    this.type = builder.type;
035    this.id = builder.id;
036    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
037  }
038
039  public EnumWrapper<UserOrGroupReferenceV2025R0TypeField> getType() {
040    return type;
041  }
042
043  public String getId() {
044    return id;
045  }
046
047  @Override
048  public boolean equals(Object o) {
049    if (this == o) {
050      return true;
051    }
052    if (o == null || getClass() != o.getClass()) {
053      return false;
054    }
055    UserOrGroupReferenceV2025R0 casted = (UserOrGroupReferenceV2025R0) o;
056    return Objects.equals(type, casted.type) && Objects.equals(id, casted.id);
057  }
058
059  @Override
060  public int hashCode() {
061    return Objects.hash(type, id);
062  }
063
064  @Override
065  public String toString() {
066    return "UserOrGroupReferenceV2025R0{"
067        + "type='"
068        + type
069        + '\''
070        + ", "
071        + "id='"
072        + id
073        + '\''
074        + "}";
075  }
076
077  public static class Builder extends NullableFieldTracker {
078
079    protected EnumWrapper<UserOrGroupReferenceV2025R0TypeField> type;
080
081    protected String id;
082
083    public Builder type(UserOrGroupReferenceV2025R0TypeField type) {
084      this.type = new EnumWrapper<UserOrGroupReferenceV2025R0TypeField>(type);
085      return this;
086    }
087
088    public Builder type(EnumWrapper<UserOrGroupReferenceV2025R0TypeField> type) {
089      this.type = type;
090      return this;
091    }
092
093    public Builder id(String id) {
094      this.id = id;
095      return this;
096    }
097
098    public UserOrGroupReferenceV2025R0 build() {
099      return new UserOrGroupReferenceV2025R0(this);
100    }
101  }
102}