001package com.box.sdkgen.managers.foldermetadata;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.schemas.metadatainstancevalue.MetadataInstanceValue;
006import com.box.sdkgen.serialization.json.EnumWrapper;
007import com.fasterxml.jackson.annotation.JsonFilter;
008import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
009import com.fasterxml.jackson.databind.annotation.JsonSerialize;
010import java.util.List;
011import java.util.Objects;
012
013@JsonFilter("nullablePropertyFilter")
014public class UpdateFolderMetadataByIdRequestBody extends SerializableObject {
015
016  /**
017   * The type of change to perform on the template. Some of these are hazardous as they will change
018   * existing templates.
019   */
020  @JsonDeserialize(
021      using =
022          UpdateFolderMetadataByIdRequestBodyOpField
023              .UpdateFolderMetadataByIdRequestBodyOpFieldDeserializer.class)
024  @JsonSerialize(
025      using =
026          UpdateFolderMetadataByIdRequestBodyOpField
027              .UpdateFolderMetadataByIdRequestBodyOpFieldSerializer.class)
028  protected EnumWrapper<UpdateFolderMetadataByIdRequestBodyOpField> op;
029
030  /**
031   * The location in the metadata JSON object to apply the changes to, in the format of a
032   * [JSON-Pointer](https://tools.ietf.org/html/rfc6901).
033   *
034   * <p>The path must always be prefixed with a `/` to represent the root of the template. The
035   * characters `~` and `/` are reserved characters and must be escaped in the key.
036   */
037  protected String path;
038
039  protected MetadataInstanceValue value;
040
041  /**
042   * The location in the metadata JSON object to move or copy a value from. Required for `move` or
043   * `copy` operations and must be in the format of a
044   * [JSON-Pointer](https://tools.ietf.org/html/rfc6901).
045   */
046  protected String from;
047
048  public UpdateFolderMetadataByIdRequestBody() {
049    super();
050  }
051
052  protected UpdateFolderMetadataByIdRequestBody(Builder builder) {
053    super();
054    this.op = builder.op;
055    this.path = builder.path;
056    this.value = builder.value;
057    this.from = builder.from;
058    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
059  }
060
061  public EnumWrapper<UpdateFolderMetadataByIdRequestBodyOpField> getOp() {
062    return op;
063  }
064
065  public String getPath() {
066    return path;
067  }
068
069  public MetadataInstanceValue getValue() {
070    return value;
071  }
072
073  public String getFrom() {
074    return from;
075  }
076
077  @Override
078  public boolean equals(Object o) {
079    if (this == o) {
080      return true;
081    }
082    if (o == null || getClass() != o.getClass()) {
083      return false;
084    }
085    UpdateFolderMetadataByIdRequestBody casted = (UpdateFolderMetadataByIdRequestBody) o;
086    return Objects.equals(op, casted.op)
087        && Objects.equals(path, casted.path)
088        && Objects.equals(value, casted.value)
089        && Objects.equals(from, casted.from);
090  }
091
092  @Override
093  public int hashCode() {
094    return Objects.hash(op, path, value, from);
095  }
096
097  @Override
098  public String toString() {
099    return "UpdateFolderMetadataByIdRequestBody{"
100        + "op='"
101        + op
102        + '\''
103        + ", "
104        + "path='"
105        + path
106        + '\''
107        + ", "
108        + "value='"
109        + value
110        + '\''
111        + ", "
112        + "from='"
113        + from
114        + '\''
115        + "}";
116  }
117
118  public static class Builder extends NullableFieldTracker {
119
120    protected EnumWrapper<UpdateFolderMetadataByIdRequestBodyOpField> op;
121
122    protected String path;
123
124    protected MetadataInstanceValue value;
125
126    protected String from;
127
128    public Builder op(UpdateFolderMetadataByIdRequestBodyOpField op) {
129      this.op = new EnumWrapper<UpdateFolderMetadataByIdRequestBodyOpField>(op);
130      return this;
131    }
132
133    public Builder op(EnumWrapper<UpdateFolderMetadataByIdRequestBodyOpField> op) {
134      this.op = op;
135      return this;
136    }
137
138    public Builder path(String path) {
139      this.path = path;
140      return this;
141    }
142
143    public Builder value(String value) {
144      this.value = new MetadataInstanceValue(value);
145      return this;
146    }
147
148    public Builder value(long value) {
149      this.value = new MetadataInstanceValue(value);
150      return this;
151    }
152
153    public Builder value(double value) {
154      this.value = new MetadataInstanceValue(value);
155      return this;
156    }
157
158    public Builder value(List<String> value) {
159      this.value = new MetadataInstanceValue(value);
160      return this;
161    }
162
163    public Builder value(MetadataInstanceValue value) {
164      this.value = value;
165      return this;
166    }
167
168    public Builder from(String from) {
169      this.from = from;
170      return this;
171    }
172
173    public UpdateFolderMetadataByIdRequestBody build() {
174      return new UpdateFolderMetadataByIdRequestBody(this);
175    }
176  }
177}