001package com.box.sdkgen.schemas.signrequestprefilltag;
002
003import com.box.sdkgen.internal.Nullable;
004import com.box.sdkgen.internal.NullableFieldTracker;
005import com.box.sdkgen.internal.SerializableObject;
006import com.box.sdkgen.internal.utils.DateUtils;
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.time.OffsetDateTime;
012import java.util.Objects;
013
014/**
015 * Prefill tags are used to prefill placeholders with signer input data. Only one value field can be
016 * included.
017 */
018@JsonFilter("nullablePropertyFilter")
019public class SignRequestPrefillTag extends SerializableObject {
020
021  /** This references the ID of a specific tag contained in a file of the signature request. */
022  @JsonProperty("document_tag_id")
023  @Nullable
024  protected String documentTagId;
025
026  /** Text prefill value. */
027  @JsonProperty("text_value")
028  @Nullable
029  protected String textValue;
030
031  /** Checkbox prefill value. */
032  @JsonProperty("checkbox_value")
033  @Nullable
034  protected Boolean checkboxValue;
035
036  /** Date prefill value. */
037  @JsonProperty("date_value")
038  @JsonSerialize(using = DateUtils.DateSerializer.class)
039  @JsonDeserialize(using = DateUtils.DateDeserializer.class)
040  @Nullable
041  protected OffsetDateTime dateValue;
042
043  public SignRequestPrefillTag() {
044    super();
045  }
046
047  protected SignRequestPrefillTag(Builder builder) {
048    super();
049    this.documentTagId = builder.documentTagId;
050    this.textValue = builder.textValue;
051    this.checkboxValue = builder.checkboxValue;
052    this.dateValue = builder.dateValue;
053    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
054  }
055
056  public String getDocumentTagId() {
057    return documentTagId;
058  }
059
060  public String getTextValue() {
061    return textValue;
062  }
063
064  public Boolean getCheckboxValue() {
065    return checkboxValue;
066  }
067
068  public OffsetDateTime getDateValue() {
069    return dateValue;
070  }
071
072  @Override
073  public boolean equals(Object o) {
074    if (this == o) {
075      return true;
076    }
077    if (o == null || getClass() != o.getClass()) {
078      return false;
079    }
080    SignRequestPrefillTag casted = (SignRequestPrefillTag) o;
081    return Objects.equals(documentTagId, casted.documentTagId)
082        && Objects.equals(textValue, casted.textValue)
083        && Objects.equals(checkboxValue, casted.checkboxValue)
084        && Objects.equals(dateValue, casted.dateValue);
085  }
086
087  @Override
088  public int hashCode() {
089    return Objects.hash(documentTagId, textValue, checkboxValue, dateValue);
090  }
091
092  @Override
093  public String toString() {
094    return "SignRequestPrefillTag{"
095        + "documentTagId='"
096        + documentTagId
097        + '\''
098        + ", "
099        + "textValue='"
100        + textValue
101        + '\''
102        + ", "
103        + "checkboxValue='"
104        + checkboxValue
105        + '\''
106        + ", "
107        + "dateValue='"
108        + dateValue
109        + '\''
110        + "}";
111  }
112
113  public static class Builder extends NullableFieldTracker {
114
115    protected String documentTagId;
116
117    protected String textValue;
118
119    protected Boolean checkboxValue;
120
121    protected OffsetDateTime dateValue;
122
123    public Builder documentTagId(String documentTagId) {
124      this.documentTagId = documentTagId;
125      this.markNullableFieldAsSet("document_tag_id");
126      return this;
127    }
128
129    public Builder textValue(String textValue) {
130      this.textValue = textValue;
131      this.markNullableFieldAsSet("text_value");
132      return this;
133    }
134
135    public Builder checkboxValue(Boolean checkboxValue) {
136      this.checkboxValue = checkboxValue;
137      this.markNullableFieldAsSet("checkbox_value");
138      return this;
139    }
140
141    public Builder dateValue(OffsetDateTime dateValue) {
142      this.dateValue = dateValue;
143      this.markNullableFieldAsSet("date_value");
144      return this;
145    }
146
147    public SignRequestPrefillTag build() {
148      return new SignRequestPrefillTag(this);
149    }
150  }
151}