001package com.box.sdkgen.managers.metadatatemplates; 002 003import com.box.sdkgen.internal.NullableFieldTracker; 004import com.box.sdkgen.internal.SerializableObject; 005import com.box.sdkgen.serialization.json.EnumWrapper; 006import com.fasterxml.jackson.annotation.JsonFilter; 007import com.fasterxml.jackson.annotation.JsonProperty; 008import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 009import com.fasterxml.jackson.databind.annotation.JsonSerialize; 010import java.util.List; 011import java.util.Objects; 012 013@JsonFilter("nullablePropertyFilter") 014public class CreateMetadataTemplateRequestBodyFieldsField extends SerializableObject { 015 016 /** 017 * The type of field. The basic fields are a `string` field for text, a `float` field for numbers, 018 * and a `date` field to present the user with a date-time picker. 019 * 020 * <p>Additionally, metadata templates support an `enum` field for a basic list of items, and ` 021 * multiSelect` field for a similar list of items where the user can select more than one value. 022 * 023 * <p>Metadata taxonomies are also supported as a `taxonomy` field type with a specific set of 024 * additional properties, which describe its structure. 025 */ 026 @JsonDeserialize( 027 using = 028 CreateMetadataTemplateRequestBodyFieldsTypeField 029 .CreateMetadataTemplateRequestBodyFieldsTypeFieldDeserializer.class) 030 @JsonSerialize( 031 using = 032 CreateMetadataTemplateRequestBodyFieldsTypeField 033 .CreateMetadataTemplateRequestBodyFieldsTypeFieldSerializer.class) 034 protected final EnumWrapper<CreateMetadataTemplateRequestBodyFieldsTypeField> type; 035 036 /** 037 * A unique identifier for the field. The identifier must be unique within the template to which 038 * it belongs. 039 */ 040 protected final String key; 041 042 /** The display name of the field as it is shown to the user in the web and mobile apps. */ 043 protected final String displayName; 044 045 /** A description of the field. This is not shown to the user. */ 046 protected String description; 047 048 /** 049 * Whether this field is hidden in the UI for the user and can only be set through the API 050 * instead. 051 */ 052 protected Boolean hidden; 053 054 /** 055 * A list of options for this field. This is used in combination with the `enum` and `multiSelect` 056 * field types. 057 */ 058 protected List<CreateMetadataTemplateRequestBodyFieldsOptionsField> options; 059 060 /** 061 * The unique key of the metadata taxonomy to use for this taxonomy field. This property is 062 * required when the field `type` is set to `taxonomy`. 063 */ 064 protected String taxonomyKey; 065 066 /** 067 * The namespace of the metadata taxonomy to use for this taxonomy field. This property is 068 * required when the field `type` is set to `taxonomy`. 069 */ 070 protected String namespace; 071 072 /** 073 * An object defining additional rules for the options of the taxonomy field. This property is 074 * required when the field `type` is set to `taxonomy`. 075 */ 076 protected CreateMetadataTemplateRequestBodyFieldsOptionsRulesField optionsRules; 077 078 public CreateMetadataTemplateRequestBodyFieldsField( 079 CreateMetadataTemplateRequestBodyFieldsTypeField type, String key, String displayName) { 080 super(); 081 this.type = new EnumWrapper<CreateMetadataTemplateRequestBodyFieldsTypeField>(type); 082 this.key = key; 083 this.displayName = displayName; 084 } 085 086 public CreateMetadataTemplateRequestBodyFieldsField( 087 @JsonProperty("type") EnumWrapper<CreateMetadataTemplateRequestBodyFieldsTypeField> type, 088 @JsonProperty("key") String key, 089 @JsonProperty("displayName") String displayName) { 090 super(); 091 this.type = type; 092 this.key = key; 093 this.displayName = displayName; 094 } 095 096 protected CreateMetadataTemplateRequestBodyFieldsField(Builder builder) { 097 super(); 098 this.type = builder.type; 099 this.key = builder.key; 100 this.displayName = builder.displayName; 101 this.description = builder.description; 102 this.hidden = builder.hidden; 103 this.options = builder.options; 104 this.taxonomyKey = builder.taxonomyKey; 105 this.namespace = builder.namespace; 106 this.optionsRules = builder.optionsRules; 107 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 108 } 109 110 public EnumWrapper<CreateMetadataTemplateRequestBodyFieldsTypeField> getType() { 111 return type; 112 } 113 114 public String getKey() { 115 return key; 116 } 117 118 public String getDisplayName() { 119 return displayName; 120 } 121 122 public String getDescription() { 123 return description; 124 } 125 126 public Boolean getHidden() { 127 return hidden; 128 } 129 130 public List<CreateMetadataTemplateRequestBodyFieldsOptionsField> getOptions() { 131 return options; 132 } 133 134 public String getTaxonomyKey() { 135 return taxonomyKey; 136 } 137 138 public String getNamespace() { 139 return namespace; 140 } 141 142 public CreateMetadataTemplateRequestBodyFieldsOptionsRulesField getOptionsRules() { 143 return optionsRules; 144 } 145 146 @Override 147 public boolean equals(Object o) { 148 if (this == o) { 149 return true; 150 } 151 if (o == null || getClass() != o.getClass()) { 152 return false; 153 } 154 CreateMetadataTemplateRequestBodyFieldsField casted = 155 (CreateMetadataTemplateRequestBodyFieldsField) o; 156 return Objects.equals(type, casted.type) 157 && Objects.equals(key, casted.key) 158 && Objects.equals(displayName, casted.displayName) 159 && Objects.equals(description, casted.description) 160 && Objects.equals(hidden, casted.hidden) 161 && Objects.equals(options, casted.options) 162 && Objects.equals(taxonomyKey, casted.taxonomyKey) 163 && Objects.equals(namespace, casted.namespace) 164 && Objects.equals(optionsRules, casted.optionsRules); 165 } 166 167 @Override 168 public int hashCode() { 169 return Objects.hash( 170 type, key, displayName, description, hidden, options, taxonomyKey, namespace, optionsRules); 171 } 172 173 @Override 174 public String toString() { 175 return "CreateMetadataTemplateRequestBodyFieldsField{" 176 + "type='" 177 + type 178 + '\'' 179 + ", " 180 + "key='" 181 + key 182 + '\'' 183 + ", " 184 + "displayName='" 185 + displayName 186 + '\'' 187 + ", " 188 + "description='" 189 + description 190 + '\'' 191 + ", " 192 + "hidden='" 193 + hidden 194 + '\'' 195 + ", " 196 + "options='" 197 + options 198 + '\'' 199 + ", " 200 + "taxonomyKey='" 201 + taxonomyKey 202 + '\'' 203 + ", " 204 + "namespace='" 205 + namespace 206 + '\'' 207 + ", " 208 + "optionsRules='" 209 + optionsRules 210 + '\'' 211 + "}"; 212 } 213 214 public static class Builder extends NullableFieldTracker { 215 216 protected final EnumWrapper<CreateMetadataTemplateRequestBodyFieldsTypeField> type; 217 218 protected final String key; 219 220 protected final String displayName; 221 222 protected String description; 223 224 protected Boolean hidden; 225 226 protected List<CreateMetadataTemplateRequestBodyFieldsOptionsField> options; 227 228 protected String taxonomyKey; 229 230 protected String namespace; 231 232 protected CreateMetadataTemplateRequestBodyFieldsOptionsRulesField optionsRules; 233 234 public Builder( 235 CreateMetadataTemplateRequestBodyFieldsTypeField type, String key, String displayName) { 236 super(); 237 this.type = new EnumWrapper<CreateMetadataTemplateRequestBodyFieldsTypeField>(type); 238 this.key = key; 239 this.displayName = displayName; 240 } 241 242 public Builder( 243 EnumWrapper<CreateMetadataTemplateRequestBodyFieldsTypeField> type, 244 String key, 245 String displayName) { 246 super(); 247 this.type = type; 248 this.key = key; 249 this.displayName = displayName; 250 } 251 252 public Builder description(String description) { 253 this.description = description; 254 return this; 255 } 256 257 public Builder hidden(Boolean hidden) { 258 this.hidden = hidden; 259 return this; 260 } 261 262 public Builder options(List<CreateMetadataTemplateRequestBodyFieldsOptionsField> options) { 263 this.options = options; 264 return this; 265 } 266 267 public Builder taxonomyKey(String taxonomyKey) { 268 this.taxonomyKey = taxonomyKey; 269 return this; 270 } 271 272 public Builder namespace(String namespace) { 273 this.namespace = namespace; 274 return this; 275 } 276 277 public Builder optionsRules( 278 CreateMetadataTemplateRequestBodyFieldsOptionsRulesField optionsRules) { 279 this.optionsRules = optionsRules; 280 return this; 281 } 282 283 public CreateMetadataTemplateRequestBodyFieldsField build() { 284 return new CreateMetadataTemplateRequestBodyFieldsField(this); 285 } 286 } 287}