001package com.box.sdkgen.schemas.aiextractsubfield; 002 003import com.box.sdkgen.internal.NullableFieldTracker; 004import com.box.sdkgen.internal.SerializableObject; 005import com.box.sdkgen.schemas.aiextractfieldoption.AiExtractFieldOption; 006import com.fasterxml.jackson.annotation.JsonFilter; 007import com.fasterxml.jackson.annotation.JsonProperty; 008import java.util.List; 009import java.util.Objects; 010 011/** A nested field definition for structured and table field types used in AI extraction. */ 012@JsonFilter("nullablePropertyFilter") 013public class AiExtractSubField extends SerializableObject { 014 015 /** A unique identifier for the nested field. */ 016 protected final String key; 017 018 /** A description of the nested field. */ 019 protected String description; 020 021 /** The display name of the nested field. */ 022 protected String displayName; 023 024 /** Context about the nested field that may include how to find and how to format it. */ 025 protected String prompt; 026 027 /** 028 * The type of the nested field. Allowed types include `string`, `float`, `date`, `number`, 029 * `text`, `boolean`, `enum` and `multiSelect`. 030 */ 031 protected String type; 032 033 /** A list of options for this nested field. Used with `enum` and `multiSelect` types. */ 034 protected List<AiExtractFieldOption> options; 035 036 public AiExtractSubField(@JsonProperty("key") String key) { 037 super(); 038 this.key = key; 039 } 040 041 protected AiExtractSubField(Builder builder) { 042 super(); 043 this.key = builder.key; 044 this.description = builder.description; 045 this.displayName = builder.displayName; 046 this.prompt = builder.prompt; 047 this.type = builder.type; 048 this.options = builder.options; 049 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 050 } 051 052 public String getKey() { 053 return key; 054 } 055 056 public String getDescription() { 057 return description; 058 } 059 060 public String getDisplayName() { 061 return displayName; 062 } 063 064 public String getPrompt() { 065 return prompt; 066 } 067 068 public String getType() { 069 return type; 070 } 071 072 public List<AiExtractFieldOption> getOptions() { 073 return options; 074 } 075 076 @Override 077 public boolean equals(Object o) { 078 if (this == o) { 079 return true; 080 } 081 if (o == null || getClass() != o.getClass()) { 082 return false; 083 } 084 AiExtractSubField casted = (AiExtractSubField) o; 085 return Objects.equals(key, casted.key) 086 && Objects.equals(description, casted.description) 087 && Objects.equals(displayName, casted.displayName) 088 && Objects.equals(prompt, casted.prompt) 089 && Objects.equals(type, casted.type) 090 && Objects.equals(options, casted.options); 091 } 092 093 @Override 094 public int hashCode() { 095 return Objects.hash(key, description, displayName, prompt, type, options); 096 } 097 098 @Override 099 public String toString() { 100 return "AiExtractSubField{" 101 + "key='" 102 + key 103 + '\'' 104 + ", " 105 + "description='" 106 + description 107 + '\'' 108 + ", " 109 + "displayName='" 110 + displayName 111 + '\'' 112 + ", " 113 + "prompt='" 114 + prompt 115 + '\'' 116 + ", " 117 + "type='" 118 + type 119 + '\'' 120 + ", " 121 + "options='" 122 + options 123 + '\'' 124 + "}"; 125 } 126 127 public static class Builder extends NullableFieldTracker { 128 129 protected final String key; 130 131 protected String description; 132 133 protected String displayName; 134 135 protected String prompt; 136 137 protected String type; 138 139 protected List<AiExtractFieldOption> options; 140 141 public Builder(String key) { 142 super(); 143 this.key = key; 144 } 145 146 public Builder description(String description) { 147 this.description = description; 148 return this; 149 } 150 151 public Builder displayName(String displayName) { 152 this.displayName = displayName; 153 return this; 154 } 155 156 public Builder prompt(String prompt) { 157 this.prompt = prompt; 158 return this; 159 } 160 161 public Builder type(String type) { 162 this.type = type; 163 return this; 164 } 165 166 public Builder options(List<AiExtractFieldOption> options) { 167 this.options = options; 168 return this; 169 } 170 171 public AiExtractSubField build() { 172 return new AiExtractSubField(this); 173 } 174 } 175}