001package com.box.sdkgen.managers.users; 002 003import com.box.sdkgen.internal.NullableFieldTracker; 004import com.box.sdkgen.internal.SerializableObject; 005import com.box.sdkgen.schemas.trackingcode.TrackingCode; 006import com.box.sdkgen.serialization.json.EnumWrapper; 007import com.fasterxml.jackson.annotation.JsonFilter; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 010import com.fasterxml.jackson.databind.annotation.JsonSerialize; 011import java.util.List; 012import java.util.Objects; 013 014@JsonFilter("nullablePropertyFilter") 015public class CreateUserRequestBody extends SerializableObject { 016 017 /** The name of the user. */ 018 protected final String name; 019 020 /** 021 * The email address the user uses to log in 022 * 023 * <p>Required, unless `is_platform_access_only` is set to `true`. 024 */ 025 protected String login; 026 027 /** Specifies that the user is an app user. */ 028 @JsonProperty("is_platform_access_only") 029 protected Boolean isPlatformAccessOnly; 030 031 /** The user’s enterprise role. */ 032 @JsonDeserialize( 033 using = CreateUserRequestBodyRoleField.CreateUserRequestBodyRoleFieldDeserializer.class) 034 @JsonSerialize( 035 using = CreateUserRequestBodyRoleField.CreateUserRequestBodyRoleFieldSerializer.class) 036 protected EnumWrapper<CreateUserRequestBodyRoleField> role; 037 038 /** 039 * The language of the user, formatted in modified version of the [ISO 040 * 639-1](https://developer.box.com/guides/api-calls/language-codes) format. 041 */ 042 protected String language; 043 044 /** Whether the user can use Box Sync. */ 045 @JsonProperty("is_sync_enabled") 046 protected Boolean isSyncEnabled; 047 048 /** The user’s job title. */ 049 @JsonProperty("job_title") 050 protected String jobTitle; 051 052 /** The user’s phone number. */ 053 protected String phone; 054 055 /** The user’s address. */ 056 protected String address; 057 058 /** The user’s total available space in bytes. Set this to `-1` to indicate unlimited storage. */ 059 @JsonProperty("space_amount") 060 protected Long spaceAmount; 061 062 /** 063 * Tracking codes allow an admin to generate reports from the admin console and assign an 064 * attribute to a specific group of users. This setting must be enabled for an enterprise before 065 * it can be used. 066 */ 067 @JsonProperty("tracking_codes") 068 protected List<TrackingCode> trackingCodes; 069 070 /** Whether the user can see other enterprise users in their contact list. */ 071 @JsonProperty("can_see_managed_users") 072 protected Boolean canSeeManagedUsers; 073 074 /** The user's timezone. */ 075 protected String timezone; 076 077 /** Whether the user is allowed to collaborate with users outside their enterprise. */ 078 @JsonProperty("is_external_collab_restricted") 079 protected Boolean isExternalCollabRestricted; 080 081 /** Whether to exempt the user from enterprise device limits. */ 082 @JsonProperty("is_exempt_from_device_limits") 083 protected Boolean isExemptFromDeviceLimits; 084 085 /** Whether the user must use two-factor authentication. */ 086 @JsonProperty("is_exempt_from_login_verification") 087 protected Boolean isExemptFromLoginVerification; 088 089 /** The user's account status. */ 090 @JsonDeserialize( 091 using = CreateUserRequestBodyStatusField.CreateUserRequestBodyStatusFieldDeserializer.class) 092 @JsonSerialize( 093 using = CreateUserRequestBodyStatusField.CreateUserRequestBodyStatusFieldSerializer.class) 094 protected EnumWrapper<CreateUserRequestBodyStatusField> status; 095 096 /** 097 * An external identifier for an app user, which can be used to look up the user. This can be used 098 * to tie user IDs from external identity providers to Box users. 099 */ 100 @JsonProperty("external_app_user_id") 101 protected String externalAppUserId; 102 103 public CreateUserRequestBody(@JsonProperty("name") String name) { 104 super(); 105 this.name = name; 106 } 107 108 protected CreateUserRequestBody(Builder builder) { 109 super(); 110 this.name = builder.name; 111 this.login = builder.login; 112 this.isPlatformAccessOnly = builder.isPlatformAccessOnly; 113 this.role = builder.role; 114 this.language = builder.language; 115 this.isSyncEnabled = builder.isSyncEnabled; 116 this.jobTitle = builder.jobTitle; 117 this.phone = builder.phone; 118 this.address = builder.address; 119 this.spaceAmount = builder.spaceAmount; 120 this.trackingCodes = builder.trackingCodes; 121 this.canSeeManagedUsers = builder.canSeeManagedUsers; 122 this.timezone = builder.timezone; 123 this.isExternalCollabRestricted = builder.isExternalCollabRestricted; 124 this.isExemptFromDeviceLimits = builder.isExemptFromDeviceLimits; 125 this.isExemptFromLoginVerification = builder.isExemptFromLoginVerification; 126 this.status = builder.status; 127 this.externalAppUserId = builder.externalAppUserId; 128 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 129 } 130 131 public String getName() { 132 return name; 133 } 134 135 public String getLogin() { 136 return login; 137 } 138 139 public Boolean getIsPlatformAccessOnly() { 140 return isPlatformAccessOnly; 141 } 142 143 public EnumWrapper<CreateUserRequestBodyRoleField> getRole() { 144 return role; 145 } 146 147 public String getLanguage() { 148 return language; 149 } 150 151 public Boolean getIsSyncEnabled() { 152 return isSyncEnabled; 153 } 154 155 public String getJobTitle() { 156 return jobTitle; 157 } 158 159 public String getPhone() { 160 return phone; 161 } 162 163 public String getAddress() { 164 return address; 165 } 166 167 public Long getSpaceAmount() { 168 return spaceAmount; 169 } 170 171 public List<TrackingCode> getTrackingCodes() { 172 return trackingCodes; 173 } 174 175 public Boolean getCanSeeManagedUsers() { 176 return canSeeManagedUsers; 177 } 178 179 public String getTimezone() { 180 return timezone; 181 } 182 183 public Boolean getIsExternalCollabRestricted() { 184 return isExternalCollabRestricted; 185 } 186 187 public Boolean getIsExemptFromDeviceLimits() { 188 return isExemptFromDeviceLimits; 189 } 190 191 public Boolean getIsExemptFromLoginVerification() { 192 return isExemptFromLoginVerification; 193 } 194 195 public EnumWrapper<CreateUserRequestBodyStatusField> getStatus() { 196 return status; 197 } 198 199 public String getExternalAppUserId() { 200 return externalAppUserId; 201 } 202 203 @Override 204 public boolean equals(Object o) { 205 if (this == o) { 206 return true; 207 } 208 if (o == null || getClass() != o.getClass()) { 209 return false; 210 } 211 CreateUserRequestBody casted = (CreateUserRequestBody) o; 212 return Objects.equals(name, casted.name) 213 && Objects.equals(login, casted.login) 214 && Objects.equals(isPlatformAccessOnly, casted.isPlatformAccessOnly) 215 && Objects.equals(role, casted.role) 216 && Objects.equals(language, casted.language) 217 && Objects.equals(isSyncEnabled, casted.isSyncEnabled) 218 && Objects.equals(jobTitle, casted.jobTitle) 219 && Objects.equals(phone, casted.phone) 220 && Objects.equals(address, casted.address) 221 && Objects.equals(spaceAmount, casted.spaceAmount) 222 && Objects.equals(trackingCodes, casted.trackingCodes) 223 && Objects.equals(canSeeManagedUsers, casted.canSeeManagedUsers) 224 && Objects.equals(timezone, casted.timezone) 225 && Objects.equals(isExternalCollabRestricted, casted.isExternalCollabRestricted) 226 && Objects.equals(isExemptFromDeviceLimits, casted.isExemptFromDeviceLimits) 227 && Objects.equals(isExemptFromLoginVerification, casted.isExemptFromLoginVerification) 228 && Objects.equals(status, casted.status) 229 && Objects.equals(externalAppUserId, casted.externalAppUserId); 230 } 231 232 @Override 233 public int hashCode() { 234 return Objects.hash( 235 name, 236 login, 237 isPlatformAccessOnly, 238 role, 239 language, 240 isSyncEnabled, 241 jobTitle, 242 phone, 243 address, 244 spaceAmount, 245 trackingCodes, 246 canSeeManagedUsers, 247 timezone, 248 isExternalCollabRestricted, 249 isExemptFromDeviceLimits, 250 isExemptFromLoginVerification, 251 status, 252 externalAppUserId); 253 } 254 255 @Override 256 public String toString() { 257 return "CreateUserRequestBody{" 258 + "name='" 259 + name 260 + '\'' 261 + ", " 262 + "login='" 263 + login 264 + '\'' 265 + ", " 266 + "isPlatformAccessOnly='" 267 + isPlatformAccessOnly 268 + '\'' 269 + ", " 270 + "role='" 271 + role 272 + '\'' 273 + ", " 274 + "language='" 275 + language 276 + '\'' 277 + ", " 278 + "isSyncEnabled='" 279 + isSyncEnabled 280 + '\'' 281 + ", " 282 + "jobTitle='" 283 + jobTitle 284 + '\'' 285 + ", " 286 + "phone='" 287 + phone 288 + '\'' 289 + ", " 290 + "address='" 291 + address 292 + '\'' 293 + ", " 294 + "spaceAmount='" 295 + spaceAmount 296 + '\'' 297 + ", " 298 + "trackingCodes='" 299 + trackingCodes 300 + '\'' 301 + ", " 302 + "canSeeManagedUsers='" 303 + canSeeManagedUsers 304 + '\'' 305 + ", " 306 + "timezone='" 307 + timezone 308 + '\'' 309 + ", " 310 + "isExternalCollabRestricted='" 311 + isExternalCollabRestricted 312 + '\'' 313 + ", " 314 + "isExemptFromDeviceLimits='" 315 + isExemptFromDeviceLimits 316 + '\'' 317 + ", " 318 + "isExemptFromLoginVerification='" 319 + isExemptFromLoginVerification 320 + '\'' 321 + ", " 322 + "status='" 323 + status 324 + '\'' 325 + ", " 326 + "externalAppUserId='" 327 + externalAppUserId 328 + '\'' 329 + "}"; 330 } 331 332 public static class Builder extends NullableFieldTracker { 333 334 protected final String name; 335 336 protected String login; 337 338 protected Boolean isPlatformAccessOnly; 339 340 protected EnumWrapper<CreateUserRequestBodyRoleField> role; 341 342 protected String language; 343 344 protected Boolean isSyncEnabled; 345 346 protected String jobTitle; 347 348 protected String phone; 349 350 protected String address; 351 352 protected Long spaceAmount; 353 354 protected List<TrackingCode> trackingCodes; 355 356 protected Boolean canSeeManagedUsers; 357 358 protected String timezone; 359 360 protected Boolean isExternalCollabRestricted; 361 362 protected Boolean isExemptFromDeviceLimits; 363 364 protected Boolean isExemptFromLoginVerification; 365 366 protected EnumWrapper<CreateUserRequestBodyStatusField> status; 367 368 protected String externalAppUserId; 369 370 public Builder(String name) { 371 super(); 372 this.name = name; 373 } 374 375 public Builder login(String login) { 376 this.login = login; 377 return this; 378 } 379 380 public Builder isPlatformAccessOnly(Boolean isPlatformAccessOnly) { 381 this.isPlatformAccessOnly = isPlatformAccessOnly; 382 return this; 383 } 384 385 public Builder role(CreateUserRequestBodyRoleField role) { 386 this.role = new EnumWrapper<CreateUserRequestBodyRoleField>(role); 387 return this; 388 } 389 390 public Builder role(EnumWrapper<CreateUserRequestBodyRoleField> role) { 391 this.role = role; 392 return this; 393 } 394 395 public Builder language(String language) { 396 this.language = language; 397 return this; 398 } 399 400 public Builder isSyncEnabled(Boolean isSyncEnabled) { 401 this.isSyncEnabled = isSyncEnabled; 402 return this; 403 } 404 405 public Builder jobTitle(String jobTitle) { 406 this.jobTitle = jobTitle; 407 return this; 408 } 409 410 public Builder phone(String phone) { 411 this.phone = phone; 412 return this; 413 } 414 415 public Builder address(String address) { 416 this.address = address; 417 return this; 418 } 419 420 public Builder spaceAmount(Long spaceAmount) { 421 this.spaceAmount = spaceAmount; 422 return this; 423 } 424 425 public Builder trackingCodes(List<TrackingCode> trackingCodes) { 426 this.trackingCodes = trackingCodes; 427 return this; 428 } 429 430 public Builder canSeeManagedUsers(Boolean canSeeManagedUsers) { 431 this.canSeeManagedUsers = canSeeManagedUsers; 432 return this; 433 } 434 435 public Builder timezone(String timezone) { 436 this.timezone = timezone; 437 return this; 438 } 439 440 public Builder isExternalCollabRestricted(Boolean isExternalCollabRestricted) { 441 this.isExternalCollabRestricted = isExternalCollabRestricted; 442 return this; 443 } 444 445 public Builder isExemptFromDeviceLimits(Boolean isExemptFromDeviceLimits) { 446 this.isExemptFromDeviceLimits = isExemptFromDeviceLimits; 447 return this; 448 } 449 450 public Builder isExemptFromLoginVerification(Boolean isExemptFromLoginVerification) { 451 this.isExemptFromLoginVerification = isExemptFromLoginVerification; 452 return this; 453 } 454 455 public Builder status(CreateUserRequestBodyStatusField status) { 456 this.status = new EnumWrapper<CreateUserRequestBodyStatusField>(status); 457 return this; 458 } 459 460 public Builder status(EnumWrapper<CreateUserRequestBodyStatusField> status) { 461 this.status = status; 462 return this; 463 } 464 465 public Builder externalAppUserId(String externalAppUserId) { 466 this.externalAppUserId = externalAppUserId; 467 return this; 468 } 469 470 public CreateUserRequestBody build() { 471 return new CreateUserRequestBody(this); 472 } 473 } 474}