001package com.box.sdkgen.schemas.zipdownloadstatus;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.serialization.json.EnumWrapper;
006import com.fasterxml.jackson.annotation.JsonFilter;
007import com.fasterxml.jackson.annotation.JsonProperty;
008import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
009import com.fasterxml.jackson.databind.annotation.JsonSerialize;
010import java.util.Objects;
011
012/** The status of a `zip` archive being downloaded. */
013@JsonFilter("nullablePropertyFilter")
014public class ZipDownloadStatus extends SerializableObject {
015
016  /** The total number of files in the archive. */
017  @JsonProperty("total_file_count")
018  protected Long totalFileCount;
019
020  /** The number of files that have already been downloaded. */
021  @JsonProperty("downloaded_file_count")
022  protected Long downloadedFileCount;
023
024  /**
025   * The number of files that have been skipped as they could not be downloaded. In many cases this
026   * is due to permission issues that have surfaced between the creation of the request for the
027   * archive and the archive being downloaded.
028   */
029  @JsonProperty("skipped_file_count")
030  protected Long skippedFileCount;
031
032  /**
033   * The number of folders that have been skipped as they could not be downloaded. In many cases
034   * this is due to permission issues that have surfaced between the creation of the request for the
035   * archive and the archive being downloaded.
036   */
037  @JsonProperty("skipped_folder_count")
038  protected Long skippedFolderCount;
039
040  /** The state of the archive being downloaded. */
041  @JsonDeserialize(
042      using = ZipDownloadStatusStateField.ZipDownloadStatusStateFieldDeserializer.class)
043  @JsonSerialize(using = ZipDownloadStatusStateField.ZipDownloadStatusStateFieldSerializer.class)
044  protected EnumWrapper<ZipDownloadStatusStateField> state;
045
046  public ZipDownloadStatus() {
047    super();
048  }
049
050  protected ZipDownloadStatus(Builder builder) {
051    super();
052    this.totalFileCount = builder.totalFileCount;
053    this.downloadedFileCount = builder.downloadedFileCount;
054    this.skippedFileCount = builder.skippedFileCount;
055    this.skippedFolderCount = builder.skippedFolderCount;
056    this.state = builder.state;
057    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
058  }
059
060  public Long getTotalFileCount() {
061    return totalFileCount;
062  }
063
064  public Long getDownloadedFileCount() {
065    return downloadedFileCount;
066  }
067
068  public Long getSkippedFileCount() {
069    return skippedFileCount;
070  }
071
072  public Long getSkippedFolderCount() {
073    return skippedFolderCount;
074  }
075
076  public EnumWrapper<ZipDownloadStatusStateField> getState() {
077    return state;
078  }
079
080  @Override
081  public boolean equals(Object o) {
082    if (this == o) {
083      return true;
084    }
085    if (o == null || getClass() != o.getClass()) {
086      return false;
087    }
088    ZipDownloadStatus casted = (ZipDownloadStatus) o;
089    return Objects.equals(totalFileCount, casted.totalFileCount)
090        && Objects.equals(downloadedFileCount, casted.downloadedFileCount)
091        && Objects.equals(skippedFileCount, casted.skippedFileCount)
092        && Objects.equals(skippedFolderCount, casted.skippedFolderCount)
093        && Objects.equals(state, casted.state);
094  }
095
096  @Override
097  public int hashCode() {
098    return Objects.hash(
099        totalFileCount, downloadedFileCount, skippedFileCount, skippedFolderCount, state);
100  }
101
102  @Override
103  public String toString() {
104    return "ZipDownloadStatus{"
105        + "totalFileCount='"
106        + totalFileCount
107        + '\''
108        + ", "
109        + "downloadedFileCount='"
110        + downloadedFileCount
111        + '\''
112        + ", "
113        + "skippedFileCount='"
114        + skippedFileCount
115        + '\''
116        + ", "
117        + "skippedFolderCount='"
118        + skippedFolderCount
119        + '\''
120        + ", "
121        + "state='"
122        + state
123        + '\''
124        + "}";
125  }
126
127  public static class Builder extends NullableFieldTracker {
128
129    protected Long totalFileCount;
130
131    protected Long downloadedFileCount;
132
133    protected Long skippedFileCount;
134
135    protected Long skippedFolderCount;
136
137    protected EnumWrapper<ZipDownloadStatusStateField> state;
138
139    public Builder totalFileCount(Long totalFileCount) {
140      this.totalFileCount = totalFileCount;
141      return this;
142    }
143
144    public Builder downloadedFileCount(Long downloadedFileCount) {
145      this.downloadedFileCount = downloadedFileCount;
146      return this;
147    }
148
149    public Builder skippedFileCount(Long skippedFileCount) {
150      this.skippedFileCount = skippedFileCount;
151      return this;
152    }
153
154    public Builder skippedFolderCount(Long skippedFolderCount) {
155      this.skippedFolderCount = skippedFolderCount;
156      return this;
157    }
158
159    public Builder state(ZipDownloadStatusStateField state) {
160      this.state = new EnumWrapper<ZipDownloadStatusStateField>(state);
161      return this;
162    }
163
164    public Builder state(EnumWrapper<ZipDownloadStatusStateField> state) {
165      this.state = state;
166      return this;
167    }
168
169    public ZipDownloadStatus build() {
170      return new ZipDownloadStatus(this);
171    }
172  }
173}