001package com.box.sdkgen.schemas.integrationmappingteams;
002
003import com.box.sdkgen.internal.utils.DateTimeUtils;
004import com.box.sdkgen.schemas.folderreference.FolderReference;
005import com.box.sdkgen.schemas.integrationmappingbase.IntegrationMappingBase;
006import com.box.sdkgen.schemas.integrationmappingbase.IntegrationMappingBaseTypeField;
007import com.box.sdkgen.schemas.integrationmappingpartneritemteams.IntegrationMappingPartnerItemTeams;
008import com.box.sdkgen.serialization.json.EnumWrapper;
009import com.fasterxml.jackson.annotation.JsonFilter;
010import com.fasterxml.jackson.annotation.JsonProperty;
011import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
012import com.fasterxml.jackson.databind.annotation.JsonSerialize;
013import java.time.OffsetDateTime;
014import java.util.Objects;
015
016/** A Microsoft Teams specific representation of an integration mapping object. */
017@JsonFilter("nullablePropertyFilter")
018public class IntegrationMappingTeams extends IntegrationMappingBase {
019
020  /**
021   * Identifies the Box partner app, with which the mapping is associated. Supports Slack and Teams.
022   * (part of the composite key together with `id`).
023   */
024  @JsonDeserialize(
025      using =
026          IntegrationMappingTeamsIntegrationTypeField
027              .IntegrationMappingTeamsIntegrationTypeFieldDeserializer.class)
028  @JsonSerialize(
029      using =
030          IntegrationMappingTeamsIntegrationTypeField
031              .IntegrationMappingTeamsIntegrationTypeFieldSerializer.class)
032  @JsonProperty("integration_type")
033  protected EnumWrapper<IntegrationMappingTeamsIntegrationTypeField> integrationType;
034
035  /**
036   * Identifies whether the mapping has been manually set by the team owner from UI for channels (as
037   * opposed to being automatically created).
038   */
039  @JsonProperty("is_overridden_by_manual_mapping")
040  protected Boolean isOverriddenByManualMapping;
041
042  /** Mapped item object for Teams. */
043  @JsonProperty("partner_item")
044  protected final IntegrationMappingPartnerItemTeams partnerItem;
045
046  @JsonProperty("box_item")
047  protected final FolderReference boxItem;
048
049  /** When the integration mapping object was created. */
050  @JsonProperty("created_at")
051  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
052  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
053  protected OffsetDateTime createdAt;
054
055  /** When the integration mapping object was last modified. */
056  @JsonProperty("modified_at")
057  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
058  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
059  protected OffsetDateTime modifiedAt;
060
061  public IntegrationMappingTeams(
062      @JsonProperty("id") String id,
063      @JsonProperty("partner_item") IntegrationMappingPartnerItemTeams partnerItem,
064      @JsonProperty("box_item") FolderReference boxItem) {
065    super(id);
066    this.partnerItem = partnerItem;
067    this.boxItem = boxItem;
068  }
069
070  protected IntegrationMappingTeams(Builder builder) {
071    super(builder);
072    this.integrationType = builder.integrationType;
073    this.isOverriddenByManualMapping = builder.isOverriddenByManualMapping;
074    this.partnerItem = builder.partnerItem;
075    this.boxItem = builder.boxItem;
076    this.createdAt = builder.createdAt;
077    this.modifiedAt = builder.modifiedAt;
078    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
079  }
080
081  public EnumWrapper<IntegrationMappingTeamsIntegrationTypeField> getIntegrationType() {
082    return integrationType;
083  }
084
085  public Boolean getIsOverriddenByManualMapping() {
086    return isOverriddenByManualMapping;
087  }
088
089  public IntegrationMappingPartnerItemTeams getPartnerItem() {
090    return partnerItem;
091  }
092
093  public FolderReference getBoxItem() {
094    return boxItem;
095  }
096
097  public OffsetDateTime getCreatedAt() {
098    return createdAt;
099  }
100
101  public OffsetDateTime getModifiedAt() {
102    return modifiedAt;
103  }
104
105  @Override
106  public boolean equals(Object o) {
107    if (this == o) {
108      return true;
109    }
110    if (o == null || getClass() != o.getClass()) {
111      return false;
112    }
113    IntegrationMappingTeams casted = (IntegrationMappingTeams) o;
114    return Objects.equals(id, casted.id)
115        && Objects.equals(type, casted.type)
116        && Objects.equals(integrationType, casted.integrationType)
117        && Objects.equals(isOverriddenByManualMapping, casted.isOverriddenByManualMapping)
118        && Objects.equals(partnerItem, casted.partnerItem)
119        && Objects.equals(boxItem, casted.boxItem)
120        && Objects.equals(createdAt, casted.createdAt)
121        && Objects.equals(modifiedAt, casted.modifiedAt);
122  }
123
124  @Override
125  public int hashCode() {
126    return Objects.hash(
127        id,
128        type,
129        integrationType,
130        isOverriddenByManualMapping,
131        partnerItem,
132        boxItem,
133        createdAt,
134        modifiedAt);
135  }
136
137  @Override
138  public String toString() {
139    return "IntegrationMappingTeams{"
140        + "id='"
141        + id
142        + '\''
143        + ", "
144        + "type='"
145        + type
146        + '\''
147        + ", "
148        + "integrationType='"
149        + integrationType
150        + '\''
151        + ", "
152        + "isOverriddenByManualMapping='"
153        + isOverriddenByManualMapping
154        + '\''
155        + ", "
156        + "partnerItem='"
157        + partnerItem
158        + '\''
159        + ", "
160        + "boxItem='"
161        + boxItem
162        + '\''
163        + ", "
164        + "createdAt='"
165        + createdAt
166        + '\''
167        + ", "
168        + "modifiedAt='"
169        + modifiedAt
170        + '\''
171        + "}";
172  }
173
174  public static class Builder extends IntegrationMappingBase.Builder {
175
176    protected EnumWrapper<IntegrationMappingTeamsIntegrationTypeField> integrationType;
177
178    protected Boolean isOverriddenByManualMapping;
179
180    protected final IntegrationMappingPartnerItemTeams partnerItem;
181
182    protected final FolderReference boxItem;
183
184    protected OffsetDateTime createdAt;
185
186    protected OffsetDateTime modifiedAt;
187
188    public Builder(
189        String id, IntegrationMappingPartnerItemTeams partnerItem, FolderReference boxItem) {
190      super(id);
191      this.partnerItem = partnerItem;
192      this.boxItem = boxItem;
193    }
194
195    public Builder integrationType(IntegrationMappingTeamsIntegrationTypeField integrationType) {
196      this.integrationType =
197          new EnumWrapper<IntegrationMappingTeamsIntegrationTypeField>(integrationType);
198      return this;
199    }
200
201    public Builder integrationType(
202        EnumWrapper<IntegrationMappingTeamsIntegrationTypeField> integrationType) {
203      this.integrationType = integrationType;
204      return this;
205    }
206
207    public Builder isOverriddenByManualMapping(Boolean isOverriddenByManualMapping) {
208      this.isOverriddenByManualMapping = isOverriddenByManualMapping;
209      return this;
210    }
211
212    public Builder createdAt(OffsetDateTime createdAt) {
213      this.createdAt = createdAt;
214      return this;
215    }
216
217    public Builder modifiedAt(OffsetDateTime modifiedAt) {
218      this.modifiedAt = modifiedAt;
219      return this;
220    }
221
222    @Override
223    public Builder type(IntegrationMappingBaseTypeField type) {
224      this.type = new EnumWrapper<IntegrationMappingBaseTypeField>(type);
225      return this;
226    }
227
228    @Override
229    public Builder type(EnumWrapper<IntegrationMappingBaseTypeField> type) {
230      this.type = type;
231      return this;
232    }
233
234    public IntegrationMappingTeams build() {
235      if (this.type == null) {
236        this.type =
237            new EnumWrapper<IntegrationMappingBaseTypeField>(
238                IntegrationMappingBaseTypeField.INTEGRATION_MAPPING);
239      }
240      return new IntegrationMappingTeams(this);
241    }
242  }
243}