001package com.box.sdkgen.schemas.createaiagent;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.schemas.aiagentallowedentity.AiAgentAllowedEntity;
006import com.box.sdkgen.schemas.aistudioagentask.AiStudioAgentAsk;
007import com.box.sdkgen.schemas.aistudioagentextract.AiStudioAgentExtract;
008import com.box.sdkgen.schemas.aistudioagenttextgen.AiStudioAgentTextGen;
009import com.box.sdkgen.serialization.json.EnumWrapper;
010import com.fasterxml.jackson.annotation.JsonFilter;
011import com.fasterxml.jackson.annotation.JsonProperty;
012import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
013import com.fasterxml.jackson.databind.annotation.JsonSerialize;
014import java.util.List;
015import java.util.Objects;
016
017/** The schema for AI agent create request. */
018@JsonFilter("nullablePropertyFilter")
019public class CreateAiAgent extends SerializableObject {
020
021  /** The type of agent used to handle queries. */
022  @JsonDeserialize(using = CreateAiAgentTypeField.CreateAiAgentTypeFieldDeserializer.class)
023  @JsonSerialize(using = CreateAiAgentTypeField.CreateAiAgentTypeFieldSerializer.class)
024  protected EnumWrapper<CreateAiAgentTypeField> type;
025
026  /** The name of the AI Agent. */
027  protected final String name;
028
029  /**
030   * The state of the AI Agent. Possible values are: `enabled`, `disabled`, and
031   * `enabled_for_selected_users`.
032   */
033  @JsonProperty("access_state")
034  protected final String accessState;
035
036  /**
037   * The icon reference of the AI Agent. It should have format of the URL
038   * `https://cdn01.boxcdn.net/app-assets/aistudio/avatars/&lt;file_name&gt;` where possible values
039   * of `file_name` are:
040   * `logo_boxAi.png`,`logo_stamp.png`,`logo_legal.png`,`logo_finance.png`,`logo_config.png`,`logo_handshake.png`,`logo_analytics.png`,`logo_classification.png`.
041   */
042  @JsonProperty("icon_reference")
043  protected String iconReference;
044
045  /** List of allowed users or groups. */
046  @JsonProperty("allowed_entities")
047  protected List<AiAgentAllowedEntity> allowedEntities;
048
049  protected AiStudioAgentAsk ask;
050
051  @JsonProperty("text_gen")
052  protected AiStudioAgentTextGen textGen;
053
054  protected AiStudioAgentExtract extract;
055
056  public CreateAiAgent(
057      @JsonProperty("name") String name, @JsonProperty("access_state") String accessState) {
058    super();
059    this.name = name;
060    this.accessState = accessState;
061    this.type = new EnumWrapper<CreateAiAgentTypeField>(CreateAiAgentTypeField.AI_AGENT);
062  }
063
064  protected CreateAiAgent(Builder builder) {
065    super();
066    this.type = builder.type;
067    this.name = builder.name;
068    this.accessState = builder.accessState;
069    this.iconReference = builder.iconReference;
070    this.allowedEntities = builder.allowedEntities;
071    this.ask = builder.ask;
072    this.textGen = builder.textGen;
073    this.extract = builder.extract;
074    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
075  }
076
077  public EnumWrapper<CreateAiAgentTypeField> getType() {
078    return type;
079  }
080
081  public String getName() {
082    return name;
083  }
084
085  public String getAccessState() {
086    return accessState;
087  }
088
089  public String getIconReference() {
090    return iconReference;
091  }
092
093  public List<AiAgentAllowedEntity> getAllowedEntities() {
094    return allowedEntities;
095  }
096
097  public AiStudioAgentAsk getAsk() {
098    return ask;
099  }
100
101  public AiStudioAgentTextGen getTextGen() {
102    return textGen;
103  }
104
105  public AiStudioAgentExtract getExtract() {
106    return extract;
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    CreateAiAgent casted = (CreateAiAgent) o;
118    return Objects.equals(type, casted.type)
119        && Objects.equals(name, casted.name)
120        && Objects.equals(accessState, casted.accessState)
121        && Objects.equals(iconReference, casted.iconReference)
122        && Objects.equals(allowedEntities, casted.allowedEntities)
123        && Objects.equals(ask, casted.ask)
124        && Objects.equals(textGen, casted.textGen)
125        && Objects.equals(extract, casted.extract);
126  }
127
128  @Override
129  public int hashCode() {
130    return Objects.hash(
131        type, name, accessState, iconReference, allowedEntities, ask, textGen, extract);
132  }
133
134  @Override
135  public String toString() {
136    return "CreateAiAgent{"
137        + "type='"
138        + type
139        + '\''
140        + ", "
141        + "name='"
142        + name
143        + '\''
144        + ", "
145        + "accessState='"
146        + accessState
147        + '\''
148        + ", "
149        + "iconReference='"
150        + iconReference
151        + '\''
152        + ", "
153        + "allowedEntities='"
154        + allowedEntities
155        + '\''
156        + ", "
157        + "ask='"
158        + ask
159        + '\''
160        + ", "
161        + "textGen='"
162        + textGen
163        + '\''
164        + ", "
165        + "extract='"
166        + extract
167        + '\''
168        + "}";
169  }
170
171  public static class Builder extends NullableFieldTracker {
172
173    protected EnumWrapper<CreateAiAgentTypeField> type;
174
175    protected final String name;
176
177    protected final String accessState;
178
179    protected String iconReference;
180
181    protected List<AiAgentAllowedEntity> allowedEntities;
182
183    protected AiStudioAgentAsk ask;
184
185    protected AiStudioAgentTextGen textGen;
186
187    protected AiStudioAgentExtract extract;
188
189    public Builder(String name, String accessState) {
190      super();
191      this.name = name;
192      this.accessState = accessState;
193    }
194
195    public Builder type(CreateAiAgentTypeField type) {
196      this.type = new EnumWrapper<CreateAiAgentTypeField>(type);
197      return this;
198    }
199
200    public Builder type(EnumWrapper<CreateAiAgentTypeField> type) {
201      this.type = type;
202      return this;
203    }
204
205    public Builder iconReference(String iconReference) {
206      this.iconReference = iconReference;
207      return this;
208    }
209
210    public Builder allowedEntities(List<AiAgentAllowedEntity> allowedEntities) {
211      this.allowedEntities = allowedEntities;
212      return this;
213    }
214
215    public Builder ask(AiStudioAgentAsk ask) {
216      this.ask = ask;
217      return this;
218    }
219
220    public Builder textGen(AiStudioAgentTextGen textGen) {
221      this.textGen = textGen;
222      return this;
223    }
224
225    public Builder extract(AiStudioAgentExtract extract) {
226      this.extract = extract;
227      return this;
228    }
229
230    public CreateAiAgent build() {
231      if (this.type == null) {
232        this.type = new EnumWrapper<CreateAiAgentTypeField>(CreateAiAgentTypeField.AI_AGENT);
233      }
234      return new CreateAiAgent(this);
235    }
236  }
237}