content: package com.liferay.chatbot.dto.v1_0;
  
  import com.fasterxml.jackson.annotation.JsonCreator;
  import com.fasterxml.jackson.annotation.JsonFilter;
  import com.fasterxml.jackson.annotation.JsonGetter;
  import com.fasterxml.jackson.annotation.JsonIgnore;
  import com.fasterxml.jackson.annotation.JsonProperty;
  import com.fasterxml.jackson.annotation.JsonValue;
  
  import com.liferay.petra.function.UnsafeSupplier;
  import com.liferay.petra.string.StringBundler;
  import com.liferay.portal.kernel.util.StringUtil;
  import com.liferay.portal.vulcan.graphql.annotation.GraphQLField;
  import com.liferay.portal.vulcan.graphql.annotation.GraphQLName;
  import com.liferay.portal.vulcan.util.ObjectMapperUtil;
  
  import io.swagger.v3.oas.annotations.media.Schema;
  
  import java.io.Serializable;
  
  import java.util.Iterator;
  import java.util.Map;
  import java.util.Objects;
  import java.util.Set;
  import java.util.function.Supplier;
  
  import javax.annotation.Generated;
  
  import javax.validation.Valid;
  
  import javax.xml.bind.annotation.XmlRootElement;
  
  /**
   * @author Alejandro Tardín
   * @generated
   */
  @Generated("")
  @GraphQLName("Message")
  @JsonFilter("Liferay.Vulcan")
  @XmlRootElement(name = "Message")
  public class Message implements Serializable {
  
  	public static Message toDTO(String json) {
  		return ObjectMapperUtil.readValue(Message.class, json);
  	}
  
  	public static Message unsafeToDTO(String json) {
  		return ObjectMapperUtil.unsafeReadValue(Message.class, json);
  	}
  
  	@Schema
  	public String getContent() {
  		if (_contentSupplier != null) {
  			content = _contentSupplier.get();
  
  			_contentSupplier = null;
  		}
  
  		return content;
  	}
  
  	public void setContent(String content) {
  		this.content = content;
  
  		_contentSupplier = null;
  	}
  
  	@JsonIgnore
  	public void setContent(
  		UnsafeSupplier<String, Exception> contentUnsafeSupplier) {
  
  		_contentSupplier = () -> {
  			try {
  				return contentUnsafeSupplier.get();
  			}
  			catch (RuntimeException runtimeException) {
  				throw runtimeException;
  			}
  			catch (Exception exception) {
  				throw new RuntimeException(exception);
  			}
  		};
  	}
  
  	@GraphQLField
  	@JsonProperty(access = JsonProperty.Access.READ_WRITE)
  	protected String content;
  
  	@JsonIgnore
  	private Supplier<String> _contentSupplier;
  
  	@JsonGetter("source")
  	@Schema
  	@Valid
  	public Source getSource() {
  		if (_sourceSupplier != null) {
  			source = _sourceSupplier.get();
  
  			_sourceSupplier = null;
  		}
  
  		return source;
  	}
  
  	@JsonIgnore
  	public String getSourceAsString() {
  		Source source = getSource();
  
  		if (source == null) {
  			return null;
  		}
  
  		return source.toString();
  	}
  
  	public void setSource(Source source) {
  		this.source = source;
  
  		_sourceSupplier = null;
  	}
  
  	@JsonIgnore
  	public void setSource(
  		UnsafeSupplier<Source, Exception> sourceUnsafeSupplier) {
  
  		_sourceSupplier = () -> {
  			try {
  				return sourceUnsafeSupplier.get();
  			}
  			catch (RuntimeException runtimeException) {
  				throw runtimeException;
  			}
  			catch (Exception exception) {
  				throw new RuntimeException(exception);
  			}
  		};
  	}
  
  	@GraphQLField
  	@JsonProperty(access = JsonProperty.Access.READ_WRITE)
  	protected Source source;
  
  	@JsonIgnore
  	private Supplier<Source> _sourceSupplier;
  
  	@Override
  	public boolean equals(Object object) {
  		if (this == object) {
  			return true;
  		}
  
  		if (!(object instanceof Message)) {
  			return false;
  		}
  
  		Message message = (Message)object;
  
  		return Objects.equals(toString(), message.toString());
  	}
  
  	@Override
  	public int hashCode() {
  		String string = toString();
  
  		return string.hashCode();
  	}
  
  	public String toString() {
  		StringBundler sb = new StringBundler();
  
  		sb.append("{");
  
  		String content = getContent();
  
  		if (content != null) {
  			if (sb.length() > 1) {
  				sb.append(", ");
  			}
  
  			sb.append("\"content\": ");
  
  			sb.append("\"");
  
  			sb.append(_escape(content));
  
  			sb.append("\"");
  		}
  
  		Source source = getSource();
  
  		if (source != null) {
  			if (sb.length() > 1) {
  				sb.append(", ");
  			}
  
  			sb.append("\"source\": ");
  
  			sb.append("\"");
  
  			sb.append(source);
  
  			sb.append("\"");
  		}
  
  		sb.append("}");
  
  		return sb.toString();
  	}
  
  	@Schema(
  		accessMode = Schema.AccessMode.READ_ONLY,
  		defaultValue = "com.liferay.chatbot.dto.v1_0.Message",
  		name = "x-class-name"
  	)
  	public String xClassName;
  
  	@GraphQLName("Source")
  	public static enum Source {
  
  		USER("USER"), SYSTEM("SYSTEM");
  
  		@JsonCreator
  		public static Source create(String value) {
  			if ((value == null) || value.equals("")) {
  				return null;
  			}
  
  			for (Source source : values()) {
  				if (Objects.equals(source.getValue(), value)) {
  					return source;
  				}
  			}
  
  			throw new IllegalArgumentException("Invalid enum value: " + value);
  		}
  
  		@JsonValue
  		public String getValue() {
  			return _value;
  		}
  
  		@Override
  		public String toString() {
  			return _value;
  		}
  
  		private Source(String value) {
  			_value = value;
  		}
  
  		private final String _value;
  
  	}
  
  	private static String _escape(Object object) {
  		return StringUtil.replace(
  			String.valueOf(object), _JSON_ESCAPE_STRINGS[0],
  			_JSON_ESCAPE_STRINGS[1]);
  	}
  
  	private static boolean _isArray(Object value) {
  		if (value == null) {
  			return false;
  		}
  
  		Class<?> clazz = value.getClass();
  
  		return clazz.isArray();
  	}
  
  	private static String _toJSON(Map<String, ?> map) {
  		StringBuilder sb = new StringBuilder("{");
  
  		@SuppressWarnings("unchecked")
  		Set set = map.entrySet();
  
  		@SuppressWarnings("unchecked")
  		Iterator<Map.Entry<String, ?>> iterator = set.iterator();
  
  		while (iterator.hasNext()) {
  			Map.Entry<String, ?> entry = iterator.next();
  
  			sb.append("\"");
  			sb.append(_escape(entry.getKey()));
  			sb.append("\": ");
  
  			Object value = entry.getValue();
  
  			if (_isArray(value)) {
  				sb.append("[");
  
  				Object[] valueArray = (Object[])value;
  
  				for (int i = 0; i < valueArray.length; i++) {
  					if (valueArray[i] instanceof String) {
  						sb.append("\"");
  						sb.append(valueArray[i]);
  						sb.append("\"");
  					}
  					else {
  						sb.append(valueArray[i]);
  					}
  
  					if ((i + 1) < valueArray.length) {
  						sb.append(", ");
  					}
  				}
  
  				sb.append("]");
  			}
  			else if (value instanceof Map) {
  				sb.append(_toJSON((Map<String, ?>)value));
  			}
  			else if (value instanceof String) {
  				sb.append("\"");
  				sb.append(_escape(value));
  				sb.append("\"");
  			}
  			else {
  				sb.append(value);
  			}
  
  			if (iterator.hasNext()) {
  				sb.append(", ");
  			}
  		}
  
  		sb.append("}");
  
  		return sb.toString();
  	}
  
  	private static final String[][] _JSON_ESCAPE_STRINGS = {
  		{"\\", "\"", "\b", "\f", "\n", "\r", "\t"},
  		{"\\\\", "\\\"", "\\b", "\\f", "\\n", "\\r", "\\t"}
  	};
  
  	private Map<String, Serializable> _extendedProperties;
  
  }