001package com.box.sdkgen.schemas.v2025r0.archivev2025r0;
002
003import com.box.sdkgen.internal.Nullable;
004import com.box.sdkgen.internal.NullableFieldTracker;
005import com.box.sdkgen.internal.SerializableObject;
006import com.box.sdkgen.serialization.json.EnumWrapper;
007import com.fasterxml.jackson.annotation.JsonFilter;
008import com.fasterxml.jackson.annotation.JsonProperty;
009import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
010import com.fasterxml.jackson.databind.annotation.JsonSerialize;
011import java.util.Objects;
012
013/**
014 * An archive is a folder dedicated to storing content that is redundant, outdated, or trivial.
015 * Content in an archive is not accessible to its owner and collaborators. To use this feature, you
016 * must request GCM scope for your Box application.
017 */
018@JsonFilter("nullablePropertyFilter")
019public class ArchiveV2025R0 extends SerializableObject {
020
021  /** The unique identifier that represents an archive. */
022  protected final String id;
023
024  /** The value is always `archive`. */
025  @JsonDeserialize(using = ArchiveV2025R0TypeField.ArchiveV2025R0TypeFieldDeserializer.class)
026  @JsonSerialize(using = ArchiveV2025R0TypeField.ArchiveV2025R0TypeFieldSerializer.class)
027  protected EnumWrapper<ArchiveV2025R0TypeField> type;
028
029  /**
030   * The name of the archive.
031   *
032   * <p>The following restrictions to the archive name apply: names containing non-printable ASCII
033   * characters, forward and backward slashes (`/`, `\`), names with trailing spaces, and names `.`
034   * and `..` are not allowed.
035   */
036  protected final String name;
037
038  /** The size of the archive in bytes. */
039  protected final long size;
040
041  /** The description of the archive. */
042  @Nullable protected String description;
043
044  /** The part of an archive API response that describes the user who owns the archive. */
045  @JsonProperty("owned_by")
046  protected ArchiveV2025R0OwnedByField ownedBy;
047
048  public ArchiveV2025R0(
049      @JsonProperty("id") String id,
050      @JsonProperty("name") String name,
051      @JsonProperty("size") long size) {
052    super();
053    this.id = id;
054    this.name = name;
055    this.size = size;
056    this.type = new EnumWrapper<ArchiveV2025R0TypeField>(ArchiveV2025R0TypeField.ARCHIVE);
057  }
058
059  protected ArchiveV2025R0(Builder builder) {
060    super();
061    this.id = builder.id;
062    this.type = builder.type;
063    this.name = builder.name;
064    this.size = builder.size;
065    this.description = builder.description;
066    this.ownedBy = builder.ownedBy;
067    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
068  }
069
070  public String getId() {
071    return id;
072  }
073
074  public EnumWrapper<ArchiveV2025R0TypeField> getType() {
075    return type;
076  }
077
078  public String getName() {
079    return name;
080  }
081
082  public long getSize() {
083    return size;
084  }
085
086  public String getDescription() {
087    return description;
088  }
089
090  public ArchiveV2025R0OwnedByField getOwnedBy() {
091    return ownedBy;
092  }
093
094  @Override
095  public boolean equals(Object o) {
096    if (this == o) {
097      return true;
098    }
099    if (o == null || getClass() != o.getClass()) {
100      return false;
101    }
102    ArchiveV2025R0 casted = (ArchiveV2025R0) o;
103    return Objects.equals(id, casted.id)
104        && Objects.equals(type, casted.type)
105        && Objects.equals(name, casted.name)
106        && Objects.equals(size, casted.size)
107        && Objects.equals(description, casted.description)
108        && Objects.equals(ownedBy, casted.ownedBy);
109  }
110
111  @Override
112  public int hashCode() {
113    return Objects.hash(id, type, name, size, description, ownedBy);
114  }
115
116  @Override
117  public String toString() {
118    return "ArchiveV2025R0{"
119        + "id='"
120        + id
121        + '\''
122        + ", "
123        + "type='"
124        + type
125        + '\''
126        + ", "
127        + "name='"
128        + name
129        + '\''
130        + ", "
131        + "size='"
132        + size
133        + '\''
134        + ", "
135        + "description='"
136        + description
137        + '\''
138        + ", "
139        + "ownedBy='"
140        + ownedBy
141        + '\''
142        + "}";
143  }
144
145  public static class Builder extends NullableFieldTracker {
146
147    protected final String id;
148
149    protected EnumWrapper<ArchiveV2025R0TypeField> type;
150
151    protected final String name;
152
153    protected final long size;
154
155    protected String description;
156
157    protected ArchiveV2025R0OwnedByField ownedBy;
158
159    public Builder(String id, String name, long size) {
160      super();
161      this.id = id;
162      this.name = name;
163      this.size = size;
164    }
165
166    public Builder type(ArchiveV2025R0TypeField type) {
167      this.type = new EnumWrapper<ArchiveV2025R0TypeField>(type);
168      return this;
169    }
170
171    public Builder type(EnumWrapper<ArchiveV2025R0TypeField> type) {
172      this.type = type;
173      return this;
174    }
175
176    public Builder description(String description) {
177      this.description = description;
178      this.markNullableFieldAsSet("description");
179      return this;
180    }
181
182    public Builder ownedBy(ArchiveV2025R0OwnedByField ownedBy) {
183      this.ownedBy = ownedBy;
184      return this;
185    }
186
187    public ArchiveV2025R0 build() {
188      if (this.type == null) {
189        this.type = new EnumWrapper<ArchiveV2025R0TypeField>(ArchiveV2025R0TypeField.ARCHIVE);
190      }
191      return new ArchiveV2025R0(this);
192    }
193  }
194}