001package com.box.sdkgen.schemas.aiitembase;
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.Objects;
011
012/** The item to be processed by the LLM. */
013@JsonFilter("nullablePropertyFilter")
014public class AiItemBase extends SerializableObject {
015
016  /** The ID of the file. */
017  protected final String id;
018
019  /** The type of the item. Currently the value can be `file` only. */
020  @JsonDeserialize(using = AiItemBaseTypeField.AiItemBaseTypeFieldDeserializer.class)
021  @JsonSerialize(using = AiItemBaseTypeField.AiItemBaseTypeFieldSerializer.class)
022  protected EnumWrapper<AiItemBaseTypeField> type;
023
024  /** The content of the item, often the text representation. */
025  protected String content;
026
027  public AiItemBase(@JsonProperty("id") String id) {
028    super();
029    this.id = id;
030    this.type = new EnumWrapper<AiItemBaseTypeField>(AiItemBaseTypeField.FILE);
031  }
032
033  protected AiItemBase(Builder builder) {
034    super();
035    this.id = builder.id;
036    this.type = builder.type;
037    this.content = builder.content;
038    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
039  }
040
041  public String getId() {
042    return id;
043  }
044
045  public EnumWrapper<AiItemBaseTypeField> getType() {
046    return type;
047  }
048
049  public String getContent() {
050    return content;
051  }
052
053  @Override
054  public boolean equals(Object o) {
055    if (this == o) {
056      return true;
057    }
058    if (o == null || getClass() != o.getClass()) {
059      return false;
060    }
061    AiItemBase casted = (AiItemBase) o;
062    return Objects.equals(id, casted.id)
063        && Objects.equals(type, casted.type)
064        && Objects.equals(content, casted.content);
065  }
066
067  @Override
068  public int hashCode() {
069    return Objects.hash(id, type, content);
070  }
071
072  @Override
073  public String toString() {
074    return "AiItemBase{"
075        + "id='"
076        + id
077        + '\''
078        + ", "
079        + "type='"
080        + type
081        + '\''
082        + ", "
083        + "content='"
084        + content
085        + '\''
086        + "}";
087  }
088
089  public static class Builder extends NullableFieldTracker {
090
091    protected final String id;
092
093    protected EnumWrapper<AiItemBaseTypeField> type;
094
095    protected String content;
096
097    public Builder(String id) {
098      super();
099      this.id = id;
100    }
101
102    public Builder type(AiItemBaseTypeField type) {
103      this.type = new EnumWrapper<AiItemBaseTypeField>(type);
104      return this;
105    }
106
107    public Builder type(EnumWrapper<AiItemBaseTypeField> type) {
108      this.type = type;
109      return this;
110    }
111
112    public Builder content(String content) {
113      this.content = content;
114      return this;
115    }
116
117    public AiItemBase build() {
118      if (this.type == null) {
119        this.type = new EnumWrapper<AiItemBaseTypeField>(AiItemBaseTypeField.FILE);
120      }
121      return new AiItemBase(this);
122    }
123  }
124}