001package com.box.sdkgen.managers.uploads;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.internal.utils.DateTimeUtils;
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.time.OffsetDateTime;
011import java.util.Objects;
012
013@JsonFilter("nullablePropertyFilter")
014public class UploadFileVersionRequestBodyAttributesField extends SerializableObject {
015
016  /**
017   * An optional new name for the file. If specified, the file will be renamed when the new version
018   * is uploaded.
019   */
020  protected final String name;
021
022  /**
023   * Defines the time the file was last modified at.
024   *
025   * <p>If not set, the upload time will be used.
026   */
027  @JsonProperty("content_modified_at")
028  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
029  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
030  protected OffsetDateTime contentModifiedAt;
031
032  public UploadFileVersionRequestBodyAttributesField(@JsonProperty("name") String name) {
033    super();
034    this.name = name;
035  }
036
037  protected UploadFileVersionRequestBodyAttributesField(Builder builder) {
038    super();
039    this.name = builder.name;
040    this.contentModifiedAt = builder.contentModifiedAt;
041    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
042  }
043
044  public String getName() {
045    return name;
046  }
047
048  public OffsetDateTime getContentModifiedAt() {
049    return contentModifiedAt;
050  }
051
052  @Override
053  public boolean equals(Object o) {
054    if (this == o) {
055      return true;
056    }
057    if (o == null || getClass() != o.getClass()) {
058      return false;
059    }
060    UploadFileVersionRequestBodyAttributesField casted =
061        (UploadFileVersionRequestBodyAttributesField) o;
062    return Objects.equals(name, casted.name)
063        && Objects.equals(contentModifiedAt, casted.contentModifiedAt);
064  }
065
066  @Override
067  public int hashCode() {
068    return Objects.hash(name, contentModifiedAt);
069  }
070
071  @Override
072  public String toString() {
073    return "UploadFileVersionRequestBodyAttributesField{"
074        + "name='"
075        + name
076        + '\''
077        + ", "
078        + "contentModifiedAt='"
079        + contentModifiedAt
080        + '\''
081        + "}";
082  }
083
084  public static class Builder extends NullableFieldTracker {
085
086    protected final String name;
087
088    protected OffsetDateTime contentModifiedAt;
089
090    public Builder(String name) {
091      super();
092      this.name = name;
093    }
094
095    public Builder contentModifiedAt(OffsetDateTime contentModifiedAt) {
096      this.contentModifiedAt = contentModifiedAt;
097      return this;
098    }
099
100    public UploadFileVersionRequestBodyAttributesField build() {
101      return new UploadFileVersionRequestBodyAttributesField(this);
102    }
103  }
104}