001package com.box.sdkgen.schemas.termsofservicebase;
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/** The root-level record that is supposed to represent a single Terms of Service. */
013@JsonFilter("nullablePropertyFilter")
014public class TermsOfServiceBase extends SerializableObject {
015
016  /** The unique identifier for this terms of service. */
017  protected final String id;
018
019  /** The value will always be `terms_of_service`. */
020  @JsonDeserialize(
021      using = TermsOfServiceBaseTypeField.TermsOfServiceBaseTypeFieldDeserializer.class)
022  @JsonSerialize(using = TermsOfServiceBaseTypeField.TermsOfServiceBaseTypeFieldSerializer.class)
023  protected EnumWrapper<TermsOfServiceBaseTypeField> type;
024
025  public TermsOfServiceBase(@JsonProperty("id") String id) {
026    super();
027    this.id = id;
028    this.type =
029        new EnumWrapper<TermsOfServiceBaseTypeField>(TermsOfServiceBaseTypeField.TERMS_OF_SERVICE);
030  }
031
032  protected TermsOfServiceBase(Builder builder) {
033    super();
034    this.id = builder.id;
035    this.type = builder.type;
036    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
037  }
038
039  public String getId() {
040    return id;
041  }
042
043  public EnumWrapper<TermsOfServiceBaseTypeField> getType() {
044    return type;
045  }
046
047  @Override
048  public boolean equals(Object o) {
049    if (this == o) {
050      return true;
051    }
052    if (o == null || getClass() != o.getClass()) {
053      return false;
054    }
055    TermsOfServiceBase casted = (TermsOfServiceBase) o;
056    return Objects.equals(id, casted.id) && Objects.equals(type, casted.type);
057  }
058
059  @Override
060  public int hashCode() {
061    return Objects.hash(id, type);
062  }
063
064  @Override
065  public String toString() {
066    return "TermsOfServiceBase{" + "id='" + id + '\'' + ", " + "type='" + type + '\'' + "}";
067  }
068
069  public static class Builder extends NullableFieldTracker {
070
071    protected final String id;
072
073    protected EnumWrapper<TermsOfServiceBaseTypeField> type;
074
075    public Builder(String id) {
076      super();
077      this.id = id;
078    }
079
080    public Builder type(TermsOfServiceBaseTypeField type) {
081      this.type = new EnumWrapper<TermsOfServiceBaseTypeField>(type);
082      return this;
083    }
084
085    public Builder type(EnumWrapper<TermsOfServiceBaseTypeField> type) {
086      this.type = type;
087      return this;
088    }
089
090    public TermsOfServiceBase build() {
091      if (this.type == null) {
092        this.type =
093            new EnumWrapper<TermsOfServiceBaseTypeField>(
094                TermsOfServiceBaseTypeField.TERMS_OF_SERVICE);
095      }
096      return new TermsOfServiceBase(this);
097    }
098  }
099}