001package com.box.sdkgen.managers.shieldinformationbarriersegmentmembers;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.schemas.shieldinformationbarrierbase.ShieldInformationBarrierBase;
006import com.box.sdkgen.schemas.userbase.UserBase;
007import com.box.sdkgen.serialization.json.EnumWrapper;
008import com.fasterxml.jackson.annotation.JsonFilter;
009import com.fasterxml.jackson.annotation.JsonProperty;
010import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
011import com.fasterxml.jackson.databind.annotation.JsonSerialize;
012import java.util.Objects;
013
014@JsonFilter("nullablePropertyFilter")
015public class CreateShieldInformationBarrierSegmentMemberRequestBody extends SerializableObject {
016
017  /** A type of the shield barrier segment member. */
018  @JsonDeserialize(
019      using =
020          CreateShieldInformationBarrierSegmentMemberRequestBodyTypeField
021              .CreateShieldInformationBarrierSegmentMemberRequestBodyTypeFieldDeserializer.class)
022  @JsonSerialize(
023      using =
024          CreateShieldInformationBarrierSegmentMemberRequestBodyTypeField
025              .CreateShieldInformationBarrierSegmentMemberRequestBodyTypeFieldSerializer.class)
026  protected EnumWrapper<CreateShieldInformationBarrierSegmentMemberRequestBodyTypeField> type;
027
028  @JsonProperty("shield_information_barrier")
029  protected ShieldInformationBarrierBase shieldInformationBarrier;
030
031  /** The `type` and `id` of the requested shield information barrier segment. */
032  @JsonProperty("shield_information_barrier_segment")
033  protected final
034  CreateShieldInformationBarrierSegmentMemberRequestBodyShieldInformationBarrierSegmentField
035      shieldInformationBarrierSegment;
036
037  /** User to which restriction will be applied. */
038  protected final UserBase user;
039
040  public CreateShieldInformationBarrierSegmentMemberRequestBody(
041      @JsonProperty("shield_information_barrier_segment")
042          CreateShieldInformationBarrierSegmentMemberRequestBodyShieldInformationBarrierSegmentField
043              shieldInformationBarrierSegment,
044      @JsonProperty("user") UserBase user) {
045    super();
046    this.shieldInformationBarrierSegment = shieldInformationBarrierSegment;
047    this.user = user;
048  }
049
050  protected CreateShieldInformationBarrierSegmentMemberRequestBody(Builder builder) {
051    super();
052    this.type = builder.type;
053    this.shieldInformationBarrier = builder.shieldInformationBarrier;
054    this.shieldInformationBarrierSegment = builder.shieldInformationBarrierSegment;
055    this.user = builder.user;
056    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
057  }
058
059  public EnumWrapper<CreateShieldInformationBarrierSegmentMemberRequestBodyTypeField> getType() {
060    return type;
061  }
062
063  public ShieldInformationBarrierBase getShieldInformationBarrier() {
064    return shieldInformationBarrier;
065  }
066
067  public CreateShieldInformationBarrierSegmentMemberRequestBodyShieldInformationBarrierSegmentField
068      getShieldInformationBarrierSegment() {
069    return shieldInformationBarrierSegment;
070  }
071
072  public UserBase getUser() {
073    return user;
074  }
075
076  @Override
077  public boolean equals(Object o) {
078    if (this == o) {
079      return true;
080    }
081    if (o == null || getClass() != o.getClass()) {
082      return false;
083    }
084    CreateShieldInformationBarrierSegmentMemberRequestBody casted =
085        (CreateShieldInformationBarrierSegmentMemberRequestBody) o;
086    return Objects.equals(type, casted.type)
087        && Objects.equals(shieldInformationBarrier, casted.shieldInformationBarrier)
088        && Objects.equals(shieldInformationBarrierSegment, casted.shieldInformationBarrierSegment)
089        && Objects.equals(user, casted.user);
090  }
091
092  @Override
093  public int hashCode() {
094    return Objects.hash(type, shieldInformationBarrier, shieldInformationBarrierSegment, user);
095  }
096
097  @Override
098  public String toString() {
099    return "CreateShieldInformationBarrierSegmentMemberRequestBody{"
100        + "type='"
101        + type
102        + '\''
103        + ", "
104        + "shieldInformationBarrier='"
105        + shieldInformationBarrier
106        + '\''
107        + ", "
108        + "shieldInformationBarrierSegment='"
109        + shieldInformationBarrierSegment
110        + '\''
111        + ", "
112        + "user='"
113        + user
114        + '\''
115        + "}";
116  }
117
118  public static class Builder extends NullableFieldTracker {
119
120    protected EnumWrapper<CreateShieldInformationBarrierSegmentMemberRequestBodyTypeField> type;
121
122    protected ShieldInformationBarrierBase shieldInformationBarrier;
123
124    protected final
125    CreateShieldInformationBarrierSegmentMemberRequestBodyShieldInformationBarrierSegmentField
126        shieldInformationBarrierSegment;
127
128    protected final UserBase user;
129
130    public Builder(
131        CreateShieldInformationBarrierSegmentMemberRequestBodyShieldInformationBarrierSegmentField
132            shieldInformationBarrierSegment,
133        UserBase user) {
134      super();
135      this.shieldInformationBarrierSegment = shieldInformationBarrierSegment;
136      this.user = user;
137    }
138
139    public Builder type(CreateShieldInformationBarrierSegmentMemberRequestBodyTypeField type) {
140      this.type =
141          new EnumWrapper<CreateShieldInformationBarrierSegmentMemberRequestBodyTypeField>(type);
142      return this;
143    }
144
145    public Builder type(
146        EnumWrapper<CreateShieldInformationBarrierSegmentMemberRequestBodyTypeField> type) {
147      this.type = type;
148      return this;
149    }
150
151    public Builder shieldInformationBarrier(ShieldInformationBarrierBase shieldInformationBarrier) {
152      this.shieldInformationBarrier = shieldInformationBarrier;
153      return this;
154    }
155
156    public CreateShieldInformationBarrierSegmentMemberRequestBody build() {
157      return new CreateShieldInformationBarrierSegmentMemberRequestBody(this);
158    }
159  }
160}