001package com.box.sdkgen.schemas.fileversionbase;
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/**
013 * The bare basic representation of a file version, the minimal amount of fields returned when using
014 * the `fields` query parameter.
015 */
016@JsonFilter("nullablePropertyFilter")
017public class FileVersionBase extends SerializableObject {
018
019  /** The unique identifier that represent a file version. */
020  protected final String id;
021
022  /** The value will always be `file_version`. */
023  @JsonDeserialize(using = FileVersionBaseTypeField.FileVersionBaseTypeFieldDeserializer.class)
024  @JsonSerialize(using = FileVersionBaseTypeField.FileVersionBaseTypeFieldSerializer.class)
025  protected EnumWrapper<FileVersionBaseTypeField> type;
026
027  public FileVersionBase(@JsonProperty("id") String id) {
028    super();
029    this.id = id;
030    this.type = new EnumWrapper<FileVersionBaseTypeField>(FileVersionBaseTypeField.FILE_VERSION);
031  }
032
033  protected FileVersionBase(Builder builder) {
034    super();
035    this.id = builder.id;
036    this.type = builder.type;
037    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
038  }
039
040  public String getId() {
041    return id;
042  }
043
044  public EnumWrapper<FileVersionBaseTypeField> getType() {
045    return type;
046  }
047
048  @Override
049  public boolean equals(Object o) {
050    if (this == o) {
051      return true;
052    }
053    if (o == null || getClass() != o.getClass()) {
054      return false;
055    }
056    FileVersionBase casted = (FileVersionBase) o;
057    return Objects.equals(id, casted.id) && Objects.equals(type, casted.type);
058  }
059
060  @Override
061  public int hashCode() {
062    return Objects.hash(id, type);
063  }
064
065  @Override
066  public String toString() {
067    return "FileVersionBase{" + "id='" + id + '\'' + ", " + "type='" + type + '\'' + "}";
068  }
069
070  public static class Builder extends NullableFieldTracker {
071
072    protected final String id;
073
074    protected EnumWrapper<FileVersionBaseTypeField> type;
075
076    public Builder(String id) {
077      super();
078      this.id = id;
079    }
080
081    public Builder type(FileVersionBaseTypeField type) {
082      this.type = new EnumWrapper<FileVersionBaseTypeField>(type);
083      return this;
084    }
085
086    public Builder type(EnumWrapper<FileVersionBaseTypeField> type) {
087      this.type = type;
088      return this;
089    }
090
091    public FileVersionBase build() {
092      if (this.type == null) {
093        this.type =
094            new EnumWrapper<FileVersionBaseTypeField>(FileVersionBaseTypeField.FILE_VERSION);
095      }
096      return new FileVersionBase(this);
097    }
098  }
099}