001package com.box.sdkgen.schemas.foldermini;
002
003import com.box.sdkgen.schemas.folderbase.FolderBase;
004import com.box.sdkgen.schemas.folderbase.FolderBaseTypeField;
005import com.box.sdkgen.serialization.json.EnumWrapper;
006import com.fasterxml.jackson.annotation.JsonFilter;
007import com.fasterxml.jackson.annotation.JsonProperty;
008import java.util.Objects;
009
010/** A mini representation of a file version, used when nested under another resource. */
011@JsonFilter("nullablePropertyFilter")
012public class FolderMini extends FolderBase {
013
014  @JsonProperty("sequence_id")
015  protected String sequenceId;
016
017  /** The name of the folder. */
018  protected String name;
019
020  public FolderMini(@JsonProperty("id") String id) {
021    super(id);
022  }
023
024  protected FolderMini(Builder builder) {
025    super(builder);
026    this.sequenceId = builder.sequenceId;
027    this.name = builder.name;
028    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
029  }
030
031  public String getSequenceId() {
032    return sequenceId;
033  }
034
035  public String getName() {
036    return name;
037  }
038
039  @Override
040  public boolean equals(Object o) {
041    if (this == o) {
042      return true;
043    }
044    if (o == null || getClass() != o.getClass()) {
045      return false;
046    }
047    FolderMini casted = (FolderMini) o;
048    return Objects.equals(id, casted.id)
049        && Objects.equals(etag, casted.etag)
050        && Objects.equals(type, casted.type)
051        && Objects.equals(sequenceId, casted.sequenceId)
052        && Objects.equals(name, casted.name);
053  }
054
055  @Override
056  public int hashCode() {
057    return Objects.hash(id, etag, type, sequenceId, name);
058  }
059
060  @Override
061  public String toString() {
062    return "FolderMini{"
063        + "id='"
064        + id
065        + '\''
066        + ", "
067        + "etag='"
068        + etag
069        + '\''
070        + ", "
071        + "type='"
072        + type
073        + '\''
074        + ", "
075        + "sequenceId='"
076        + sequenceId
077        + '\''
078        + ", "
079        + "name='"
080        + name
081        + '\''
082        + "}";
083  }
084
085  public static class Builder extends FolderBase.Builder {
086
087    protected String sequenceId;
088
089    protected String name;
090
091    public Builder(String id) {
092      super(id);
093    }
094
095    public Builder sequenceId(String sequenceId) {
096      this.sequenceId = sequenceId;
097      return this;
098    }
099
100    public Builder name(String name) {
101      this.name = name;
102      return this;
103    }
104
105    @Override
106    public Builder etag(String etag) {
107      this.etag = etag;
108      this.markNullableFieldAsSet("etag");
109      return this;
110    }
111
112    @Override
113    public Builder type(FolderBaseTypeField type) {
114      this.type = new EnumWrapper<FolderBaseTypeField>(type);
115      return this;
116    }
117
118    @Override
119    public Builder type(EnumWrapper<FolderBaseTypeField> type) {
120      this.type = type;
121      return this;
122    }
123
124    public FolderMini build() {
125      if (this.type == null) {
126        this.type = new EnumWrapper<FolderBaseTypeField>(FolderBaseTypeField.FOLDER);
127      }
128      return new FolderMini(this);
129    }
130  }
131}