001package com.box.sdkgen.schemas.aiextractstructured;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.schemas.aiextractsubfield.AiExtractSubField;
006import com.box.sdkgen.schemas.aioptionsrules.AiOptionsRules;
007import com.fasterxml.jackson.annotation.JsonFilter;
008import com.fasterxml.jackson.annotation.JsonProperty;
009import java.util.List;
010import java.util.Objects;
011
012@JsonFilter("nullablePropertyFilter")
013public class AiExtractStructuredFieldsField extends SerializableObject {
014
015  /** A unique identifier for the field. */
016  protected final String key;
017
018  /** A description of the field. */
019  protected String description;
020
021  /** The display name of the field. */
022  protected String displayName;
023
024  /** The context about the key that may include how to find and format it. */
025  protected String prompt;
026
027  /**
028   * The type of the field. It can include but is not limited to `string`, `float`, `date`, `enum`,
029   * `multiSelect`,`taxonomy`, `struct`, and `table`.
030   */
031  protected String type;
032
033  /**
034   * A list of options for this field. This is most often used in combination with the `enum` and
035   * `multiSelect` field types.
036   */
037  protected List<AiExtractStructuredFieldsOptionsField> options;
038
039  /**
040   * The nested fields for this field. Used with `struct` and `table` field types to define the
041   * nested structure.
042   */
043  protected List<AiExtractSubField> fields;
044
045  /**
046   * The identifier for a taxonomy, which corresponds to the `key` of the taxonomy source. Required
047   * if using `taxonomy` type field.
048   */
049  @JsonProperty("taxonomy_key")
050  protected String taxonomyKey;
051
052  /**
053   * The namespace of the taxonomy source. Required if using `taxonomy` type field from an existing
054   * taxonomy.
055   */
056  protected String namespace;
057
058  @JsonProperty("options_rules")
059  protected AiOptionsRules optionsRules;
060
061  public AiExtractStructuredFieldsField(@JsonProperty("key") String key) {
062    super();
063    this.key = key;
064  }
065
066  protected AiExtractStructuredFieldsField(Builder builder) {
067    super();
068    this.key = builder.key;
069    this.description = builder.description;
070    this.displayName = builder.displayName;
071    this.prompt = builder.prompt;
072    this.type = builder.type;
073    this.options = builder.options;
074    this.fields = builder.fields;
075    this.taxonomyKey = builder.taxonomyKey;
076    this.namespace = builder.namespace;
077    this.optionsRules = builder.optionsRules;
078    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
079  }
080
081  public String getKey() {
082    return key;
083  }
084
085  public String getDescription() {
086    return description;
087  }
088
089  public String getDisplayName() {
090    return displayName;
091  }
092
093  public String getPrompt() {
094    return prompt;
095  }
096
097  public String getType() {
098    return type;
099  }
100
101  public List<AiExtractStructuredFieldsOptionsField> getOptions() {
102    return options;
103  }
104
105  public List<AiExtractSubField> getFields() {
106    return fields;
107  }
108
109  public String getTaxonomyKey() {
110    return taxonomyKey;
111  }
112
113  public String getNamespace() {
114    return namespace;
115  }
116
117  public AiOptionsRules getOptionsRules() {
118    return optionsRules;
119  }
120
121  @Override
122  public boolean equals(Object o) {
123    if (this == o) {
124      return true;
125    }
126    if (o == null || getClass() != o.getClass()) {
127      return false;
128    }
129    AiExtractStructuredFieldsField casted = (AiExtractStructuredFieldsField) o;
130    return Objects.equals(key, casted.key)
131        && Objects.equals(description, casted.description)
132        && Objects.equals(displayName, casted.displayName)
133        && Objects.equals(prompt, casted.prompt)
134        && Objects.equals(type, casted.type)
135        && Objects.equals(options, casted.options)
136        && Objects.equals(fields, casted.fields)
137        && Objects.equals(taxonomyKey, casted.taxonomyKey)
138        && Objects.equals(namespace, casted.namespace)
139        && Objects.equals(optionsRules, casted.optionsRules);
140  }
141
142  @Override
143  public int hashCode() {
144    return Objects.hash(
145        key,
146        description,
147        displayName,
148        prompt,
149        type,
150        options,
151        fields,
152        taxonomyKey,
153        namespace,
154        optionsRules);
155  }
156
157  @Override
158  public String toString() {
159    return "AiExtractStructuredFieldsField{"
160        + "key='"
161        + key
162        + '\''
163        + ", "
164        + "description='"
165        + description
166        + '\''
167        + ", "
168        + "displayName='"
169        + displayName
170        + '\''
171        + ", "
172        + "prompt='"
173        + prompt
174        + '\''
175        + ", "
176        + "type='"
177        + type
178        + '\''
179        + ", "
180        + "options='"
181        + options
182        + '\''
183        + ", "
184        + "fields='"
185        + fields
186        + '\''
187        + ", "
188        + "taxonomyKey='"
189        + taxonomyKey
190        + '\''
191        + ", "
192        + "namespace='"
193        + namespace
194        + '\''
195        + ", "
196        + "optionsRules='"
197        + optionsRules
198        + '\''
199        + "}";
200  }
201
202  public static class Builder extends NullableFieldTracker {
203
204    protected final String key;
205
206    protected String description;
207
208    protected String displayName;
209
210    protected String prompt;
211
212    protected String type;
213
214    protected List<AiExtractStructuredFieldsOptionsField> options;
215
216    protected List<AiExtractSubField> fields;
217
218    protected String taxonomyKey;
219
220    protected String namespace;
221
222    protected AiOptionsRules optionsRules;
223
224    public Builder(String key) {
225      super();
226      this.key = key;
227    }
228
229    public Builder description(String description) {
230      this.description = description;
231      return this;
232    }
233
234    public Builder displayName(String displayName) {
235      this.displayName = displayName;
236      return this;
237    }
238
239    public Builder prompt(String prompt) {
240      this.prompt = prompt;
241      return this;
242    }
243
244    public Builder type(String type) {
245      this.type = type;
246      return this;
247    }
248
249    public Builder options(List<AiExtractStructuredFieldsOptionsField> options) {
250      this.options = options;
251      return this;
252    }
253
254    public Builder fields(List<AiExtractSubField> fields) {
255      this.fields = fields;
256      return this;
257    }
258
259    public Builder taxonomyKey(String taxonomyKey) {
260      this.taxonomyKey = taxonomyKey;
261      return this;
262    }
263
264    public Builder namespace(String namespace) {
265      this.namespace = namespace;
266      return this;
267    }
268
269    public Builder optionsRules(AiOptionsRules optionsRules) {
270      this.optionsRules = optionsRules;
271      return this;
272    }
273
274    public AiExtractStructuredFieldsField build() {
275      return new AiExtractStructuredFieldsField(this);
276    }
277  }
278}