001package com.box.sdkgen.managers.groups; 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.Objects; 011 012@JsonFilter("nullablePropertyFilter") 013public class CreateGroupRequestBody extends SerializableObject { 014 015 /** The name of the new group to be created. This name must be unique within the enterprise. */ 016 protected final String name; 017 018 /** 019 * Keeps track of which external source this group is coming, for example `Active Directory`, or 020 * `Okta`. 021 * 022 * <p>Setting this will also prevent Box admins from editing the group name and its members 023 * directly via the Box web application. 024 * 025 * <p>This is desirable for one-way syncing of groups. 026 */ 027 protected String provenance; 028 029 /** 030 * An arbitrary identifier that can be used by external group sync tools to link this Box Group to 031 * an external group. 032 * 033 * <p>Example values of this field could be an **Active Directory Object ID** or a **Google Group 034 * ID**. 035 * 036 * <p>We recommend you use of this field in order to avoid issues when group names are updated in 037 * either Box or external systems. 038 */ 039 @JsonProperty("external_sync_identifier") 040 protected String externalSyncIdentifier; 041 042 /** A human readable description of the group. */ 043 protected String description; 044 045 /** 046 * Specifies who can invite the group to collaborate on folders. 047 * 048 * <p>When set to `admins_only` the enterprise admin, co-admins, and the group's admin can invite 049 * the group. 050 * 051 * <p>When set to `admins_and_members` all the admins listed above and group members can invite 052 * the group. 053 * 054 * <p>When set to `all_managed_users` all managed users in the enterprise can invite the group. 055 */ 056 @JsonDeserialize( 057 using = 058 CreateGroupRequestBodyInvitabilityLevelField 059 .CreateGroupRequestBodyInvitabilityLevelFieldDeserializer.class) 060 @JsonSerialize( 061 using = 062 CreateGroupRequestBodyInvitabilityLevelField 063 .CreateGroupRequestBodyInvitabilityLevelFieldSerializer.class) 064 @JsonProperty("invitability_level") 065 protected EnumWrapper<CreateGroupRequestBodyInvitabilityLevelField> invitabilityLevel; 066 067 /** 068 * Specifies who can see the members of the group. 069 * 070 * <p>* `admins_only` - the enterprise admin, co-admins, group's group admin. * 071 * `admins_and_members` - all admins and group members. * `all_managed_users` - all managed users 072 * in the enterprise. 073 */ 074 @JsonDeserialize( 075 using = 076 CreateGroupRequestBodyMemberViewabilityLevelField 077 .CreateGroupRequestBodyMemberViewabilityLevelFieldDeserializer.class) 078 @JsonSerialize( 079 using = 080 CreateGroupRequestBodyMemberViewabilityLevelField 081 .CreateGroupRequestBodyMemberViewabilityLevelFieldSerializer.class) 082 @JsonProperty("member_viewability_level") 083 protected EnumWrapper<CreateGroupRequestBodyMemberViewabilityLevelField> memberViewabilityLevel; 084 085 public CreateGroupRequestBody(@JsonProperty("name") String name) { 086 super(); 087 this.name = name; 088 } 089 090 protected CreateGroupRequestBody(Builder builder) { 091 super(); 092 this.name = builder.name; 093 this.provenance = builder.provenance; 094 this.externalSyncIdentifier = builder.externalSyncIdentifier; 095 this.description = builder.description; 096 this.invitabilityLevel = builder.invitabilityLevel; 097 this.memberViewabilityLevel = builder.memberViewabilityLevel; 098 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 099 } 100 101 public String getName() { 102 return name; 103 } 104 105 public String getProvenance() { 106 return provenance; 107 } 108 109 public String getExternalSyncIdentifier() { 110 return externalSyncIdentifier; 111 } 112 113 public String getDescription() { 114 return description; 115 } 116 117 public EnumWrapper<CreateGroupRequestBodyInvitabilityLevelField> getInvitabilityLevel() { 118 return invitabilityLevel; 119 } 120 121 public EnumWrapper<CreateGroupRequestBodyMemberViewabilityLevelField> 122 getMemberViewabilityLevel() { 123 return memberViewabilityLevel; 124 } 125 126 @Override 127 public boolean equals(Object o) { 128 if (this == o) { 129 return true; 130 } 131 if (o == null || getClass() != o.getClass()) { 132 return false; 133 } 134 CreateGroupRequestBody casted = (CreateGroupRequestBody) o; 135 return Objects.equals(name, casted.name) 136 && Objects.equals(provenance, casted.provenance) 137 && Objects.equals(externalSyncIdentifier, casted.externalSyncIdentifier) 138 && Objects.equals(description, casted.description) 139 && Objects.equals(invitabilityLevel, casted.invitabilityLevel) 140 && Objects.equals(memberViewabilityLevel, casted.memberViewabilityLevel); 141 } 142 143 @Override 144 public int hashCode() { 145 return Objects.hash( 146 name, 147 provenance, 148 externalSyncIdentifier, 149 description, 150 invitabilityLevel, 151 memberViewabilityLevel); 152 } 153 154 @Override 155 public String toString() { 156 return "CreateGroupRequestBody{" 157 + "name='" 158 + name 159 + '\'' 160 + ", " 161 + "provenance='" 162 + provenance 163 + '\'' 164 + ", " 165 + "externalSyncIdentifier='" 166 + externalSyncIdentifier 167 + '\'' 168 + ", " 169 + "description='" 170 + description 171 + '\'' 172 + ", " 173 + "invitabilityLevel='" 174 + invitabilityLevel 175 + '\'' 176 + ", " 177 + "memberViewabilityLevel='" 178 + memberViewabilityLevel 179 + '\'' 180 + "}"; 181 } 182 183 public static class Builder extends NullableFieldTracker { 184 185 protected final String name; 186 187 protected String provenance; 188 189 protected String externalSyncIdentifier; 190 191 protected String description; 192 193 protected EnumWrapper<CreateGroupRequestBodyInvitabilityLevelField> invitabilityLevel; 194 195 protected EnumWrapper<CreateGroupRequestBodyMemberViewabilityLevelField> memberViewabilityLevel; 196 197 public Builder(String name) { 198 super(); 199 this.name = name; 200 } 201 202 public Builder provenance(String provenance) { 203 this.provenance = provenance; 204 return this; 205 } 206 207 public Builder externalSyncIdentifier(String externalSyncIdentifier) { 208 this.externalSyncIdentifier = externalSyncIdentifier; 209 return this; 210 } 211 212 public Builder description(String description) { 213 this.description = description; 214 return this; 215 } 216 217 public Builder invitabilityLevel( 218 CreateGroupRequestBodyInvitabilityLevelField invitabilityLevel) { 219 this.invitabilityLevel = 220 new EnumWrapper<CreateGroupRequestBodyInvitabilityLevelField>(invitabilityLevel); 221 return this; 222 } 223 224 public Builder invitabilityLevel( 225 EnumWrapper<CreateGroupRequestBodyInvitabilityLevelField> invitabilityLevel) { 226 this.invitabilityLevel = invitabilityLevel; 227 return this; 228 } 229 230 public Builder memberViewabilityLevel( 231 CreateGroupRequestBodyMemberViewabilityLevelField memberViewabilityLevel) { 232 this.memberViewabilityLevel = 233 new EnumWrapper<CreateGroupRequestBodyMemberViewabilityLevelField>( 234 memberViewabilityLevel); 235 return this; 236 } 237 238 public Builder memberViewabilityLevel( 239 EnumWrapper<CreateGroupRequestBodyMemberViewabilityLevelField> memberViewabilityLevel) { 240 this.memberViewabilityLevel = memberViewabilityLevel; 241 return this; 242 } 243 244 public CreateGroupRequestBody build() { 245 return new CreateGroupRequestBody(this); 246 } 247 } 248}