cloud.genesys.webmessaging.sdk.model.WebMessagingEvent Maven / Gradle / Ivy
package cloud.genesys.webmessaging.sdk.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import java.util.Objects;
import java.io.IOException;
import cloud.genesys.webmessaging.sdk.model.WebMessagingEventCoBrowse;
import cloud.genesys.webmessaging.sdk.model.WebMessagingEventPresence;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* Message event element. Examples include: system messages, typing indicators, cobrowse offerings.
*/
@ApiModel(description = "Message event element. Examples include: system messages, typing indicators, cobrowse offerings.")
public class WebMessagingEvent implements Serializable {
private static class EventTypeEnumDeserializer extends StdDeserializer {
public EventTypeEnumDeserializer() {
super(EventTypeEnumDeserializer.class);
}
@Override
public EventTypeEnum deserialize(JsonParser jsonParser, DeserializationContext ctxt)
throws IOException {
JsonNode node = jsonParser.getCodec().readTree(jsonParser);
return EventTypeEnum.fromString(node.toString().replace("\"", ""));
}
}
/**
* Type of this event element
*/
@JsonDeserialize(using = EventTypeEnumDeserializer.class)
public enum EventTypeEnum {
OUTDATEDSDKVERSION("OutdatedSdkVersion"),
COBROWSE("CoBrowse"),
PRESENCE("Presence");
private String value;
EventTypeEnum(String value) {
this.value = value;
}
@JsonCreator
public static EventTypeEnum fromString(String key) {
if (key == null) return null;
for (EventTypeEnum value : EventTypeEnum.values()) {
if (key.equalsIgnoreCase(value.toString())) {
return value;
}
}
return EventTypeEnum.values()[0];
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
}
private EventTypeEnum eventType = null;
private WebMessagingEventCoBrowse coBrowse = null;
private WebMessagingEventPresence presence = null;
/**
* Type of this event element
**/
public WebMessagingEvent eventType(EventTypeEnum eventType) {
this.eventType = eventType;
return this;
}
@ApiModelProperty(example = "null", required = true, value = "Type of this event element")
@JsonProperty("eventType")
public EventTypeEnum getEventType() {
return eventType;
}
public void setEventType(EventTypeEnum eventType) {
this.eventType = eventType;
}
/**
* Cobrowse event.
**/
public WebMessagingEvent coBrowse(WebMessagingEventCoBrowse coBrowse) {
this.coBrowse = coBrowse;
return this;
}
@ApiModelProperty(example = "null", value = "Cobrowse event.")
@JsonProperty("coBrowse")
public WebMessagingEventCoBrowse getCoBrowse() {
return coBrowse;
}
public void setCoBrowse(WebMessagingEventCoBrowse coBrowse) {
this.coBrowse = coBrowse;
}
/**
* Presence event.
**/
public WebMessagingEvent presence(WebMessagingEventPresence presence) {
this.presence = presence;
return this;
}
@ApiModelProperty(example = "null", value = "Presence event.")
@JsonProperty("presence")
public WebMessagingEventPresence getPresence() {
return presence;
}
public void setPresence(WebMessagingEventPresence presence) {
this.presence = presence;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
WebMessagingEvent webMessagingEvent = (WebMessagingEvent) o;
return Objects.equals(this.eventType, webMessagingEvent.eventType) &&
Objects.equals(this.coBrowse, webMessagingEvent.coBrowse) &&
Objects.equals(this.presence, webMessagingEvent.presence);
}
@Override
public int hashCode() {
return Objects.hash(eventType, coBrowse, presence);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WebMessagingEvent {\n");
sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n");
sb.append(" coBrowse: ").append(toIndentedString(coBrowse)).append("\n");
sb.append(" presence: ").append(toIndentedString(presence)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}