001package com.box.sdkgen.schemas.integrationmappingpartneritemslack; 002 003import com.box.sdkgen.internal.Nullable; 004import com.box.sdkgen.internal.NullableFieldTracker; 005import com.box.sdkgen.internal.SerializableObject; 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.util.Objects; 012 013/** 014 * The schema for an integration mapping mapped item object for type Slack. 015 * 016 * <p>Depending if Box for Slack is installed at the org or workspace level, provide **either** 017 * `slack_org_id` **or** `slack_workspace_id`. Do not use both parameters at the same time. 018 */ 019@JsonFilter("nullablePropertyFilter") 020public class IntegrationMappingPartnerItemSlack extends SerializableObject { 021 022 /** Type of the mapped item referenced in `id`. */ 023 @JsonDeserialize( 024 using = 025 IntegrationMappingPartnerItemSlackTypeField 026 .IntegrationMappingPartnerItemSlackTypeFieldDeserializer.class) 027 @JsonSerialize( 028 using = 029 IntegrationMappingPartnerItemSlackTypeField 030 .IntegrationMappingPartnerItemSlackTypeFieldSerializer.class) 031 protected EnumWrapper<IntegrationMappingPartnerItemSlackTypeField> type; 032 033 /** ID of the mapped item (of type referenced in `type`). */ 034 protected final String id; 035 036 /** 037 * ID of the Slack workspace with which the item is associated. Use this parameter if Box for 038 * Slack is installed at a workspace level. Do not use `slack_org_id` at the same time. 039 */ 040 @JsonProperty("slack_workspace_id") 041 @Nullable 042 protected String slackWorkspaceId; 043 044 /** 045 * ID of the Slack org with which the item is associated. Use this parameter if Box for Slack is 046 * installed at the org level. Do not use `slack_workspace_id` at the same time. 047 */ 048 @JsonProperty("slack_org_id") 049 @Nullable 050 protected String slackOrgId; 051 052 public IntegrationMappingPartnerItemSlack(@JsonProperty("id") String id) { 053 super(); 054 this.id = id; 055 this.type = 056 new EnumWrapper<IntegrationMappingPartnerItemSlackTypeField>( 057 IntegrationMappingPartnerItemSlackTypeField.CHANNEL); 058 } 059 060 protected IntegrationMappingPartnerItemSlack(Builder builder) { 061 super(); 062 this.type = builder.type; 063 this.id = builder.id; 064 this.slackWorkspaceId = builder.slackWorkspaceId; 065 this.slackOrgId = builder.slackOrgId; 066 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 067 } 068 069 public EnumWrapper<IntegrationMappingPartnerItemSlackTypeField> getType() { 070 return type; 071 } 072 073 public String getId() { 074 return id; 075 } 076 077 public String getSlackWorkspaceId() { 078 return slackWorkspaceId; 079 } 080 081 public String getSlackOrgId() { 082 return slackOrgId; 083 } 084 085 @Override 086 public boolean equals(Object o) { 087 if (this == o) { 088 return true; 089 } 090 if (o == null || getClass() != o.getClass()) { 091 return false; 092 } 093 IntegrationMappingPartnerItemSlack casted = (IntegrationMappingPartnerItemSlack) o; 094 return Objects.equals(type, casted.type) 095 && Objects.equals(id, casted.id) 096 && Objects.equals(slackWorkspaceId, casted.slackWorkspaceId) 097 && Objects.equals(slackOrgId, casted.slackOrgId); 098 } 099 100 @Override 101 public int hashCode() { 102 return Objects.hash(type, id, slackWorkspaceId, slackOrgId); 103 } 104 105 @Override 106 public String toString() { 107 return "IntegrationMappingPartnerItemSlack{" 108 + "type='" 109 + type 110 + '\'' 111 + ", " 112 + "id='" 113 + id 114 + '\'' 115 + ", " 116 + "slackWorkspaceId='" 117 + slackWorkspaceId 118 + '\'' 119 + ", " 120 + "slackOrgId='" 121 + slackOrgId 122 + '\'' 123 + "}"; 124 } 125 126 public static class Builder extends NullableFieldTracker { 127 128 protected EnumWrapper<IntegrationMappingPartnerItemSlackTypeField> type; 129 130 protected final String id; 131 132 protected String slackWorkspaceId; 133 134 protected String slackOrgId; 135 136 public Builder(String id) { 137 super(); 138 this.id = id; 139 } 140 141 public Builder type(IntegrationMappingPartnerItemSlackTypeField type) { 142 this.type = new EnumWrapper<IntegrationMappingPartnerItemSlackTypeField>(type); 143 return this; 144 } 145 146 public Builder type(EnumWrapper<IntegrationMappingPartnerItemSlackTypeField> type) { 147 this.type = type; 148 return this; 149 } 150 151 public Builder slackWorkspaceId(String slackWorkspaceId) { 152 this.slackWorkspaceId = slackWorkspaceId; 153 this.markNullableFieldAsSet("slack_workspace_id"); 154 return this; 155 } 156 157 public Builder slackOrgId(String slackOrgId) { 158 this.slackOrgId = slackOrgId; 159 this.markNullableFieldAsSet("slack_org_id"); 160 return this; 161 } 162 163 public IntegrationMappingPartnerItemSlack build() { 164 if (this.type == null) { 165 this.type = 166 new EnumWrapper<IntegrationMappingPartnerItemSlackTypeField>( 167 IntegrationMappingPartnerItemSlackTypeField.CHANNEL); 168 } 169 return new IntegrationMappingPartnerItemSlack(this); 170 } 171 } 172}