001package com.box.sdkgen.managers.usercollaborations;
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.annotation.JsonProperty;
008import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
009import com.fasterxml.jackson.databind.annotation.JsonSerialize;
010import java.util.Objects;
011
012@JsonFilter("nullablePropertyFilter")
013public class CreateCollaborationRequestBodyAccessibleByField extends SerializableObject {
014
015  /** The type of collaborator to invite. */
016  @JsonDeserialize(
017      using =
018          CreateCollaborationRequestBodyAccessibleByTypeField
019              .CreateCollaborationRequestBodyAccessibleByTypeFieldDeserializer.class)
020  @JsonSerialize(
021      using =
022          CreateCollaborationRequestBodyAccessibleByTypeField
023              .CreateCollaborationRequestBodyAccessibleByTypeFieldSerializer.class)
024  protected final EnumWrapper<CreateCollaborationRequestBodyAccessibleByTypeField> type;
025
026  /**
027   * The ID of the user or group.
028   *
029   * <p>Alternatively, use `login` to specify a user by email address.
030   */
031  protected String id;
032
033  /**
034   * The email address of the user to grant access to the item.
035   *
036   * <p>Alternatively, use `id` to specify a user by user ID.
037   */
038  protected String login;
039
040  public CreateCollaborationRequestBodyAccessibleByField(
041      CreateCollaborationRequestBodyAccessibleByTypeField type) {
042    super();
043    this.type = new EnumWrapper<CreateCollaborationRequestBodyAccessibleByTypeField>(type);
044  }
045
046  public CreateCollaborationRequestBodyAccessibleByField(
047      @JsonProperty("type") EnumWrapper<CreateCollaborationRequestBodyAccessibleByTypeField> type) {
048    super();
049    this.type = type;
050  }
051
052  protected CreateCollaborationRequestBodyAccessibleByField(Builder builder) {
053    super();
054    this.type = builder.type;
055    this.id = builder.id;
056    this.login = builder.login;
057    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
058  }
059
060  public EnumWrapper<CreateCollaborationRequestBodyAccessibleByTypeField> getType() {
061    return type;
062  }
063
064  public String getId() {
065    return id;
066  }
067
068  public String getLogin() {
069    return login;
070  }
071
072  @Override
073  public boolean equals(Object o) {
074    if (this == o) {
075      return true;
076    }
077    if (o == null || getClass() != o.getClass()) {
078      return false;
079    }
080    CreateCollaborationRequestBodyAccessibleByField casted =
081        (CreateCollaborationRequestBodyAccessibleByField) o;
082    return Objects.equals(type, casted.type)
083        && Objects.equals(id, casted.id)
084        && Objects.equals(login, casted.login);
085  }
086
087  @Override
088  public int hashCode() {
089    return Objects.hash(type, id, login);
090  }
091
092  @Override
093  public String toString() {
094    return "CreateCollaborationRequestBodyAccessibleByField{"
095        + "type='"
096        + type
097        + '\''
098        + ", "
099        + "id='"
100        + id
101        + '\''
102        + ", "
103        + "login='"
104        + login
105        + '\''
106        + "}";
107  }
108
109  public static class Builder extends NullableFieldTracker {
110
111    protected final EnumWrapper<CreateCollaborationRequestBodyAccessibleByTypeField> type;
112
113    protected String id;
114
115    protected String login;
116
117    public Builder(CreateCollaborationRequestBodyAccessibleByTypeField type) {
118      super();
119      this.type = new EnumWrapper<CreateCollaborationRequestBodyAccessibleByTypeField>(type);
120    }
121
122    public Builder(EnumWrapper<CreateCollaborationRequestBodyAccessibleByTypeField> type) {
123      super();
124      this.type = type;
125    }
126
127    public Builder id(String id) {
128      this.id = id;
129      return this;
130    }
131
132    public Builder login(String login) {
133      this.login = login;
134      return this;
135    }
136
137    public CreateCollaborationRequestBodyAccessibleByField build() {
138      return new CreateCollaborationRequestBodyAccessibleByField(this);
139    }
140  }
141}