001package com.box.sdkgen.schemas.collaborationallowlistentry;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.internal.utils.DateTimeUtils;
006import com.box.sdkgen.serialization.json.EnumWrapper;
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 * An entry that describes an approved domain for which users can collaborate with files and folders
016 * in your enterprise or vice versa.
017 */
018@JsonFilter("nullablePropertyFilter")
019public class CollaborationAllowlistEntry extends SerializableObject {
020
021  /** The unique identifier for this entry. */
022  protected String id;
023
024  /** The value will always be `collaboration_whitelist_entry`. */
025  @JsonDeserialize(
026      using =
027          CollaborationAllowlistEntryTypeField.CollaborationAllowlistEntryTypeFieldDeserializer
028              .class)
029  @JsonSerialize(
030      using =
031          CollaborationAllowlistEntryTypeField.CollaborationAllowlistEntryTypeFieldSerializer.class)
032  protected EnumWrapper<CollaborationAllowlistEntryTypeField> type;
033
034  /** The whitelisted domain. */
035  protected String domain;
036
037  /** The direction of the collaborations to allow. */
038  @JsonDeserialize(
039      using =
040          CollaborationAllowlistEntryDirectionField
041              .CollaborationAllowlistEntryDirectionFieldDeserializer.class)
042  @JsonSerialize(
043      using =
044          CollaborationAllowlistEntryDirectionField
045              .CollaborationAllowlistEntryDirectionFieldSerializer.class)
046  protected EnumWrapper<CollaborationAllowlistEntryDirectionField> direction;
047
048  protected CollaborationAllowlistEntryEnterpriseField enterprise;
049
050  /** The time the entry was created at. */
051  @JsonProperty("created_at")
052  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
053  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
054  protected OffsetDateTime createdAt;
055
056  public CollaborationAllowlistEntry() {
057    super();
058  }
059
060  protected CollaborationAllowlistEntry(Builder builder) {
061    super();
062    this.id = builder.id;
063    this.type = builder.type;
064    this.domain = builder.domain;
065    this.direction = builder.direction;
066    this.enterprise = builder.enterprise;
067    this.createdAt = builder.createdAt;
068    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
069  }
070
071  public String getId() {
072    return id;
073  }
074
075  public EnumWrapper<CollaborationAllowlistEntryTypeField> getType() {
076    return type;
077  }
078
079  public String getDomain() {
080    return domain;
081  }
082
083  public EnumWrapper<CollaborationAllowlistEntryDirectionField> getDirection() {
084    return direction;
085  }
086
087  public CollaborationAllowlistEntryEnterpriseField getEnterprise() {
088    return enterprise;
089  }
090
091  public OffsetDateTime getCreatedAt() {
092    return createdAt;
093  }
094
095  @Override
096  public boolean equals(Object o) {
097    if (this == o) {
098      return true;
099    }
100    if (o == null || getClass() != o.getClass()) {
101      return false;
102    }
103    CollaborationAllowlistEntry casted = (CollaborationAllowlistEntry) o;
104    return Objects.equals(id, casted.id)
105        && Objects.equals(type, casted.type)
106        && Objects.equals(domain, casted.domain)
107        && Objects.equals(direction, casted.direction)
108        && Objects.equals(enterprise, casted.enterprise)
109        && Objects.equals(createdAt, casted.createdAt);
110  }
111
112  @Override
113  public int hashCode() {
114    return Objects.hash(id, type, domain, direction, enterprise, createdAt);
115  }
116
117  @Override
118  public String toString() {
119    return "CollaborationAllowlistEntry{"
120        + "id='"
121        + id
122        + '\''
123        + ", "
124        + "type='"
125        + type
126        + '\''
127        + ", "
128        + "domain='"
129        + domain
130        + '\''
131        + ", "
132        + "direction='"
133        + direction
134        + '\''
135        + ", "
136        + "enterprise='"
137        + enterprise
138        + '\''
139        + ", "
140        + "createdAt='"
141        + createdAt
142        + '\''
143        + "}";
144  }
145
146  public static class Builder extends NullableFieldTracker {
147
148    protected String id;
149
150    protected EnumWrapper<CollaborationAllowlistEntryTypeField> type;
151
152    protected String domain;
153
154    protected EnumWrapper<CollaborationAllowlistEntryDirectionField> direction;
155
156    protected CollaborationAllowlistEntryEnterpriseField enterprise;
157
158    protected OffsetDateTime createdAt;
159
160    public Builder id(String id) {
161      this.id = id;
162      return this;
163    }
164
165    public Builder type(CollaborationAllowlistEntryTypeField type) {
166      this.type = new EnumWrapper<CollaborationAllowlistEntryTypeField>(type);
167      return this;
168    }
169
170    public Builder type(EnumWrapper<CollaborationAllowlistEntryTypeField> type) {
171      this.type = type;
172      return this;
173    }
174
175    public Builder domain(String domain) {
176      this.domain = domain;
177      return this;
178    }
179
180    public Builder direction(CollaborationAllowlistEntryDirectionField direction) {
181      this.direction = new EnumWrapper<CollaborationAllowlistEntryDirectionField>(direction);
182      return this;
183    }
184
185    public Builder direction(EnumWrapper<CollaborationAllowlistEntryDirectionField> direction) {
186      this.direction = direction;
187      return this;
188    }
189
190    public Builder enterprise(CollaborationAllowlistEntryEnterpriseField enterprise) {
191      this.enterprise = enterprise;
192      return this;
193    }
194
195    public Builder createdAt(OffsetDateTime createdAt) {
196      this.createdAt = createdAt;
197      return this;
198    }
199
200    public CollaborationAllowlistEntry build() {
201      return new CollaborationAllowlistEntry(this);
202    }
203  }
204}