001package com.box.sdkgen.schemas.signrequestsignerinput;
002
003import com.box.sdkgen.internal.Nullable;
004import com.box.sdkgen.schemas.signrequestprefilltag.SignRequestPrefillTag;
005import com.box.sdkgen.schemas.signrequestsignerinputcustomvalidation.SignRequestSignerInputCustomValidation;
006import com.box.sdkgen.schemas.signrequestsignerinputdateasiavalidation.SignRequestSignerInputDateAsiaValidation;
007import com.box.sdkgen.schemas.signrequestsignerinputdateeuvalidation.SignRequestSignerInputDateEuValidation;
008import com.box.sdkgen.schemas.signrequestsignerinputdateisovalidation.SignRequestSignerInputDateIsoValidation;
009import com.box.sdkgen.schemas.signrequestsignerinputdateusvalidation.SignRequestSignerInputDateUsValidation;
010import com.box.sdkgen.schemas.signrequestsignerinputemailvalidation.SignRequestSignerInputEmailValidation;
011import com.box.sdkgen.schemas.signrequestsignerinputnumberwithcommavalidation.SignRequestSignerInputNumberWithCommaValidation;
012import com.box.sdkgen.schemas.signrequestsignerinputnumberwithperiodvalidation.SignRequestSignerInputNumberWithPeriodValidation;
013import com.box.sdkgen.schemas.signrequestsignerinputssnvalidation.SignRequestSignerInputSsnValidation;
014import com.box.sdkgen.schemas.signrequestsignerinputvalidation.SignRequestSignerInputValidation;
015import com.box.sdkgen.schemas.signrequestsignerinputzip4validation.SignRequestSignerInputZip4Validation;
016import com.box.sdkgen.schemas.signrequestsignerinputzipvalidation.SignRequestSignerInputZipValidation;
017import com.box.sdkgen.serialization.json.EnumWrapper;
018import com.fasterxml.jackson.annotation.JsonFilter;
019import com.fasterxml.jackson.annotation.JsonProperty;
020import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
021import com.fasterxml.jackson.databind.annotation.JsonSerialize;
022import java.time.OffsetDateTime;
023import java.util.Objects;
024
025/** Input created by a Signer on a Sign Request. */
026@JsonFilter("nullablePropertyFilter")
027public class SignRequestSignerInput extends SignRequestPrefillTag {
028
029  /** Type of input. */
030  @JsonDeserialize(
031      using = SignRequestSignerInputTypeField.SignRequestSignerInputTypeFieldDeserializer.class)
032  @JsonSerialize(
033      using = SignRequestSignerInputTypeField.SignRequestSignerInputTypeFieldSerializer.class)
034  protected EnumWrapper<SignRequestSignerInputTypeField> type;
035
036  /** Content type of input. */
037  @JsonDeserialize(
038      using =
039          SignRequestSignerInputContentTypeField.SignRequestSignerInputContentTypeFieldDeserializer
040              .class)
041  @JsonSerialize(
042      using =
043          SignRequestSignerInputContentTypeField.SignRequestSignerInputContentTypeFieldSerializer
044              .class)
045  @JsonProperty("content_type")
046  protected EnumWrapper<SignRequestSignerInputContentTypeField> contentType;
047
048  /** Index of page that the input is on. */
049  @JsonProperty("page_index")
050  protected final long pageIndex;
051
052  /** Indicates whether this input is read-only (cannot be modified by signers). */
053  @JsonProperty("read_only")
054  protected Boolean readOnly;
055
056  /**
057   * Specifies the formatting rules that signers must follow for text field inputs. If set, this
058   * validation is mandatory.
059   */
060  protected SignRequestSignerInputValidation validation;
061
062  /**
063   * The reason for the signer's input, applicable to signature or initial content types in a
064   * `cfr11` request flow. The value is `null` when not applicable.
065   */
066  @Nullable protected String reason;
067
068  /**
069   * Indicates whether the signer's input has been validated through re-authentication. Applicable
070   * only for signature or initial content types in a `cfr11` request flow. The value is `null` for
071   * standard request flows or non-applicable input types.
072   */
073  @JsonProperty("is_validated")
074  @Nullable
075  protected Boolean isValidated;
076
077  public SignRequestSignerInput(@JsonProperty("page_index") long pageIndex) {
078    super();
079    this.pageIndex = pageIndex;
080  }
081
082  protected SignRequestSignerInput(Builder builder) {
083    super(builder);
084    this.type = builder.type;
085    this.contentType = builder.contentType;
086    this.pageIndex = builder.pageIndex;
087    this.readOnly = builder.readOnly;
088    this.validation = builder.validation;
089    this.reason = builder.reason;
090    this.isValidated = builder.isValidated;
091    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
092  }
093
094  public EnumWrapper<SignRequestSignerInputTypeField> getType() {
095    return type;
096  }
097
098  public EnumWrapper<SignRequestSignerInputContentTypeField> getContentType() {
099    return contentType;
100  }
101
102  public long getPageIndex() {
103    return pageIndex;
104  }
105
106  public Boolean getReadOnly() {
107    return readOnly;
108  }
109
110  public SignRequestSignerInputValidation getValidation() {
111    return validation;
112  }
113
114  public String getReason() {
115    return reason;
116  }
117
118  public Boolean getIsValidated() {
119    return isValidated;
120  }
121
122  @Override
123  public boolean equals(Object o) {
124    if (this == o) {
125      return true;
126    }
127    if (o == null || getClass() != o.getClass()) {
128      return false;
129    }
130    SignRequestSignerInput casted = (SignRequestSignerInput) o;
131    return Objects.equals(documentTagId, casted.documentTagId)
132        && Objects.equals(textValue, casted.textValue)
133        && Objects.equals(checkboxValue, casted.checkboxValue)
134        && Objects.equals(dateValue, casted.dateValue)
135        && Objects.equals(type, casted.type)
136        && Objects.equals(contentType, casted.contentType)
137        && Objects.equals(pageIndex, casted.pageIndex)
138        && Objects.equals(readOnly, casted.readOnly)
139        && Objects.equals(validation, casted.validation)
140        && Objects.equals(reason, casted.reason)
141        && Objects.equals(isValidated, casted.isValidated);
142  }
143
144  @Override
145  public int hashCode() {
146    return Objects.hash(
147        documentTagId,
148        textValue,
149        checkboxValue,
150        dateValue,
151        type,
152        contentType,
153        pageIndex,
154        readOnly,
155        validation,
156        reason,
157        isValidated);
158  }
159
160  @Override
161  public String toString() {
162    return "SignRequestSignerInput{"
163        + "documentTagId='"
164        + documentTagId
165        + '\''
166        + ", "
167        + "textValue='"
168        + textValue
169        + '\''
170        + ", "
171        + "checkboxValue='"
172        + checkboxValue
173        + '\''
174        + ", "
175        + "dateValue='"
176        + dateValue
177        + '\''
178        + ", "
179        + "type='"
180        + type
181        + '\''
182        + ", "
183        + "contentType='"
184        + contentType
185        + '\''
186        + ", "
187        + "pageIndex='"
188        + pageIndex
189        + '\''
190        + ", "
191        + "readOnly='"
192        + readOnly
193        + '\''
194        + ", "
195        + "validation='"
196        + validation
197        + '\''
198        + ", "
199        + "reason='"
200        + reason
201        + '\''
202        + ", "
203        + "isValidated='"
204        + isValidated
205        + '\''
206        + "}";
207  }
208
209  public static class Builder extends SignRequestPrefillTag.Builder {
210
211    protected EnumWrapper<SignRequestSignerInputTypeField> type;
212
213    protected EnumWrapper<SignRequestSignerInputContentTypeField> contentType;
214
215    protected final long pageIndex;
216
217    protected Boolean readOnly;
218
219    protected SignRequestSignerInputValidation validation;
220
221    protected String reason;
222
223    protected Boolean isValidated;
224
225    public Builder(long pageIndex) {
226      super();
227      this.pageIndex = pageIndex;
228    }
229
230    public Builder type(SignRequestSignerInputTypeField type) {
231      this.type = new EnumWrapper<SignRequestSignerInputTypeField>(type);
232      return this;
233    }
234
235    public Builder type(EnumWrapper<SignRequestSignerInputTypeField> type) {
236      this.type = type;
237      return this;
238    }
239
240    public Builder contentType(SignRequestSignerInputContentTypeField contentType) {
241      this.contentType = new EnumWrapper<SignRequestSignerInputContentTypeField>(contentType);
242      return this;
243    }
244
245    public Builder contentType(EnumWrapper<SignRequestSignerInputContentTypeField> contentType) {
246      this.contentType = contentType;
247      return this;
248    }
249
250    public Builder readOnly(Boolean readOnly) {
251      this.readOnly = readOnly;
252      return this;
253    }
254
255    public Builder validation(SignRequestSignerInputEmailValidation validation) {
256      this.validation = new SignRequestSignerInputValidation(validation);
257      return this;
258    }
259
260    public Builder validation(SignRequestSignerInputCustomValidation validation) {
261      this.validation = new SignRequestSignerInputValidation(validation);
262      return this;
263    }
264
265    public Builder validation(SignRequestSignerInputZipValidation validation) {
266      this.validation = new SignRequestSignerInputValidation(validation);
267      return this;
268    }
269
270    public Builder validation(SignRequestSignerInputZip4Validation validation) {
271      this.validation = new SignRequestSignerInputValidation(validation);
272      return this;
273    }
274
275    public Builder validation(SignRequestSignerInputSsnValidation validation) {
276      this.validation = new SignRequestSignerInputValidation(validation);
277      return this;
278    }
279
280    public Builder validation(SignRequestSignerInputNumberWithPeriodValidation validation) {
281      this.validation = new SignRequestSignerInputValidation(validation);
282      return this;
283    }
284
285    public Builder validation(SignRequestSignerInputNumberWithCommaValidation validation) {
286      this.validation = new SignRequestSignerInputValidation(validation);
287      return this;
288    }
289
290    public Builder validation(SignRequestSignerInputDateIsoValidation validation) {
291      this.validation = new SignRequestSignerInputValidation(validation);
292      return this;
293    }
294
295    public Builder validation(SignRequestSignerInputDateUsValidation validation) {
296      this.validation = new SignRequestSignerInputValidation(validation);
297      return this;
298    }
299
300    public Builder validation(SignRequestSignerInputDateEuValidation validation) {
301      this.validation = new SignRequestSignerInputValidation(validation);
302      return this;
303    }
304
305    public Builder validation(SignRequestSignerInputDateAsiaValidation validation) {
306      this.validation = new SignRequestSignerInputValidation(validation);
307      return this;
308    }
309
310    public Builder validation(SignRequestSignerInputValidation validation) {
311      this.validation = validation;
312      return this;
313    }
314
315    public Builder reason(String reason) {
316      this.reason = reason;
317      this.markNullableFieldAsSet("reason");
318      return this;
319    }
320
321    public Builder isValidated(Boolean isValidated) {
322      this.isValidated = isValidated;
323      this.markNullableFieldAsSet("is_validated");
324      return this;
325    }
326
327    @Override
328    public Builder documentTagId(String documentTagId) {
329      this.documentTagId = documentTagId;
330      this.markNullableFieldAsSet("document_tag_id");
331      return this;
332    }
333
334    @Override
335    public Builder textValue(String textValue) {
336      this.textValue = textValue;
337      this.markNullableFieldAsSet("text_value");
338      return this;
339    }
340
341    @Override
342    public Builder checkboxValue(Boolean checkboxValue) {
343      this.checkboxValue = checkboxValue;
344      this.markNullableFieldAsSet("checkbox_value");
345      return this;
346    }
347
348    @Override
349    public Builder dateValue(OffsetDateTime dateValue) {
350      this.dateValue = dateValue;
351      this.markNullableFieldAsSet("date_value");
352      return this;
353    }
354
355    public SignRequestSignerInput build() {
356      return new SignRequestSignerInput(this);
357    }
358  }
359}