001package com.box.sdkgen.schemas.integrationmappingbase;
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/** A base representation of an integration mapping object. */
013@JsonFilter("nullablePropertyFilter")
014public class IntegrationMappingBase extends SerializableObject {
015
016  /**
017   * A unique identifier of a folder mapping (part of a composite key together with
018   * `integration_type`).
019   */
020  protected final String id;
021
022  /** Mapping type. */
023  @JsonDeserialize(
024      using = IntegrationMappingBaseTypeField.IntegrationMappingBaseTypeFieldDeserializer.class)
025  @JsonSerialize(
026      using = IntegrationMappingBaseTypeField.IntegrationMappingBaseTypeFieldSerializer.class)
027  protected EnumWrapper<IntegrationMappingBaseTypeField> type;
028
029  public IntegrationMappingBase(@JsonProperty("id") String id) {
030    super();
031    this.id = id;
032    this.type =
033        new EnumWrapper<IntegrationMappingBaseTypeField>(
034            IntegrationMappingBaseTypeField.INTEGRATION_MAPPING);
035  }
036
037  protected IntegrationMappingBase(Builder builder) {
038    super();
039    this.id = builder.id;
040    this.type = builder.type;
041    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
042  }
043
044  public String getId() {
045    return id;
046  }
047
048  public EnumWrapper<IntegrationMappingBaseTypeField> getType() {
049    return type;
050  }
051
052  @Override
053  public boolean equals(Object o) {
054    if (this == o) {
055      return true;
056    }
057    if (o == null || getClass() != o.getClass()) {
058      return false;
059    }
060    IntegrationMappingBase casted = (IntegrationMappingBase) o;
061    return Objects.equals(id, casted.id) && Objects.equals(type, casted.type);
062  }
063
064  @Override
065  public int hashCode() {
066    return Objects.hash(id, type);
067  }
068
069  @Override
070  public String toString() {
071    return "IntegrationMappingBase{" + "id='" + id + '\'' + ", " + "type='" + type + '\'' + "}";
072  }
073
074  public static class Builder extends NullableFieldTracker {
075
076    protected final String id;
077
078    protected EnumWrapper<IntegrationMappingBaseTypeField> type;
079
080    public Builder(String id) {
081      super();
082      this.id = id;
083    }
084
085    public Builder type(IntegrationMappingBaseTypeField type) {
086      this.type = new EnumWrapper<IntegrationMappingBaseTypeField>(type);
087      return this;
088    }
089
090    public Builder type(EnumWrapper<IntegrationMappingBaseTypeField> type) {
091      this.type = type;
092      return this;
093    }
094
095    public IntegrationMappingBase build() {
096      if (this.type == null) {
097        this.type =
098            new EnumWrapper<IntegrationMappingBaseTypeField>(
099                IntegrationMappingBaseTypeField.INTEGRATION_MAPPING);
100      }
101      return new IntegrationMappingBase(this);
102    }
103  }
104}