001package com.box.sdkgen.managers.classifications; 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 CreateClassificationTemplateRequestBody extends SerializableObject { 015 016 /** 017 * The scope in which to create the classifications. This should be `enterprise` or 018 * `enterprise_{id}` where `id` is the unique ID of the enterprise. 019 */ 020 @JsonDeserialize( 021 using = 022 CreateClassificationTemplateRequestBodyScopeField 023 .CreateClassificationTemplateRequestBodyScopeFieldDeserializer.class) 024 @JsonSerialize( 025 using = 026 CreateClassificationTemplateRequestBodyScopeField 027 .CreateClassificationTemplateRequestBodyScopeFieldSerializer.class) 028 protected EnumWrapper<CreateClassificationTemplateRequestBodyScopeField> scope; 029 030 /** Defines the list of metadata templates. */ 031 @JsonDeserialize( 032 using = 033 CreateClassificationTemplateRequestBodyTemplateKeyField 034 .CreateClassificationTemplateRequestBodyTemplateKeyFieldDeserializer.class) 035 @JsonSerialize( 036 using = 037 CreateClassificationTemplateRequestBodyTemplateKeyField 038 .CreateClassificationTemplateRequestBodyTemplateKeyFieldSerializer.class) 039 protected EnumWrapper<CreateClassificationTemplateRequestBodyTemplateKeyField> templateKey; 040 041 /** The name of the template as shown in web and mobile interfaces. */ 042 @JsonDeserialize( 043 using = 044 CreateClassificationTemplateRequestBodyDisplayNameField 045 .CreateClassificationTemplateRequestBodyDisplayNameFieldDeserializer.class) 046 @JsonSerialize( 047 using = 048 CreateClassificationTemplateRequestBodyDisplayNameField 049 .CreateClassificationTemplateRequestBodyDisplayNameFieldSerializer.class) 050 protected EnumWrapper<CreateClassificationTemplateRequestBodyDisplayNameField> displayName; 051 052 /** Determines if the classification template is hidden or available on web and mobile devices. */ 053 protected Boolean hidden; 054 055 /** Determines if classifications are copied along when the file or folder is copied. */ 056 protected Boolean copyInstanceOnItemCopy; 057 058 /** 059 * The classification template requires exactly one field, which holds all the valid 060 * classification values. 061 */ 062 protected final List<CreateClassificationTemplateRequestBodyFieldsField> fields; 063 064 public CreateClassificationTemplateRequestBody( 065 @JsonProperty("fields") List<CreateClassificationTemplateRequestBodyFieldsField> fields) { 066 super(); 067 this.fields = fields; 068 this.scope = 069 new EnumWrapper<CreateClassificationTemplateRequestBodyScopeField>( 070 CreateClassificationTemplateRequestBodyScopeField.ENTERPRISE); 071 this.templateKey = 072 new EnumWrapper<CreateClassificationTemplateRequestBodyTemplateKeyField>( 073 CreateClassificationTemplateRequestBodyTemplateKeyField 074 .SECURITYCLASSIFICATION_6VMVOCHWUWO); 075 this.displayName = 076 new EnumWrapper<CreateClassificationTemplateRequestBodyDisplayNameField>( 077 CreateClassificationTemplateRequestBodyDisplayNameField.CLASSIFICATION); 078 } 079 080 protected CreateClassificationTemplateRequestBody(Builder builder) { 081 super(); 082 this.scope = builder.scope; 083 this.templateKey = builder.templateKey; 084 this.displayName = builder.displayName; 085 this.hidden = builder.hidden; 086 this.copyInstanceOnItemCopy = builder.copyInstanceOnItemCopy; 087 this.fields = builder.fields; 088 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 089 } 090 091 public EnumWrapper<CreateClassificationTemplateRequestBodyScopeField> getScope() { 092 return scope; 093 } 094 095 public EnumWrapper<CreateClassificationTemplateRequestBodyTemplateKeyField> getTemplateKey() { 096 return templateKey; 097 } 098 099 public EnumWrapper<CreateClassificationTemplateRequestBodyDisplayNameField> getDisplayName() { 100 return displayName; 101 } 102 103 public Boolean getHidden() { 104 return hidden; 105 } 106 107 public Boolean getCopyInstanceOnItemCopy() { 108 return copyInstanceOnItemCopy; 109 } 110 111 public List<CreateClassificationTemplateRequestBodyFieldsField> getFields() { 112 return fields; 113 } 114 115 @Override 116 public boolean equals(Object o) { 117 if (this == o) { 118 return true; 119 } 120 if (o == null || getClass() != o.getClass()) { 121 return false; 122 } 123 CreateClassificationTemplateRequestBody casted = (CreateClassificationTemplateRequestBody) o; 124 return Objects.equals(scope, casted.scope) 125 && Objects.equals(templateKey, casted.templateKey) 126 && Objects.equals(displayName, casted.displayName) 127 && Objects.equals(hidden, casted.hidden) 128 && Objects.equals(copyInstanceOnItemCopy, casted.copyInstanceOnItemCopy) 129 && Objects.equals(fields, casted.fields); 130 } 131 132 @Override 133 public int hashCode() { 134 return Objects.hash(scope, templateKey, displayName, hidden, copyInstanceOnItemCopy, fields); 135 } 136 137 @Override 138 public String toString() { 139 return "CreateClassificationTemplateRequestBody{" 140 + "scope='" 141 + scope 142 + '\'' 143 + ", " 144 + "templateKey='" 145 + templateKey 146 + '\'' 147 + ", " 148 + "displayName='" 149 + displayName 150 + '\'' 151 + ", " 152 + "hidden='" 153 + hidden 154 + '\'' 155 + ", " 156 + "copyInstanceOnItemCopy='" 157 + copyInstanceOnItemCopy 158 + '\'' 159 + ", " 160 + "fields='" 161 + fields 162 + '\'' 163 + "}"; 164 } 165 166 public static class Builder extends NullableFieldTracker { 167 168 protected EnumWrapper<CreateClassificationTemplateRequestBodyScopeField> scope; 169 170 protected EnumWrapper<CreateClassificationTemplateRequestBodyTemplateKeyField> templateKey; 171 172 protected EnumWrapper<CreateClassificationTemplateRequestBodyDisplayNameField> displayName; 173 174 protected Boolean hidden; 175 176 protected Boolean copyInstanceOnItemCopy; 177 178 protected final List<CreateClassificationTemplateRequestBodyFieldsField> fields; 179 180 public Builder(List<CreateClassificationTemplateRequestBodyFieldsField> fields) { 181 super(); 182 this.fields = fields; 183 } 184 185 public Builder scope(CreateClassificationTemplateRequestBodyScopeField scope) { 186 this.scope = new EnumWrapper<CreateClassificationTemplateRequestBodyScopeField>(scope); 187 return this; 188 } 189 190 public Builder scope(EnumWrapper<CreateClassificationTemplateRequestBodyScopeField> scope) { 191 this.scope = scope; 192 return this; 193 } 194 195 public Builder templateKey( 196 CreateClassificationTemplateRequestBodyTemplateKeyField templateKey) { 197 this.templateKey = 198 new EnumWrapper<CreateClassificationTemplateRequestBodyTemplateKeyField>(templateKey); 199 return this; 200 } 201 202 public Builder templateKey( 203 EnumWrapper<CreateClassificationTemplateRequestBodyTemplateKeyField> templateKey) { 204 this.templateKey = templateKey; 205 return this; 206 } 207 208 public Builder displayName( 209 CreateClassificationTemplateRequestBodyDisplayNameField displayName) { 210 this.displayName = 211 new EnumWrapper<CreateClassificationTemplateRequestBodyDisplayNameField>(displayName); 212 return this; 213 } 214 215 public Builder displayName( 216 EnumWrapper<CreateClassificationTemplateRequestBodyDisplayNameField> displayName) { 217 this.displayName = displayName; 218 return this; 219 } 220 221 public Builder hidden(Boolean hidden) { 222 this.hidden = hidden; 223 return this; 224 } 225 226 public Builder copyInstanceOnItemCopy(Boolean copyInstanceOnItemCopy) { 227 this.copyInstanceOnItemCopy = copyInstanceOnItemCopy; 228 return this; 229 } 230 231 public CreateClassificationTemplateRequestBody build() { 232 if (this.scope == null) { 233 this.scope = 234 new EnumWrapper<CreateClassificationTemplateRequestBodyScopeField>( 235 CreateClassificationTemplateRequestBodyScopeField.ENTERPRISE); 236 } 237 if (this.templateKey == null) { 238 this.templateKey = 239 new EnumWrapper<CreateClassificationTemplateRequestBodyTemplateKeyField>( 240 CreateClassificationTemplateRequestBodyTemplateKeyField 241 .SECURITYCLASSIFICATION_6VMVOCHWUWO); 242 } 243 if (this.displayName == null) { 244 this.displayName = 245 new EnumWrapper<CreateClassificationTemplateRequestBodyDisplayNameField>( 246 CreateClassificationTemplateRequestBodyDisplayNameField.CLASSIFICATION); 247 } 248 return new CreateClassificationTemplateRequestBody(this); 249 } 250 } 251}