001package com.box.sdkgen.schemas.events;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.schemas.event.Event;
006import com.fasterxml.jackson.annotation.JsonFilter;
007import com.fasterxml.jackson.annotation.JsonProperty;
008import java.util.List;
009import java.util.Objects;
010
011/** A list of event objects. */
012@JsonFilter("nullablePropertyFilter")
013public class Events extends SerializableObject {
014
015  /** The number of events returned in this response. */
016  @JsonProperty("chunk_size")
017  protected Long chunkSize;
018
019  /** The stream position of the start of the next page (chunk) of events. */
020  @JsonProperty("next_stream_position")
021  protected EventsNextStreamPositionField nextStreamPosition;
022
023  /** A list of events. */
024  protected List<Event> entries;
025
026  public Events() {
027    super();
028  }
029
030  protected Events(Builder builder) {
031    super();
032    this.chunkSize = builder.chunkSize;
033    this.nextStreamPosition = builder.nextStreamPosition;
034    this.entries = builder.entries;
035    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
036  }
037
038  public Long getChunkSize() {
039    return chunkSize;
040  }
041
042  public EventsNextStreamPositionField getNextStreamPosition() {
043    return nextStreamPosition;
044  }
045
046  public List<Event> getEntries() {
047    return entries;
048  }
049
050  @Override
051  public boolean equals(Object o) {
052    if (this == o) {
053      return true;
054    }
055    if (o == null || getClass() != o.getClass()) {
056      return false;
057    }
058    Events casted = (Events) o;
059    return Objects.equals(chunkSize, casted.chunkSize)
060        && Objects.equals(nextStreamPosition, casted.nextStreamPosition)
061        && Objects.equals(entries, casted.entries);
062  }
063
064  @Override
065  public int hashCode() {
066    return Objects.hash(chunkSize, nextStreamPosition, entries);
067  }
068
069  @Override
070  public String toString() {
071    return "Events{"
072        + "chunkSize='"
073        + chunkSize
074        + '\''
075        + ", "
076        + "nextStreamPosition='"
077        + nextStreamPosition
078        + '\''
079        + ", "
080        + "entries='"
081        + entries
082        + '\''
083        + "}";
084  }
085
086  public static class Builder extends NullableFieldTracker {
087
088    protected Long chunkSize;
089
090    protected EventsNextStreamPositionField nextStreamPosition;
091
092    protected List<Event> entries;
093
094    public Builder chunkSize(Long chunkSize) {
095      this.chunkSize = chunkSize;
096      return this;
097    }
098
099    public Builder nextStreamPosition(String nextStreamPosition) {
100      this.nextStreamPosition = new EventsNextStreamPositionField(nextStreamPosition);
101      return this;
102    }
103
104    public Builder nextStreamPosition(long nextStreamPosition) {
105      this.nextStreamPosition = new EventsNextStreamPositionField(nextStreamPosition);
106      return this;
107    }
108
109    public Builder nextStreamPosition(EventsNextStreamPositionField nextStreamPosition) {
110      this.nextStreamPosition = nextStreamPosition;
111      return this;
112    }
113
114    public Builder entries(List<Event> entries) {
115      this.entries = entries;
116      return this;
117    }
118
119    public Events build() {
120      return new Events(this);
121    }
122  }
123}