001package com.box.sdkgen.schemas.shieldinformationbarriersegmentrestriction;
002
003import com.box.sdkgen.internal.utils.DateTimeUtils;
004import com.box.sdkgen.schemas.shieldinformationbarrierbase.ShieldInformationBarrierBase;
005import com.box.sdkgen.schemas.shieldinformationbarriersegmentrestrictionbase.ShieldInformationBarrierSegmentRestrictionBaseTypeField;
006import com.box.sdkgen.schemas.shieldinformationbarriersegmentrestrictionmini.ShieldInformationBarrierSegmentRestrictionMini;
007import com.box.sdkgen.schemas.shieldinformationbarriersegmentrestrictionmini.ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField;
008import com.box.sdkgen.schemas.shieldinformationbarriersegmentrestrictionmini.ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField;
009import com.box.sdkgen.schemas.userbase.UserBase;
010import com.box.sdkgen.serialization.json.EnumWrapper;
011import com.fasterxml.jackson.annotation.JsonFilter;
012import com.fasterxml.jackson.annotation.JsonProperty;
013import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
014import com.fasterxml.jackson.databind.annotation.JsonSerialize;
015import java.time.OffsetDateTime;
016import java.util.Objects;
017
018/** A standard representation of a segment restriction of a shield information barrier object. */
019@JsonFilter("nullablePropertyFilter")
020public class ShieldInformationBarrierSegmentRestriction
021    extends ShieldInformationBarrierSegmentRestrictionMini {
022
023  @JsonProperty("shield_information_barrier")
024  protected ShieldInformationBarrierBase shieldInformationBarrier;
025
026  /**
027   * ISO date time string when this shield information barrier Segment Restriction object was
028   * created.
029   */
030  @JsonProperty("created_at")
031  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
032  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
033  protected OffsetDateTime createdAt;
034
035  @JsonProperty("created_by")
036  protected UserBase createdBy;
037
038  /** ISO date time string when this shield information barrier segment Restriction was updated. */
039  @JsonProperty("updated_at")
040  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
041  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
042  protected OffsetDateTime updatedAt;
043
044  @JsonProperty("updated_by")
045  protected UserBase updatedBy;
046
047  public ShieldInformationBarrierSegmentRestriction(
048      @JsonProperty("shield_information_barrier_segment")
049          ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField
050              shieldInformationBarrierSegment,
051      @JsonProperty("restricted_segment")
052          ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField restrictedSegment) {
053    super(shieldInformationBarrierSegment, restrictedSegment);
054  }
055
056  protected ShieldInformationBarrierSegmentRestriction(Builder builder) {
057    super(builder);
058    this.shieldInformationBarrier = builder.shieldInformationBarrier;
059    this.createdAt = builder.createdAt;
060    this.createdBy = builder.createdBy;
061    this.updatedAt = builder.updatedAt;
062    this.updatedBy = builder.updatedBy;
063    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
064  }
065
066  public ShieldInformationBarrierBase getShieldInformationBarrier() {
067    return shieldInformationBarrier;
068  }
069
070  public OffsetDateTime getCreatedAt() {
071    return createdAt;
072  }
073
074  public UserBase getCreatedBy() {
075    return createdBy;
076  }
077
078  public OffsetDateTime getUpdatedAt() {
079    return updatedAt;
080  }
081
082  public UserBase getUpdatedBy() {
083    return updatedBy;
084  }
085
086  @Override
087  public boolean equals(Object o) {
088    if (this == o) {
089      return true;
090    }
091    if (o == null || getClass() != o.getClass()) {
092      return false;
093    }
094    ShieldInformationBarrierSegmentRestriction casted =
095        (ShieldInformationBarrierSegmentRestriction) o;
096    return Objects.equals(type, casted.type)
097        && Objects.equals(id, casted.id)
098        && Objects.equals(shieldInformationBarrierSegment, casted.shieldInformationBarrierSegment)
099        && Objects.equals(restrictedSegment, casted.restrictedSegment)
100        && Objects.equals(shieldInformationBarrier, casted.shieldInformationBarrier)
101        && Objects.equals(createdAt, casted.createdAt)
102        && Objects.equals(createdBy, casted.createdBy)
103        && Objects.equals(updatedAt, casted.updatedAt)
104        && Objects.equals(updatedBy, casted.updatedBy);
105  }
106
107  @Override
108  public int hashCode() {
109    return Objects.hash(
110        type,
111        id,
112        shieldInformationBarrierSegment,
113        restrictedSegment,
114        shieldInformationBarrier,
115        createdAt,
116        createdBy,
117        updatedAt,
118        updatedBy);
119  }
120
121  @Override
122  public String toString() {
123    return "ShieldInformationBarrierSegmentRestriction{"
124        + "type='"
125        + type
126        + '\''
127        + ", "
128        + "id='"
129        + id
130        + '\''
131        + ", "
132        + "shieldInformationBarrierSegment='"
133        + shieldInformationBarrierSegment
134        + '\''
135        + ", "
136        + "restrictedSegment='"
137        + restrictedSegment
138        + '\''
139        + ", "
140        + "shieldInformationBarrier='"
141        + shieldInformationBarrier
142        + '\''
143        + ", "
144        + "createdAt='"
145        + createdAt
146        + '\''
147        + ", "
148        + "createdBy='"
149        + createdBy
150        + '\''
151        + ", "
152        + "updatedAt='"
153        + updatedAt
154        + '\''
155        + ", "
156        + "updatedBy='"
157        + updatedBy
158        + '\''
159        + "}";
160  }
161
162  public static class Builder extends ShieldInformationBarrierSegmentRestrictionMini.Builder {
163
164    protected ShieldInformationBarrierBase shieldInformationBarrier;
165
166    protected OffsetDateTime createdAt;
167
168    protected UserBase createdBy;
169
170    protected OffsetDateTime updatedAt;
171
172    protected UserBase updatedBy;
173
174    public Builder(
175        ShieldInformationBarrierSegmentRestrictionMiniShieldInformationBarrierSegmentField
176            shieldInformationBarrierSegment,
177        ShieldInformationBarrierSegmentRestrictionMiniRestrictedSegmentField restrictedSegment) {
178      super(shieldInformationBarrierSegment, restrictedSegment);
179    }
180
181    public Builder shieldInformationBarrier(ShieldInformationBarrierBase shieldInformationBarrier) {
182      this.shieldInformationBarrier = shieldInformationBarrier;
183      return this;
184    }
185
186    public Builder createdAt(OffsetDateTime createdAt) {
187      this.createdAt = createdAt;
188      return this;
189    }
190
191    public Builder createdBy(UserBase createdBy) {
192      this.createdBy = createdBy;
193      return this;
194    }
195
196    public Builder updatedAt(OffsetDateTime updatedAt) {
197      this.updatedAt = updatedAt;
198      return this;
199    }
200
201    public Builder updatedBy(UserBase updatedBy) {
202      this.updatedBy = updatedBy;
203      return this;
204    }
205
206    @Override
207    public Builder type(ShieldInformationBarrierSegmentRestrictionBaseTypeField type) {
208      this.type = new EnumWrapper<ShieldInformationBarrierSegmentRestrictionBaseTypeField>(type);
209      return this;
210    }
211
212    @Override
213    public Builder type(EnumWrapper<ShieldInformationBarrierSegmentRestrictionBaseTypeField> type) {
214      this.type = type;
215      return this;
216    }
217
218    @Override
219    public Builder id(String id) {
220      this.id = id;
221      return this;
222    }
223
224    public ShieldInformationBarrierSegmentRestriction build() {
225      return new ShieldInformationBarrierSegmentRestriction(this);
226    }
227  }
228}