001package com.box.sdkgen.schemas.classificationtemplate;
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.List;
011import java.util.Objects;
012
013@JsonFilter("nullablePropertyFilter")
014public class ClassificationTemplateFieldsField extends SerializableObject {
015
016  /** The unique ID of the field. */
017  protected final String id;
018
019  /** The array item type. */
020  @JsonDeserialize(
021      using =
022          ClassificationTemplateFieldsTypeField.ClassificationTemplateFieldsTypeFieldDeserializer
023              .class)
024  @JsonSerialize(
025      using =
026          ClassificationTemplateFieldsTypeField.ClassificationTemplateFieldsTypeFieldSerializer
027              .class)
028  protected EnumWrapper<ClassificationTemplateFieldsTypeField> type;
029
030  /** Defines classifications available in the enterprise. */
031  @JsonDeserialize(
032      using =
033          ClassificationTemplateFieldsKeyField.ClassificationTemplateFieldsKeyFieldDeserializer
034              .class)
035  @JsonSerialize(
036      using =
037          ClassificationTemplateFieldsKeyField.ClassificationTemplateFieldsKeyFieldSerializer.class)
038  protected EnumWrapper<ClassificationTemplateFieldsKeyField> key;
039
040  /** The value will always be `Classification`. */
041  @JsonDeserialize(
042      using =
043          ClassificationTemplateFieldsDisplayNameField
044              .ClassificationTemplateFieldsDisplayNameFieldDeserializer.class)
045  @JsonSerialize(
046      using =
047          ClassificationTemplateFieldsDisplayNameField
048              .ClassificationTemplateFieldsDisplayNameFieldSerializer.class)
049  protected EnumWrapper<ClassificationTemplateFieldsDisplayNameField> displayName;
050
051  /** Classifications are always visible to web and mobile users. */
052  protected Boolean hidden;
053
054  /** A list of classifications available in this enterprise. */
055  protected final List<ClassificationTemplateFieldsOptionsField> options;
056
057  public ClassificationTemplateFieldsField(
058      @JsonProperty("id") String id,
059      @JsonProperty("options") List<ClassificationTemplateFieldsOptionsField> options) {
060    super();
061    this.id = id;
062    this.options = options;
063    this.type =
064        new EnumWrapper<ClassificationTemplateFieldsTypeField>(
065            ClassificationTemplateFieldsTypeField.ENUM);
066    this.key =
067        new EnumWrapper<ClassificationTemplateFieldsKeyField>(
068            ClassificationTemplateFieldsKeyField.BOX__SECURITY__CLASSIFICATION__KEY);
069    this.displayName =
070        new EnumWrapper<ClassificationTemplateFieldsDisplayNameField>(
071            ClassificationTemplateFieldsDisplayNameField.CLASSIFICATION);
072  }
073
074  protected ClassificationTemplateFieldsField(Builder builder) {
075    super();
076    this.id = builder.id;
077    this.type = builder.type;
078    this.key = builder.key;
079    this.displayName = builder.displayName;
080    this.hidden = builder.hidden;
081    this.options = builder.options;
082    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
083  }
084
085  public String getId() {
086    return id;
087  }
088
089  public EnumWrapper<ClassificationTemplateFieldsTypeField> getType() {
090    return type;
091  }
092
093  public EnumWrapper<ClassificationTemplateFieldsKeyField> getKey() {
094    return key;
095  }
096
097  public EnumWrapper<ClassificationTemplateFieldsDisplayNameField> getDisplayName() {
098    return displayName;
099  }
100
101  public Boolean getHidden() {
102    return hidden;
103  }
104
105  public List<ClassificationTemplateFieldsOptionsField> getOptions() {
106    return options;
107  }
108
109  @Override
110  public boolean equals(Object o) {
111    if (this == o) {
112      return true;
113    }
114    if (o == null || getClass() != o.getClass()) {
115      return false;
116    }
117    ClassificationTemplateFieldsField casted = (ClassificationTemplateFieldsField) o;
118    return Objects.equals(id, casted.id)
119        && Objects.equals(type, casted.type)
120        && Objects.equals(key, casted.key)
121        && Objects.equals(displayName, casted.displayName)
122        && Objects.equals(hidden, casted.hidden)
123        && Objects.equals(options, casted.options);
124  }
125
126  @Override
127  public int hashCode() {
128    return Objects.hash(id, type, key, displayName, hidden, options);
129  }
130
131  @Override
132  public String toString() {
133    return "ClassificationTemplateFieldsField{"
134        + "id='"
135        + id
136        + '\''
137        + ", "
138        + "type='"
139        + type
140        + '\''
141        + ", "
142        + "key='"
143        + key
144        + '\''
145        + ", "
146        + "displayName='"
147        + displayName
148        + '\''
149        + ", "
150        + "hidden='"
151        + hidden
152        + '\''
153        + ", "
154        + "options='"
155        + options
156        + '\''
157        + "}";
158  }
159
160  public static class Builder extends NullableFieldTracker {
161
162    protected final String id;
163
164    protected EnumWrapper<ClassificationTemplateFieldsTypeField> type;
165
166    protected EnumWrapper<ClassificationTemplateFieldsKeyField> key;
167
168    protected EnumWrapper<ClassificationTemplateFieldsDisplayNameField> displayName;
169
170    protected Boolean hidden;
171
172    protected final List<ClassificationTemplateFieldsOptionsField> options;
173
174    public Builder(String id, List<ClassificationTemplateFieldsOptionsField> options) {
175      super();
176      this.id = id;
177      this.options = options;
178    }
179
180    public Builder type(ClassificationTemplateFieldsTypeField type) {
181      this.type = new EnumWrapper<ClassificationTemplateFieldsTypeField>(type);
182      return this;
183    }
184
185    public Builder type(EnumWrapper<ClassificationTemplateFieldsTypeField> type) {
186      this.type = type;
187      return this;
188    }
189
190    public Builder key(ClassificationTemplateFieldsKeyField key) {
191      this.key = new EnumWrapper<ClassificationTemplateFieldsKeyField>(key);
192      return this;
193    }
194
195    public Builder key(EnumWrapper<ClassificationTemplateFieldsKeyField> key) {
196      this.key = key;
197      return this;
198    }
199
200    public Builder displayName(ClassificationTemplateFieldsDisplayNameField displayName) {
201      this.displayName = new EnumWrapper<ClassificationTemplateFieldsDisplayNameField>(displayName);
202      return this;
203    }
204
205    public Builder displayName(
206        EnumWrapper<ClassificationTemplateFieldsDisplayNameField> displayName) {
207      this.displayName = displayName;
208      return this;
209    }
210
211    public Builder hidden(Boolean hidden) {
212      this.hidden = hidden;
213      return this;
214    }
215
216    public ClassificationTemplateFieldsField build() {
217      if (this.type == null) {
218        this.type =
219            new EnumWrapper<ClassificationTemplateFieldsTypeField>(
220                ClassificationTemplateFieldsTypeField.ENUM);
221      }
222      if (this.key == null) {
223        this.key =
224            new EnumWrapper<ClassificationTemplateFieldsKeyField>(
225                ClassificationTemplateFieldsKeyField.BOX__SECURITY__CLASSIFICATION__KEY);
226      }
227      if (this.displayName == null) {
228        this.displayName =
229            new EnumWrapper<ClassificationTemplateFieldsDisplayNameField>(
230                ClassificationTemplateFieldsDisplayNameField.CLASSIFICATION);
231      }
232      return new ClassificationTemplateFieldsField(this);
233    }
234  }
235}