001package com.box.sdk;
002
003import com.eclipsesource.json.JsonObject;
004
005/**
006 * Represents a Box File to be included in a sign request.
007 */
008public class BoxAIItem {
009    private String id;
010    private Type type;
011    private String content;
012
013    /**
014     * Created a BoxAIItem - the item to be processed by the LLM.
015     * @param id  The id of the item
016     * @param type The type of the item. Currently, only "file" is supported.
017     * @param content The content of the item, often the text representation.
018     */
019    public BoxAIItem(String id, Type type, String content) {
020        this.id = id;
021        this.type = type;
022        this.content = content;
023    }
024
025    /**
026     * Created a BoxAIItem - the item to be processed by the LLM.
027     * @param id The id of the item
028     * @param type The type of the item. Currently, only "file" is supported.
029     */
030    public BoxAIItem(String id, Type type) {
031        this.id = id;
032        this.type = type;
033    }
034
035    /**
036     * Gets the id of the item.
037     * @return the id of the item.
038     */
039    public String getId() {
040        return id;
041    }
042
043    /**
044     * Sets the id of the item.
045     * @param id the id of the item.
046     */
047    public void setId(String id) {
048        this.id = id;
049    }
050
051    /**
052     * Gets the type of the item.
053     * @return the type of the item.
054     */
055    public Type getType() {
056        return type;
057    }
058
059    /**
060     * Sets the type of the item.
061     * @param type the type of the item.
062     */
063    public void setType(Type type) {
064        this.type = type;
065    }
066
067    /**
068     * Gets the content of the item.
069     * @return the content of the item.
070     */
071    public String getContent() {
072        return content;
073    }
074
075    /**
076     * Sets the content of the item.
077     * @param content the content of the item.
078     */
079    public void setContent(String content) {
080        this.content = content;
081    }
082
083    /**
084     * Gets a JSON object representing this class.
085     *
086     * @return the JSON object representing this class.
087     */
088    public JsonObject getJSONObject() {
089        JsonObject itemJSON = new JsonObject()
090            .add("id", this.id)
091            .add("type", this.type.toJSONValue());
092
093        if (this.content != null) {
094            itemJSON.add("content", this.content);
095        }
096
097        return itemJSON;
098    }
099
100    public enum Type {
101        /**
102         * A file.
103         */
104        FILE("file");
105
106
107        private final String jsonValue;
108
109        Type(String jsonValue) {
110            this.jsonValue = jsonValue;
111        }
112
113        static BoxAIItem.Type fromJSONValue(String jsonValue) {
114            return BoxAIItem.Type.valueOf(jsonValue.toUpperCase());
115        }
116
117        String toJSONValue() {
118            return this.jsonValue;
119        }
120    }
121}