001package com.box.sdk;
002
003import com.box.sdk.internal.utils.JsonUtils;
004import com.eclipsesource.json.JsonObject;
005
006/** Represents an AI Agent used for generating text. */
007@BoxResourceType("ai_agent_text_gen")
008public class BoxAIAgentTextGen extends BoxAIAgent {
009
010  /** The type of the AI Agent for generating text. */
011  public static final String TYPE = "ai_agent_text_gen";
012
013  /** The basic generator used for the AI Agent for generating text. */
014  private BoxAIAgentTextGenBasicGen basicGen;
015
016  /**
017   * Constructs an AI agent with default settings.
018   *
019   * @param basicGen The basic generator used for the AI Agent for generating text.
020   */
021  public BoxAIAgentTextGen(BoxAIAgentTextGenBasicGen basicGen) {
022    super(TYPE);
023    this.basicGen = basicGen;
024  }
025
026  /**
027   * Constructs an AI agent with default settings.
028   *
029   * @param jsonObject JSON object representing the AI agent.
030   */
031  public BoxAIAgentTextGen(JsonObject jsonObject) {
032    super(jsonObject);
033  }
034
035  /**
036   * Gets the basic generator used for the AI Agent for generating text.
037   *
038   * @return The basic generator used for the AI Agent for generating text.
039   */
040  public BoxAIAgentTextGenBasicGen getBasicGen() {
041    return basicGen;
042  }
043
044  /**
045   * Sets the basic generator used for the AI Agent for generating text.
046   *
047   * @param basicGen The basic generator used for the AI Agent for generating text.
048   */
049  public void setBasicGen(BoxAIAgentTextGenBasicGen basicGen) {
050    this.basicGen = basicGen;
051  }
052
053  @Override
054  void parseJSONMember(JsonObject.Member member) {
055    super.parseJSONMember(member);
056    String memberName = member.getName();
057    if (memberName.equals("basic_gen")) {
058      this.basicGen = new BoxAIAgentTextGenBasicGen(member.getValue().asObject());
059    }
060  }
061
062  public JsonObject getJSONObject() {
063    JsonObject jsonObject = new JsonObject();
064    JsonUtils.addIfNotNull(jsonObject, "type", this.getType());
065    if (this.basicGen != null) {
066      jsonObject.add("basic_gen", this.basicGen.getJSONObject());
067    }
068    return jsonObject;
069  }
070}