001package com.box.sdk;
002
003import com.box.sdk.internal.utils.JsonUtils;
004import com.eclipsesource.json.JsonObject;
005
006public class BoxAIExtractMetadataTemplate extends BoxJSONObject {
007  /** The type of object this class represents. */
008  public static final String TYPE = "metadata_template";
009  /** The scope of the metadata template that can either be global or enterprise. */
010  private String scope;
011  /** The template key of the metadata template. */
012  private String templateKey;
013
014  /**
015   * Constructs a BoxAIExtractMetadataTemplate object with a given scope and template key.
016   *
017   * @param templateKey the template key of the metadata template.
018   * @param scope the scope of the metadata template.
019   */
020  public BoxAIExtractMetadataTemplate(String templateKey, String scope) {
021    this.templateKey = templateKey;
022    this.scope = scope;
023  }
024
025  @Override
026  void parseJSONMember(JsonObject.Member member) {
027    super.parseJSONMember(member);
028    String memberName = member.getName();
029    if (memberName.equals("scope")) {
030      this.scope = member.getValue().asString();
031    } else if (memberName.equals("template_key")) {
032      this.templateKey = member.getValue().asString();
033    }
034  }
035
036  public JsonObject getJSONObject() {
037    JsonObject jsonObject = new JsonObject();
038    JsonUtils.addIfNotNull(jsonObject, "type", TYPE);
039    JsonUtils.addIfNotNull(jsonObject, "scope", this.scope);
040    JsonUtils.addIfNotNull(jsonObject, "template_key", this.templateKey);
041    return jsonObject;
042  }
043
044  public String getScope() {
045    return this.scope;
046  }
047
048  public String getTemplateKey() {
049    return this.templateKey;
050  }
051}