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 UploadFileRequestBodyAttributesField extends SerializableObject {
015
016  /**
017   * The name of the file.
018   *
019   * <p>File names must be unique within their parent folder. The name check is case-insensitive, so
020   * a file named `New File` cannot be created in a parent folder that already contains a folder
021   * named `new file`.
022   */
023  protected final String name;
024
025  /** The parent folder to upload the file to. */
026  protected final UploadFileRequestBodyAttributesParentField parent;
027
028  /**
029   * Defines the time the file was originally created at.
030   *
031   * <p>If not set, the upload time will be used.
032   */
033  @JsonProperty("content_created_at")
034  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
035  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
036  protected OffsetDateTime contentCreatedAt;
037
038  /**
039   * Defines the time the file was last modified at.
040   *
041   * <p>If not set, the upload time will be used.
042   */
043  @JsonProperty("content_modified_at")
044  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
045  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
046  protected OffsetDateTime contentModifiedAt;
047
048  public UploadFileRequestBodyAttributesField(
049      @JsonProperty("name") String name,
050      @JsonProperty("parent") UploadFileRequestBodyAttributesParentField parent) {
051    super();
052    this.name = name;
053    this.parent = parent;
054  }
055
056  protected UploadFileRequestBodyAttributesField(Builder builder) {
057    super();
058    this.name = builder.name;
059    this.parent = builder.parent;
060    this.contentCreatedAt = builder.contentCreatedAt;
061    this.contentModifiedAt = builder.contentModifiedAt;
062    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
063  }
064
065  public String getName() {
066    return name;
067  }
068
069  public UploadFileRequestBodyAttributesParentField getParent() {
070    return parent;
071  }
072
073  public OffsetDateTime getContentCreatedAt() {
074    return contentCreatedAt;
075  }
076
077  public OffsetDateTime getContentModifiedAt() {
078    return contentModifiedAt;
079  }
080
081  @Override
082  public boolean equals(Object o) {
083    if (this == o) {
084      return true;
085    }
086    if (o == null || getClass() != o.getClass()) {
087      return false;
088    }
089    UploadFileRequestBodyAttributesField casted = (UploadFileRequestBodyAttributesField) o;
090    return Objects.equals(name, casted.name)
091        && Objects.equals(parent, casted.parent)
092        && Objects.equals(contentCreatedAt, casted.contentCreatedAt)
093        && Objects.equals(contentModifiedAt, casted.contentModifiedAt);
094  }
095
096  @Override
097  public int hashCode() {
098    return Objects.hash(name, parent, contentCreatedAt, contentModifiedAt);
099  }
100
101  @Override
102  public String toString() {
103    return "UploadFileRequestBodyAttributesField{"
104        + "name='"
105        + name
106        + '\''
107        + ", "
108        + "parent='"
109        + parent
110        + '\''
111        + ", "
112        + "contentCreatedAt='"
113        + contentCreatedAt
114        + '\''
115        + ", "
116        + "contentModifiedAt='"
117        + contentModifiedAt
118        + '\''
119        + "}";
120  }
121
122  public static class Builder extends NullableFieldTracker {
123
124    protected final String name;
125
126    protected final UploadFileRequestBodyAttributesParentField parent;
127
128    protected OffsetDateTime contentCreatedAt;
129
130    protected OffsetDateTime contentModifiedAt;
131
132    public Builder(String name, UploadFileRequestBodyAttributesParentField parent) {
133      super();
134      this.name = name;
135      this.parent = parent;
136    }
137
138    public Builder contentCreatedAt(OffsetDateTime contentCreatedAt) {
139      this.contentCreatedAt = contentCreatedAt;
140      return this;
141    }
142
143    public Builder contentModifiedAt(OffsetDateTime contentModifiedAt) {
144      this.contentModifiedAt = contentModifiedAt;
145      return this;
146    }
147
148    public UploadFileRequestBodyAttributesField build() {
149      return new UploadFileRequestBodyAttributesField(this);
150    }
151  }
152}