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