001package com.box.sdkgen.schemas.templatesigner; 002 003import com.box.sdkgen.internal.Nullable; 004import com.box.sdkgen.internal.NullableFieldTracker; 005import com.box.sdkgen.internal.SerializableObject; 006import com.box.sdkgen.schemas.templatesignerinput.TemplateSignerInput; 007import com.box.sdkgen.serialization.json.EnumWrapper; 008import com.fasterxml.jackson.annotation.JsonFilter; 009import com.fasterxml.jackson.annotation.JsonProperty; 010import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 011import com.fasterxml.jackson.databind.annotation.JsonSerialize; 012import java.util.List; 013import java.util.Objects; 014 015/** The schema for a Signer for Templates. */ 016@JsonFilter("nullablePropertyFilter") 017public class TemplateSigner extends SerializableObject { 018 019 protected List<TemplateSignerInput> inputs; 020 021 /** Email address of the signer. */ 022 @Nullable protected String email; 023 024 /** 025 * Defines the role of the signer in the signature request. A role of `signer` needs to sign the 026 * document, a role `approver` approves the document and a `final_copy_reader` role only receives 027 * the final signed document and signing log. 028 */ 029 @JsonDeserialize(using = TemplateSignerRoleField.TemplateSignerRoleFieldDeserializer.class) 030 @JsonSerialize(using = TemplateSignerRoleField.TemplateSignerRoleFieldSerializer.class) 031 protected EnumWrapper<TemplateSignerRoleField> role; 032 033 /** 034 * Used in combination with an embed URL for a sender. After the sender signs, they will be 035 * redirected to the next `in_person` signer. 036 */ 037 @JsonProperty("is_in_person") 038 protected Boolean isInPerson; 039 040 /** Order of the signer. */ 041 protected Long order; 042 043 /** 044 * If provided, this value points signers that are assigned the same inputs and belongs to same 045 * signer group. A signer group is not a Box Group. It is an entity that belongs to the template 046 * itself and can only be used within Box Sign requests created from it. 047 */ 048 @JsonProperty("signer_group_id") 049 @Nullable 050 protected String signerGroupId; 051 052 /** 053 * A placeholder label for the signer set by the template creator to differentiate between 054 * signers. 055 */ 056 @Nullable protected String label; 057 058 /** An identifier for the signer. This can be used to identify a signer within the template. */ 059 @JsonProperty("public_id") 060 protected String publicId; 061 062 /** 063 * If true for signers with a defined email, the password provided when the template was created 064 * is used by default. If true for signers without a specified / defined email, the creator needs 065 * to provide a password when using the template. 066 */ 067 @JsonProperty("is_password_required") 068 @Nullable 069 protected Boolean isPasswordRequired; 070 071 /** 072 * If true for signers with a defined email, the phone number provided when the template was 073 * created is used by default. If true for signers without a specified / defined email, the 074 * template creator needs to provide a phone number when creating a request. 075 */ 076 @JsonProperty("is_phone_number_required") 077 @Nullable 078 protected Boolean isPhoneNumberRequired; 079 080 /** If true, the signer is required to login to access the document. */ 081 @JsonProperty("login_required") 082 @Nullable 083 protected Boolean loginRequired; 084 085 public TemplateSigner() { 086 super(); 087 } 088 089 protected TemplateSigner(Builder builder) { 090 super(); 091 this.inputs = builder.inputs; 092 this.email = builder.email; 093 this.role = builder.role; 094 this.isInPerson = builder.isInPerson; 095 this.order = builder.order; 096 this.signerGroupId = builder.signerGroupId; 097 this.label = builder.label; 098 this.publicId = builder.publicId; 099 this.isPasswordRequired = builder.isPasswordRequired; 100 this.isPhoneNumberRequired = builder.isPhoneNumberRequired; 101 this.loginRequired = builder.loginRequired; 102 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 103 } 104 105 public List<TemplateSignerInput> getInputs() { 106 return inputs; 107 } 108 109 public String getEmail() { 110 return email; 111 } 112 113 public EnumWrapper<TemplateSignerRoleField> getRole() { 114 return role; 115 } 116 117 public Boolean getIsInPerson() { 118 return isInPerson; 119 } 120 121 public Long getOrder() { 122 return order; 123 } 124 125 public String getSignerGroupId() { 126 return signerGroupId; 127 } 128 129 public String getLabel() { 130 return label; 131 } 132 133 public String getPublicId() { 134 return publicId; 135 } 136 137 public Boolean getIsPasswordRequired() { 138 return isPasswordRequired; 139 } 140 141 public Boolean getIsPhoneNumberRequired() { 142 return isPhoneNumberRequired; 143 } 144 145 public Boolean getLoginRequired() { 146 return loginRequired; 147 } 148 149 @Override 150 public boolean equals(Object o) { 151 if (this == o) { 152 return true; 153 } 154 if (o == null || getClass() != o.getClass()) { 155 return false; 156 } 157 TemplateSigner casted = (TemplateSigner) o; 158 return Objects.equals(inputs, casted.inputs) 159 && Objects.equals(email, casted.email) 160 && Objects.equals(role, casted.role) 161 && Objects.equals(isInPerson, casted.isInPerson) 162 && Objects.equals(order, casted.order) 163 && Objects.equals(signerGroupId, casted.signerGroupId) 164 && Objects.equals(label, casted.label) 165 && Objects.equals(publicId, casted.publicId) 166 && Objects.equals(isPasswordRequired, casted.isPasswordRequired) 167 && Objects.equals(isPhoneNumberRequired, casted.isPhoneNumberRequired) 168 && Objects.equals(loginRequired, casted.loginRequired); 169 } 170 171 @Override 172 public int hashCode() { 173 return Objects.hash( 174 inputs, 175 email, 176 role, 177 isInPerson, 178 order, 179 signerGroupId, 180 label, 181 publicId, 182 isPasswordRequired, 183 isPhoneNumberRequired, 184 loginRequired); 185 } 186 187 @Override 188 public String toString() { 189 return "TemplateSigner{" 190 + "inputs='" 191 + inputs 192 + '\'' 193 + ", " 194 + "email='" 195 + email 196 + '\'' 197 + ", " 198 + "role='" 199 + role 200 + '\'' 201 + ", " 202 + "isInPerson='" 203 + isInPerson 204 + '\'' 205 + ", " 206 + "order='" 207 + order 208 + '\'' 209 + ", " 210 + "signerGroupId='" 211 + signerGroupId 212 + '\'' 213 + ", " 214 + "label='" 215 + label 216 + '\'' 217 + ", " 218 + "publicId='" 219 + publicId 220 + '\'' 221 + ", " 222 + "isPasswordRequired='" 223 + isPasswordRequired 224 + '\'' 225 + ", " 226 + "isPhoneNumberRequired='" 227 + isPhoneNumberRequired 228 + '\'' 229 + ", " 230 + "loginRequired='" 231 + loginRequired 232 + '\'' 233 + "}"; 234 } 235 236 public static class Builder extends NullableFieldTracker { 237 238 protected List<TemplateSignerInput> inputs; 239 240 protected String email; 241 242 protected EnumWrapper<TemplateSignerRoleField> role; 243 244 protected Boolean isInPerson; 245 246 protected Long order; 247 248 protected String signerGroupId; 249 250 protected String label; 251 252 protected String publicId; 253 254 protected Boolean isPasswordRequired; 255 256 protected Boolean isPhoneNumberRequired; 257 258 protected Boolean loginRequired; 259 260 public Builder inputs(List<TemplateSignerInput> inputs) { 261 this.inputs = inputs; 262 return this; 263 } 264 265 public Builder email(String email) { 266 this.email = email; 267 this.markNullableFieldAsSet("email"); 268 return this; 269 } 270 271 public Builder role(TemplateSignerRoleField role) { 272 this.role = new EnumWrapper<TemplateSignerRoleField>(role); 273 return this; 274 } 275 276 public Builder role(EnumWrapper<TemplateSignerRoleField> role) { 277 this.role = role; 278 return this; 279 } 280 281 public Builder isInPerson(Boolean isInPerson) { 282 this.isInPerson = isInPerson; 283 return this; 284 } 285 286 public Builder order(Long order) { 287 this.order = order; 288 return this; 289 } 290 291 public Builder signerGroupId(String signerGroupId) { 292 this.signerGroupId = signerGroupId; 293 this.markNullableFieldAsSet("signer_group_id"); 294 return this; 295 } 296 297 public Builder label(String label) { 298 this.label = label; 299 this.markNullableFieldAsSet("label"); 300 return this; 301 } 302 303 public Builder publicId(String publicId) { 304 this.publicId = publicId; 305 return this; 306 } 307 308 public Builder isPasswordRequired(Boolean isPasswordRequired) { 309 this.isPasswordRequired = isPasswordRequired; 310 this.markNullableFieldAsSet("is_password_required"); 311 return this; 312 } 313 314 public Builder isPhoneNumberRequired(Boolean isPhoneNumberRequired) { 315 this.isPhoneNumberRequired = isPhoneNumberRequired; 316 this.markNullableFieldAsSet("is_phone_number_required"); 317 return this; 318 } 319 320 public Builder loginRequired(Boolean loginRequired) { 321 this.loginRequired = loginRequired; 322 this.markNullableFieldAsSet("login_required"); 323 return this; 324 } 325 326 public TemplateSigner build() { 327 return new TemplateSigner(this); 328 } 329 } 330}