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.Map; 012import java.util.Objects; 013 014@JsonFilter("nullablePropertyFilter") 015public class UpdateMetadataTemplateRequestBody extends SerializableObject { 016 017 /** 018 * The type of change to perform on the template. Some of these are hazardous as they will change 019 * existing templates. 020 */ 021 @JsonDeserialize( 022 using = 023 UpdateMetadataTemplateRequestBodyOpField 024 .UpdateMetadataTemplateRequestBodyOpFieldDeserializer.class) 025 @JsonSerialize( 026 using = 027 UpdateMetadataTemplateRequestBodyOpField 028 .UpdateMetadataTemplateRequestBodyOpFieldSerializer.class) 029 protected final EnumWrapper<UpdateMetadataTemplateRequestBodyOpField> op; 030 031 /** The data for the operation. This will vary depending on the operation being performed. */ 032 protected Map<String, Object> data; 033 034 /** 035 * For operations that affect a single field this defines the key of the field that is affected. 036 */ 037 protected String fieldKey; 038 039 /** 040 * For operations that affect multiple fields this defines the keys of the fields that are 041 * affected. 042 */ 043 protected List<String> fieldKeys; 044 045 /** 046 * For operations that affect a single `enum` option this defines the key of the option that is 047 * affected. 048 */ 049 protected String enumOptionKey; 050 051 /** 052 * For operations that affect multiple `enum` options this defines the keys of the options that 053 * are affected. 054 */ 055 protected List<String> enumOptionKeys; 056 057 /** 058 * For operations that affect a single multi select option this defines the key of the option that 059 * is affected. 060 */ 061 protected String multiSelectOptionKey; 062 063 /** 064 * For operations that affect multiple multi select options this defines the keys of the options 065 * that are affected. 066 */ 067 protected List<String> multiSelectOptionKeys; 068 069 public UpdateMetadataTemplateRequestBody(UpdateMetadataTemplateRequestBodyOpField op) { 070 super(); 071 this.op = new EnumWrapper<UpdateMetadataTemplateRequestBodyOpField>(op); 072 } 073 074 public UpdateMetadataTemplateRequestBody( 075 @JsonProperty("op") EnumWrapper<UpdateMetadataTemplateRequestBodyOpField> op) { 076 super(); 077 this.op = op; 078 } 079 080 protected UpdateMetadataTemplateRequestBody(Builder builder) { 081 super(); 082 this.op = builder.op; 083 this.data = builder.data; 084 this.fieldKey = builder.fieldKey; 085 this.fieldKeys = builder.fieldKeys; 086 this.enumOptionKey = builder.enumOptionKey; 087 this.enumOptionKeys = builder.enumOptionKeys; 088 this.multiSelectOptionKey = builder.multiSelectOptionKey; 089 this.multiSelectOptionKeys = builder.multiSelectOptionKeys; 090 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 091 } 092 093 public EnumWrapper<UpdateMetadataTemplateRequestBodyOpField> getOp() { 094 return op; 095 } 096 097 public Map<String, Object> getData() { 098 return data; 099 } 100 101 public String getFieldKey() { 102 return fieldKey; 103 } 104 105 public List<String> getFieldKeys() { 106 return fieldKeys; 107 } 108 109 public String getEnumOptionKey() { 110 return enumOptionKey; 111 } 112 113 public List<String> getEnumOptionKeys() { 114 return enumOptionKeys; 115 } 116 117 public String getMultiSelectOptionKey() { 118 return multiSelectOptionKey; 119 } 120 121 public List<String> getMultiSelectOptionKeys() { 122 return multiSelectOptionKeys; 123 } 124 125 @Override 126 public boolean equals(Object o) { 127 if (this == o) { 128 return true; 129 } 130 if (o == null || getClass() != o.getClass()) { 131 return false; 132 } 133 UpdateMetadataTemplateRequestBody casted = (UpdateMetadataTemplateRequestBody) o; 134 return Objects.equals(op, casted.op) 135 && Objects.equals(data, casted.data) 136 && Objects.equals(fieldKey, casted.fieldKey) 137 && Objects.equals(fieldKeys, casted.fieldKeys) 138 && Objects.equals(enumOptionKey, casted.enumOptionKey) 139 && Objects.equals(enumOptionKeys, casted.enumOptionKeys) 140 && Objects.equals(multiSelectOptionKey, casted.multiSelectOptionKey) 141 && Objects.equals(multiSelectOptionKeys, casted.multiSelectOptionKeys); 142 } 143 144 @Override 145 public int hashCode() { 146 return Objects.hash( 147 op, 148 data, 149 fieldKey, 150 fieldKeys, 151 enumOptionKey, 152 enumOptionKeys, 153 multiSelectOptionKey, 154 multiSelectOptionKeys); 155 } 156 157 @Override 158 public String toString() { 159 return "UpdateMetadataTemplateRequestBody{" 160 + "op='" 161 + op 162 + '\'' 163 + ", " 164 + "data='" 165 + data 166 + '\'' 167 + ", " 168 + "fieldKey='" 169 + fieldKey 170 + '\'' 171 + ", " 172 + "fieldKeys='" 173 + fieldKeys 174 + '\'' 175 + ", " 176 + "enumOptionKey='" 177 + enumOptionKey 178 + '\'' 179 + ", " 180 + "enumOptionKeys='" 181 + enumOptionKeys 182 + '\'' 183 + ", " 184 + "multiSelectOptionKey='" 185 + multiSelectOptionKey 186 + '\'' 187 + ", " 188 + "multiSelectOptionKeys='" 189 + multiSelectOptionKeys 190 + '\'' 191 + "}"; 192 } 193 194 public static class Builder extends NullableFieldTracker { 195 196 protected final EnumWrapper<UpdateMetadataTemplateRequestBodyOpField> op; 197 198 protected Map<String, Object> data; 199 200 protected String fieldKey; 201 202 protected List<String> fieldKeys; 203 204 protected String enumOptionKey; 205 206 protected List<String> enumOptionKeys; 207 208 protected String multiSelectOptionKey; 209 210 protected List<String> multiSelectOptionKeys; 211 212 public Builder(UpdateMetadataTemplateRequestBodyOpField op) { 213 super(); 214 this.op = new EnumWrapper<UpdateMetadataTemplateRequestBodyOpField>(op); 215 } 216 217 public Builder(EnumWrapper<UpdateMetadataTemplateRequestBodyOpField> op) { 218 super(); 219 this.op = op; 220 } 221 222 public Builder data(Map<String, Object> data) { 223 this.data = data; 224 return this; 225 } 226 227 public Builder fieldKey(String fieldKey) { 228 this.fieldKey = fieldKey; 229 return this; 230 } 231 232 public Builder fieldKeys(List<String> fieldKeys) { 233 this.fieldKeys = fieldKeys; 234 return this; 235 } 236 237 public Builder enumOptionKey(String enumOptionKey) { 238 this.enumOptionKey = enumOptionKey; 239 return this; 240 } 241 242 public Builder enumOptionKeys(List<String> enumOptionKeys) { 243 this.enumOptionKeys = enumOptionKeys; 244 return this; 245 } 246 247 public Builder multiSelectOptionKey(String multiSelectOptionKey) { 248 this.multiSelectOptionKey = multiSelectOptionKey; 249 return this; 250 } 251 252 public Builder multiSelectOptionKeys(List<String> multiSelectOptionKeys) { 253 this.multiSelectOptionKeys = multiSelectOptionKeys; 254 return this; 255 } 256 257 public UpdateMetadataTemplateRequestBody build() { 258 return new UpdateMetadataTemplateRequestBody(this); 259 } 260 } 261}