001package com.box.sdkgen.schemas.v2025r0.hubdocumentblocksv2025r0;
002
003import com.box.sdkgen.internal.Nullable;
004import com.box.sdkgen.internal.NullableFieldTracker;
005import com.box.sdkgen.internal.SerializableObject;
006import com.box.sdkgen.schemas.v2025r0.hubdocumentblockentryv2025r0.HubDocumentBlockEntryV2025R0;
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.List;
013import java.util.Objects;
014
015/** A list of Hub Document blocks. */
016@JsonFilter("nullablePropertyFilter")
017public class HubDocumentBlocksV2025R0 extends SerializableObject {
018
019  /** Ordered list of blocks. */
020  protected final List<HubDocumentBlockEntryV2025R0> entries;
021
022  /** The value will always be `document_blocks`. */
023  @JsonDeserialize(
024      using = HubDocumentBlocksV2025R0TypeField.HubDocumentBlocksV2025R0TypeFieldDeserializer.class)
025  @JsonSerialize(
026      using = HubDocumentBlocksV2025R0TypeField.HubDocumentBlocksV2025R0TypeFieldSerializer.class)
027  protected EnumWrapper<HubDocumentBlocksV2025R0TypeField> type;
028
029  /**
030   * The limit that was used for these entries. This will be the same as the `limit` query parameter
031   * unless that value exceeded the maximum value allowed. The maximum value varies by API.
032   */
033  protected Long limit;
034
035  /** The marker for the start of the next page of results. */
036  @JsonProperty("next_marker")
037  @Nullable
038  protected String nextMarker;
039
040  public HubDocumentBlocksV2025R0(
041      @JsonProperty("entries") List<HubDocumentBlockEntryV2025R0> entries) {
042    super();
043    this.entries = entries;
044    this.type =
045        new EnumWrapper<HubDocumentBlocksV2025R0TypeField>(
046            HubDocumentBlocksV2025R0TypeField.DOCUMENT_BLOCKS);
047  }
048
049  protected HubDocumentBlocksV2025R0(Builder builder) {
050    super();
051    this.entries = builder.entries;
052    this.type = builder.type;
053    this.limit = builder.limit;
054    this.nextMarker = builder.nextMarker;
055    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
056  }
057
058  public List<HubDocumentBlockEntryV2025R0> getEntries() {
059    return entries;
060  }
061
062  public EnumWrapper<HubDocumentBlocksV2025R0TypeField> getType() {
063    return type;
064  }
065
066  public Long getLimit() {
067    return limit;
068  }
069
070  public String getNextMarker() {
071    return nextMarker;
072  }
073
074  @Override
075  public boolean equals(Object o) {
076    if (this == o) {
077      return true;
078    }
079    if (o == null || getClass() != o.getClass()) {
080      return false;
081    }
082    HubDocumentBlocksV2025R0 casted = (HubDocumentBlocksV2025R0) o;
083    return Objects.equals(entries, casted.entries)
084        && Objects.equals(type, casted.type)
085        && Objects.equals(limit, casted.limit)
086        && Objects.equals(nextMarker, casted.nextMarker);
087  }
088
089  @Override
090  public int hashCode() {
091    return Objects.hash(entries, type, limit, nextMarker);
092  }
093
094  @Override
095  public String toString() {
096    return "HubDocumentBlocksV2025R0{"
097        + "entries='"
098        + entries
099        + '\''
100        + ", "
101        + "type='"
102        + type
103        + '\''
104        + ", "
105        + "limit='"
106        + limit
107        + '\''
108        + ", "
109        + "nextMarker='"
110        + nextMarker
111        + '\''
112        + "}";
113  }
114
115  public static class Builder extends NullableFieldTracker {
116
117    protected final List<HubDocumentBlockEntryV2025R0> entries;
118
119    protected EnumWrapper<HubDocumentBlocksV2025R0TypeField> type;
120
121    protected Long limit;
122
123    protected String nextMarker;
124
125    public Builder(List<HubDocumentBlockEntryV2025R0> entries) {
126      super();
127      this.entries = entries;
128    }
129
130    public Builder type(HubDocumentBlocksV2025R0TypeField type) {
131      this.type = new EnumWrapper<HubDocumentBlocksV2025R0TypeField>(type);
132      return this;
133    }
134
135    public Builder type(EnumWrapper<HubDocumentBlocksV2025R0TypeField> type) {
136      this.type = type;
137      return this;
138    }
139
140    public Builder limit(Long limit) {
141      this.limit = limit;
142      return this;
143    }
144
145    public Builder nextMarker(String nextMarker) {
146      this.nextMarker = nextMarker;
147      this.markNullableFieldAsSet("next_marker");
148      return this;
149    }
150
151    public HubDocumentBlocksV2025R0 build() {
152      if (this.type == null) {
153        this.type =
154            new EnumWrapper<HubDocumentBlocksV2025R0TypeField>(
155                HubDocumentBlocksV2025R0TypeField.DOCUMENT_BLOCKS);
156      }
157      return new HubDocumentBlocksV2025R0(this);
158    }
159  }
160}