001package com.box.sdkgen.schemas.integrationmapping; 002 003import com.box.sdkgen.internal.utils.DateTimeUtils; 004import com.box.sdkgen.schemas.foldermini.FolderMini; 005import com.box.sdkgen.schemas.integrationmappingbase.IntegrationMappingBase; 006import com.box.sdkgen.schemas.integrationmappingbase.IntegrationMappingBaseTypeField; 007import com.box.sdkgen.schemas.integrationmappingpartneritemslack.IntegrationMappingPartnerItemSlack; 008import com.box.sdkgen.schemas.integrationmappingslackoptions.IntegrationMappingSlackOptions; 009import com.box.sdkgen.schemas.userintegrationmappings.UserIntegrationMappings; 010import com.box.sdkgen.serialization.json.EnumWrapper; 011import com.fasterxml.jackson.annotation.JsonFilter; 012import com.fasterxml.jackson.annotation.JsonProperty; 013import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 014import com.fasterxml.jackson.databind.annotation.JsonSerialize; 015import java.time.OffsetDateTime; 016import java.util.Objects; 017 018/** A Slack specific representation of an integration mapping object. */ 019@JsonFilter("nullablePropertyFilter") 020public class IntegrationMapping extends IntegrationMappingBase { 021 022 /** 023 * Identifies the Box partner app, with which the mapping is associated. Currently only supports 024 * Slack. (part of the composite key together with `id`). 025 */ 026 @JsonDeserialize( 027 using = 028 IntegrationMappingIntegrationTypeField.IntegrationMappingIntegrationTypeFieldDeserializer 029 .class) 030 @JsonSerialize( 031 using = 032 IntegrationMappingIntegrationTypeField.IntegrationMappingIntegrationTypeFieldSerializer 033 .class) 034 @JsonProperty("integration_type") 035 protected EnumWrapper<IntegrationMappingIntegrationTypeField> integrationType; 036 037 /** 038 * Identifies whether the mapping has been manually set (as opposed to being automatically 039 * created). 040 */ 041 @JsonProperty("is_manually_created") 042 protected Boolean isManuallyCreated; 043 044 protected IntegrationMappingSlackOptions options; 045 046 /** An object representing the user who created the integration mapping. */ 047 @JsonProperty("created_by") 048 protected UserIntegrationMappings createdBy; 049 050 /** The user who last modified the integration mapping. */ 051 @JsonProperty("modified_by") 052 protected UserIntegrationMappings modifiedBy; 053 054 /** Mapped item object for Slack. */ 055 @JsonProperty("partner_item") 056 protected final IntegrationMappingPartnerItemSlack partnerItem; 057 058 /** 059 * The Box folder, to which the object from the partner app domain (referenced in 060 * `partner_item_id`) is mapped. 061 */ 062 @JsonProperty("box_item") 063 protected final FolderMini boxItem; 064 065 /** When the integration mapping object was created. */ 066 @JsonProperty("created_at") 067 @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class) 068 @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class) 069 protected OffsetDateTime createdAt; 070 071 /** When the integration mapping object was last modified. */ 072 @JsonProperty("modified_at") 073 @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class) 074 @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class) 075 protected OffsetDateTime modifiedAt; 076 077 public IntegrationMapping( 078 @JsonProperty("id") String id, 079 @JsonProperty("partner_item") IntegrationMappingPartnerItemSlack partnerItem, 080 @JsonProperty("box_item") FolderMini boxItem) { 081 super(id); 082 this.partnerItem = partnerItem; 083 this.boxItem = boxItem; 084 } 085 086 protected IntegrationMapping(Builder builder) { 087 super(builder); 088 this.integrationType = builder.integrationType; 089 this.isManuallyCreated = builder.isManuallyCreated; 090 this.options = builder.options; 091 this.createdBy = builder.createdBy; 092 this.modifiedBy = builder.modifiedBy; 093 this.partnerItem = builder.partnerItem; 094 this.boxItem = builder.boxItem; 095 this.createdAt = builder.createdAt; 096 this.modifiedAt = builder.modifiedAt; 097 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 098 } 099 100 public EnumWrapper<IntegrationMappingIntegrationTypeField> getIntegrationType() { 101 return integrationType; 102 } 103 104 public Boolean getIsManuallyCreated() { 105 return isManuallyCreated; 106 } 107 108 public IntegrationMappingSlackOptions getOptions() { 109 return options; 110 } 111 112 public UserIntegrationMappings getCreatedBy() { 113 return createdBy; 114 } 115 116 public UserIntegrationMappings getModifiedBy() { 117 return modifiedBy; 118 } 119 120 public IntegrationMappingPartnerItemSlack getPartnerItem() { 121 return partnerItem; 122 } 123 124 public FolderMini getBoxItem() { 125 return boxItem; 126 } 127 128 public OffsetDateTime getCreatedAt() { 129 return createdAt; 130 } 131 132 public OffsetDateTime getModifiedAt() { 133 return modifiedAt; 134 } 135 136 @Override 137 public boolean equals(Object o) { 138 if (this == o) { 139 return true; 140 } 141 if (o == null || getClass() != o.getClass()) { 142 return false; 143 } 144 IntegrationMapping casted = (IntegrationMapping) o; 145 return Objects.equals(id, casted.id) 146 && Objects.equals(type, casted.type) 147 && Objects.equals(integrationType, casted.integrationType) 148 && Objects.equals(isManuallyCreated, casted.isManuallyCreated) 149 && Objects.equals(options, casted.options) 150 && Objects.equals(createdBy, casted.createdBy) 151 && Objects.equals(modifiedBy, casted.modifiedBy) 152 && Objects.equals(partnerItem, casted.partnerItem) 153 && Objects.equals(boxItem, casted.boxItem) 154 && Objects.equals(createdAt, casted.createdAt) 155 && Objects.equals(modifiedAt, casted.modifiedAt); 156 } 157 158 @Override 159 public int hashCode() { 160 return Objects.hash( 161 id, 162 type, 163 integrationType, 164 isManuallyCreated, 165 options, 166 createdBy, 167 modifiedBy, 168 partnerItem, 169 boxItem, 170 createdAt, 171 modifiedAt); 172 } 173 174 @Override 175 public String toString() { 176 return "IntegrationMapping{" 177 + "id='" 178 + id 179 + '\'' 180 + ", " 181 + "type='" 182 + type 183 + '\'' 184 + ", " 185 + "integrationType='" 186 + integrationType 187 + '\'' 188 + ", " 189 + "isManuallyCreated='" 190 + isManuallyCreated 191 + '\'' 192 + ", " 193 + "options='" 194 + options 195 + '\'' 196 + ", " 197 + "createdBy='" 198 + createdBy 199 + '\'' 200 + ", " 201 + "modifiedBy='" 202 + modifiedBy 203 + '\'' 204 + ", " 205 + "partnerItem='" 206 + partnerItem 207 + '\'' 208 + ", " 209 + "boxItem='" 210 + boxItem 211 + '\'' 212 + ", " 213 + "createdAt='" 214 + createdAt 215 + '\'' 216 + ", " 217 + "modifiedAt='" 218 + modifiedAt 219 + '\'' 220 + "}"; 221 } 222 223 public static class Builder extends IntegrationMappingBase.Builder { 224 225 protected EnumWrapper<IntegrationMappingIntegrationTypeField> integrationType; 226 227 protected Boolean isManuallyCreated; 228 229 protected IntegrationMappingSlackOptions options; 230 231 protected UserIntegrationMappings createdBy; 232 233 protected UserIntegrationMappings modifiedBy; 234 235 protected final IntegrationMappingPartnerItemSlack partnerItem; 236 237 protected final FolderMini boxItem; 238 239 protected OffsetDateTime createdAt; 240 241 protected OffsetDateTime modifiedAt; 242 243 public Builder(String id, IntegrationMappingPartnerItemSlack partnerItem, FolderMini boxItem) { 244 super(id); 245 this.partnerItem = partnerItem; 246 this.boxItem = boxItem; 247 } 248 249 public Builder integrationType(IntegrationMappingIntegrationTypeField integrationType) { 250 this.integrationType = 251 new EnumWrapper<IntegrationMappingIntegrationTypeField>(integrationType); 252 return this; 253 } 254 255 public Builder integrationType( 256 EnumWrapper<IntegrationMappingIntegrationTypeField> integrationType) { 257 this.integrationType = integrationType; 258 return this; 259 } 260 261 public Builder isManuallyCreated(Boolean isManuallyCreated) { 262 this.isManuallyCreated = isManuallyCreated; 263 return this; 264 } 265 266 public Builder options(IntegrationMappingSlackOptions options) { 267 this.options = options; 268 return this; 269 } 270 271 public Builder createdBy(UserIntegrationMappings createdBy) { 272 this.createdBy = createdBy; 273 return this; 274 } 275 276 public Builder modifiedBy(UserIntegrationMappings modifiedBy) { 277 this.modifiedBy = modifiedBy; 278 return this; 279 } 280 281 public Builder createdAt(OffsetDateTime createdAt) { 282 this.createdAt = createdAt; 283 return this; 284 } 285 286 public Builder modifiedAt(OffsetDateTime modifiedAt) { 287 this.modifiedAt = modifiedAt; 288 return this; 289 } 290 291 @Override 292 public Builder type(IntegrationMappingBaseTypeField type) { 293 this.type = new EnumWrapper<IntegrationMappingBaseTypeField>(type); 294 return this; 295 } 296 297 @Override 298 public Builder type(EnumWrapper<IntegrationMappingBaseTypeField> type) { 299 this.type = type; 300 return this; 301 } 302 303 public IntegrationMapping build() { 304 if (this.type == null) { 305 this.type = 306 new EnumWrapper<IntegrationMappingBaseTypeField>( 307 IntegrationMappingBaseTypeField.INTEGRATION_MAPPING); 308 } 309 return new IntegrationMapping(this); 310 } 311 } 312}