All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zuora.model.PostCreateOrUpdateEmailTemplateRequestFormat Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
/*
 * Zuora API Reference
 * REST API reference for the Zuora Billing, Payments, and Central Platform! Check out the [REST API Overview](https://www.zuora.com/developer/api-references/api/overview/).
 *
 * The version of the OpenAPI document: 2024-05-20
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package com.zuora.model;

import java.util.Objects;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.zuora.model.PostCreateOrUpdateEmailTemplateRequestFormatCcEmailType;
import com.zuora.model.PostCreateOrUpdateEmailTemplateRequestFormatEncodingType;
import com.zuora.model.PostCreateOrUpdateEmailTemplateRequestFormatFromEmailType;
import com.zuora.model.PostCreateOrUpdateEmailTemplateRequestFormatReplyToEmailType;
import com.zuora.model.PostCreateOrUpdateEmailTemplateRequestFormatToEmailType;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Arrays;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.zuora.JSON;

/**
 * PostCreateOrUpdateEmailTemplateRequestFormat
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class PostCreateOrUpdateEmailTemplateRequestFormat {
  public static final String SERIALIZED_NAME_ACTIVE = "active";
  @SerializedName(SERIALIZED_NAME_ACTIVE)
  private Boolean active = true;

  public static final String SERIALIZED_NAME_BCC_EMAIL_ADDRESS = "bccEmailAddress";
  @SerializedName(SERIALIZED_NAME_BCC_EMAIL_ADDRESS)
  private String bccEmailAddress;

  public static final String SERIALIZED_NAME_CC_EMAIL_ADDRESS = "ccEmailAddress";
  @SerializedName(SERIALIZED_NAME_CC_EMAIL_ADDRESS)
  private String ccEmailAddress;

  public static final String SERIALIZED_NAME_CC_EMAIL_TYPE = "ccEmailType";
  @SerializedName(SERIALIZED_NAME_CC_EMAIL_TYPE)
  private PostCreateOrUpdateEmailTemplateRequestFormatCcEmailType ccEmailType = PostCreateOrUpdateEmailTemplateRequestFormatCcEmailType.SPECIFICEMAILS;

  public static final String SERIALIZED_NAME_DESCRIPTION = "description";
  @SerializedName(SERIALIZED_NAME_DESCRIPTION)
  private String description;

  public static final String SERIALIZED_NAME_EMAIL_BODY = "emailBody";
  @SerializedName(SERIALIZED_NAME_EMAIL_BODY)
  private String emailBody;

  public static final String SERIALIZED_NAME_EMAIL_SUBJECT = "emailSubject";
  @SerializedName(SERIALIZED_NAME_EMAIL_SUBJECT)
  private String emailSubject;

  public static final String SERIALIZED_NAME_ENCODING_TYPE = "encodingType";
  @SerializedName(SERIALIZED_NAME_ENCODING_TYPE)
  private PostCreateOrUpdateEmailTemplateRequestFormatEncodingType encodingType = PostCreateOrUpdateEmailTemplateRequestFormatEncodingType.UTF8;

  public static final String SERIALIZED_NAME_EVENT_CATEGORY = "eventCategory";
  @SerializedName(SERIALIZED_NAME_EVENT_CATEGORY)
  private BigDecimal eventCategory;

  public static final String SERIALIZED_NAME_EVENT_TYPE_NAME = "eventTypeName";
  @SerializedName(SERIALIZED_NAME_EVENT_TYPE_NAME)
  private String eventTypeName;

  public static final String SERIALIZED_NAME_EVENT_TYPE_NAMESPACE = "eventTypeNamespace";
  @SerializedName(SERIALIZED_NAME_EVENT_TYPE_NAMESPACE)
  private String eventTypeNamespace;

  public static final String SERIALIZED_NAME_FROM_EMAIL_ADDRESS = "fromEmailAddress";
  @SerializedName(SERIALIZED_NAME_FROM_EMAIL_ADDRESS)
  private String fromEmailAddress;

  public static final String SERIALIZED_NAME_FROM_EMAIL_TYPE = "fromEmailType";
  @SerializedName(SERIALIZED_NAME_FROM_EMAIL_TYPE)
  private PostCreateOrUpdateEmailTemplateRequestFormatFromEmailType fromEmailType;

  public static final String SERIALIZED_NAME_FROM_NAME = "fromName";
  @SerializedName(SERIALIZED_NAME_FROM_NAME)
  private String fromName;

  public static final String SERIALIZED_NAME_ID = "id";
  @SerializedName(SERIALIZED_NAME_ID)
  private String id;

  public static final String SERIALIZED_NAME_IS_HTML = "isHtml";
  @SerializedName(SERIALIZED_NAME_IS_HTML)
  private Boolean isHtml = false;

  public static final String SERIALIZED_NAME_NAME = "name";
  @SerializedName(SERIALIZED_NAME_NAME)
  private String name;

  public static final String SERIALIZED_NAME_REPLY_TO_EMAIL_ADDRESS = "replyToEmailAddress";
  @SerializedName(SERIALIZED_NAME_REPLY_TO_EMAIL_ADDRESS)
  private String replyToEmailAddress;

  public static final String SERIALIZED_NAME_REPLY_TO_EMAIL_TYPE = "replyToEmailType";
  @SerializedName(SERIALIZED_NAME_REPLY_TO_EMAIL_TYPE)
  private PostCreateOrUpdateEmailTemplateRequestFormatReplyToEmailType replyToEmailType;

  public static final String SERIALIZED_NAME_TO_EMAIL_ADDRESS = "toEmailAddress";
  @SerializedName(SERIALIZED_NAME_TO_EMAIL_ADDRESS)
  private String toEmailAddress;

  public static final String SERIALIZED_NAME_TO_EMAIL_TYPE = "toEmailType";
  @SerializedName(SERIALIZED_NAME_TO_EMAIL_TYPE)
  private PostCreateOrUpdateEmailTemplateRequestFormatToEmailType toEmailType;

  public PostCreateOrUpdateEmailTemplateRequestFormat() {
  }

  public PostCreateOrUpdateEmailTemplateRequestFormat active(Boolean active) {
    this.active = active;
    return this;
  }

  /**
   * The status of the email template. The default value is `true`.
   * @return active
   */
  @javax.annotation.Nullable
  public Boolean getActive() {
    return active;
  }

  public void setActive(Boolean active) {
    this.active = active;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat bccEmailAddress(String bccEmailAddress) {
    this.bccEmailAddress = bccEmailAddress;
    return this;
  }

  /**
   * The email bcc address.
   * @return bccEmailAddress
   */
  @javax.annotation.Nullable
  public String getBccEmailAddress() {
    return bccEmailAddress;
  }

  public void setBccEmailAddress(String bccEmailAddress) {
    this.bccEmailAddress = bccEmailAddress;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat ccEmailAddress(String ccEmailAddress) {
    this.ccEmailAddress = ccEmailAddress;
    return this;
  }

  /**
   * The email CC address.
   * @return ccEmailAddress
   */
  @javax.annotation.Nullable
  public String getCcEmailAddress() {
    return ccEmailAddress;
  }

  public void setCcEmailAddress(String ccEmailAddress) {
    this.ccEmailAddress = ccEmailAddress;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat ccEmailType(PostCreateOrUpdateEmailTemplateRequestFormatCcEmailType ccEmailType) {
    this.ccEmailType = ccEmailType;
    return this;
  }

  /**
   * Get ccEmailType
   * @return ccEmailType
   */
  @javax.annotation.Nullable
  public PostCreateOrUpdateEmailTemplateRequestFormatCcEmailType getCcEmailType() {
    return ccEmailType;
  }

  public void setCcEmailType(PostCreateOrUpdateEmailTemplateRequestFormatCcEmailType ccEmailType) {
    this.ccEmailType = ccEmailType;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat description(String description) {
    this.description = description;
    return this;
  }

  /**
   * The description of the email template.
   * @return description
   */
  @javax.annotation.Nullable
  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat emailBody(String emailBody) {
    this.emailBody = emailBody;
    return this;
  }

  /**
   * The email body. You can add merge fields in the email object using angle brackets.  You can also embed HTML tags if `isHtml` is `true`.
   * @return emailBody
   */
  @javax.annotation.Nonnull
  public String getEmailBody() {
    return emailBody;
  }

  public void setEmailBody(String emailBody) {
    this.emailBody = emailBody;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat emailSubject(String emailSubject) {
    this.emailSubject = emailSubject;
    return this;
  }

  /**
   * The email subject. Users can add merge fields in the email subject using angle brackets.
   * @return emailSubject
   */
  @javax.annotation.Nonnull
  public String getEmailSubject() {
    return emailSubject;
  }

  public void setEmailSubject(String emailSubject) {
    this.emailSubject = emailSubject;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat encodingType(PostCreateOrUpdateEmailTemplateRequestFormatEncodingType encodingType) {
    this.encodingType = encodingType;
    return this;
  }

  /**
   * Get encodingType
   * @return encodingType
   */
  @javax.annotation.Nullable
  public PostCreateOrUpdateEmailTemplateRequestFormatEncodingType getEncodingType() {
    return encodingType;
  }

  public void setEncodingType(PostCreateOrUpdateEmailTemplateRequestFormatEncodingType encodingType) {
    this.encodingType = encodingType;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat eventCategory(BigDecimal eventCategory) {
    this.eventCategory = eventCategory;
    return this;
  }

  /**
   * If you specify this field, the email template is created based on a standard event. See [Standard Event Categories](https://knowledgecenter.zuora.com/Central_Platform/Notifications/A_Standard_Events/Standard_Event_Category_Code_for_Notification_Histories_API) for all standard event category codes.     
   * @return eventCategory
   */
  @javax.annotation.Nullable
  public BigDecimal getEventCategory() {
    return eventCategory;
  }

  public void setEventCategory(BigDecimal eventCategory) {
    this.eventCategory = eventCategory;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat eventTypeName(String eventTypeName) {
    this.eventTypeName = eventTypeName;
    return this;
  }

  /**
   * The name of the custom event or custom scheduled event. If you specify this field, the email template is created based on the corresponding custom event or custom scheduled event. 
   * @return eventTypeName
   */
  @javax.annotation.Nullable
  public String getEventTypeName() {
    return eventTypeName;
  }

  public void setEventTypeName(String eventTypeName) {
    this.eventTypeName = eventTypeName;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat eventTypeNamespace(String eventTypeNamespace) {
    this.eventTypeNamespace = eventTypeNamespace;
    return this;
  }

  /**
   * The namespace of the `eventTypeName` field. The `eventTypeName` has the `user.notification` namespace by default.   Note that if the `eventTypeName` is a standard event type, you must specify the `com.zuora.notification` namespace; otherwise, you will get an error.  For example, if you want to create an email template on the `OrderActionProcessed` event, you must specify `com.zuora.notification` for this field.          
   * @return eventTypeNamespace
   */
  @javax.annotation.Nullable
  public String getEventTypeNamespace() {
    return eventTypeNamespace;
  }

  public void setEventTypeNamespace(String eventTypeNamespace) {
    this.eventTypeNamespace = eventTypeNamespace;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat fromEmailAddress(String fromEmailAddress) {
    this.fromEmailAddress = fromEmailAddress;
    return this;
  }

  /**
   * If fromEmailType is SpecificEmail, this field is required.
   * @return fromEmailAddress
   */
  @javax.annotation.Nullable
  public String getFromEmailAddress() {
    return fromEmailAddress;
  }

  public void setFromEmailAddress(String fromEmailAddress) {
    this.fromEmailAddress = fromEmailAddress;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat fromEmailType(PostCreateOrUpdateEmailTemplateRequestFormatFromEmailType fromEmailType) {
    this.fromEmailType = fromEmailType;
    return this;
  }

  /**
   * Get fromEmailType
   * @return fromEmailType
   */
  @javax.annotation.Nonnull
  public PostCreateOrUpdateEmailTemplateRequestFormatFromEmailType getFromEmailType() {
    return fromEmailType;
  }

  public void setFromEmailType(PostCreateOrUpdateEmailTemplateRequestFormatFromEmailType fromEmailType) {
    this.fromEmailType = fromEmailType;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat fromName(String fromName) {
    this.fromName = fromName;
    return this;
  }

  /**
   * The name of the email sender.
   * @return fromName
   */
  @javax.annotation.Nullable
  public String getFromName() {
    return fromName;
  }

  public void setFromName(String fromName) {
    this.fromName = fromName;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat id(String id) {
    this.id = id;
    return this;
  }

  /**
   * ID of an existing email template. Specify this field if you want to update an existing email template. 
   * @return id
   */
  @javax.annotation.Nullable
  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat isHtml(Boolean isHtml) {
    this.isHtml = isHtml;
    return this;
  }

  /**
   * Indicates whether the style of email body is HTML. The default value is `false`.
   * @return isHtml
   */
  @javax.annotation.Nullable
  public Boolean getIsHtml() {
    return isHtml;
  }

  public void setIsHtml(Boolean isHtml) {
    this.isHtml = isHtml;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat name(String name) {
    this.name = name;
    return this;
  }

  /**
   * The name of the email template, a unique name in a tenant.
   * @return name
   */
  @javax.annotation.Nonnull
  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat replyToEmailAddress(String replyToEmailAddress) {
    this.replyToEmailAddress = replyToEmailAddress;
    return this;
  }

  /**
   * If `replyToEmailType` is `SpecificEmail`, this field is required.
   * @return replyToEmailAddress
   */
  @javax.annotation.Nullable
  public String getReplyToEmailAddress() {
    return replyToEmailAddress;
  }

  public void setReplyToEmailAddress(String replyToEmailAddress) {
    this.replyToEmailAddress = replyToEmailAddress;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat replyToEmailType(PostCreateOrUpdateEmailTemplateRequestFormatReplyToEmailType replyToEmailType) {
    this.replyToEmailType = replyToEmailType;
    return this;
  }

  /**
   * Get replyToEmailType
   * @return replyToEmailType
   */
  @javax.annotation.Nullable
  public PostCreateOrUpdateEmailTemplateRequestFormatReplyToEmailType getReplyToEmailType() {
    return replyToEmailType;
  }

  public void setReplyToEmailType(PostCreateOrUpdateEmailTemplateRequestFormatReplyToEmailType replyToEmailType) {
    this.replyToEmailType = replyToEmailType;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat toEmailAddress(String toEmailAddress) {
    this.toEmailAddress = toEmailAddress;
    return this;
  }

  /**
   * If toEmailType is SpecificEmail, this field is required.
   * @return toEmailAddress
   */
  @javax.annotation.Nullable
  public String getToEmailAddress() {
    return toEmailAddress;
  }

  public void setToEmailAddress(String toEmailAddress) {
    this.toEmailAddress = toEmailAddress;
  }


  public PostCreateOrUpdateEmailTemplateRequestFormat toEmailType(PostCreateOrUpdateEmailTemplateRequestFormatToEmailType toEmailType) {
    this.toEmailType = toEmailType;
    return this;
  }

  /**
   * Get toEmailType
   * @return toEmailType
   */
  @javax.annotation.Nonnull
  public PostCreateOrUpdateEmailTemplateRequestFormatToEmailType getToEmailType() {
    return toEmailType;
  }

  public void setToEmailType(PostCreateOrUpdateEmailTemplateRequestFormatToEmailType toEmailType) {
    this.toEmailType = toEmailType;
  }

  /**
   * A container for additional, undeclared properties.
   * This is a holder for any undeclared properties as specified with
   * the 'additionalProperties' keyword in the OAS document.
   */
  private Map additionalProperties;

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   *
   * @param key name of the property
   * @param value value of the property
   * @return the PostCreateOrUpdateEmailTemplateRequestFormat instance itself
   */
  public PostCreateOrUpdateEmailTemplateRequestFormat putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Return the additional (undeclared) property.
   *
   * @return a map of objects
   */
  public Map getAdditionalProperties() {
    return additionalProperties;
  }

  /**
   * Return the additional (undeclared) property with the specified name.
   *
   * @param key name of the property
   * @return an object
   */
  public Object getAdditionalProperty(String key) {
    if (this.additionalProperties == null) {
        return null;
    }
    return this.additionalProperties.get(key);
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    PostCreateOrUpdateEmailTemplateRequestFormat postCreateOrUpdateEmailTemplateRequestFormat = (PostCreateOrUpdateEmailTemplateRequestFormat) o;
    return Objects.equals(this.active, postCreateOrUpdateEmailTemplateRequestFormat.active) &&
        Objects.equals(this.bccEmailAddress, postCreateOrUpdateEmailTemplateRequestFormat.bccEmailAddress) &&
        Objects.equals(this.ccEmailAddress, postCreateOrUpdateEmailTemplateRequestFormat.ccEmailAddress) &&
        Objects.equals(this.ccEmailType, postCreateOrUpdateEmailTemplateRequestFormat.ccEmailType) &&
        Objects.equals(this.description, postCreateOrUpdateEmailTemplateRequestFormat.description) &&
        Objects.equals(this.emailBody, postCreateOrUpdateEmailTemplateRequestFormat.emailBody) &&
        Objects.equals(this.emailSubject, postCreateOrUpdateEmailTemplateRequestFormat.emailSubject) &&
        Objects.equals(this.encodingType, postCreateOrUpdateEmailTemplateRequestFormat.encodingType) &&
        Objects.equals(this.eventCategory, postCreateOrUpdateEmailTemplateRequestFormat.eventCategory) &&
        Objects.equals(this.eventTypeName, postCreateOrUpdateEmailTemplateRequestFormat.eventTypeName) &&
        Objects.equals(this.eventTypeNamespace, postCreateOrUpdateEmailTemplateRequestFormat.eventTypeNamespace) &&
        Objects.equals(this.fromEmailAddress, postCreateOrUpdateEmailTemplateRequestFormat.fromEmailAddress) &&
        Objects.equals(this.fromEmailType, postCreateOrUpdateEmailTemplateRequestFormat.fromEmailType) &&
        Objects.equals(this.fromName, postCreateOrUpdateEmailTemplateRequestFormat.fromName) &&
        Objects.equals(this.id, postCreateOrUpdateEmailTemplateRequestFormat.id) &&
        Objects.equals(this.isHtml, postCreateOrUpdateEmailTemplateRequestFormat.isHtml) &&
        Objects.equals(this.name, postCreateOrUpdateEmailTemplateRequestFormat.name) &&
        Objects.equals(this.replyToEmailAddress, postCreateOrUpdateEmailTemplateRequestFormat.replyToEmailAddress) &&
        Objects.equals(this.replyToEmailType, postCreateOrUpdateEmailTemplateRequestFormat.replyToEmailType) &&
        Objects.equals(this.toEmailAddress, postCreateOrUpdateEmailTemplateRequestFormat.toEmailAddress) &&
        Objects.equals(this.toEmailType, postCreateOrUpdateEmailTemplateRequestFormat.toEmailType)&&
        Objects.equals(this.additionalProperties, postCreateOrUpdateEmailTemplateRequestFormat.additionalProperties);
  }

  @Override
  public int hashCode() {
    return Objects.hash(active, bccEmailAddress, ccEmailAddress, ccEmailType, description, emailBody, emailSubject, encodingType, eventCategory, eventTypeName, eventTypeNamespace, fromEmailAddress, fromEmailType, fromName, id, isHtml, name, replyToEmailAddress, replyToEmailType, toEmailAddress, toEmailType, additionalProperties);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class PostCreateOrUpdateEmailTemplateRequestFormat {\n");
    sb.append("    active: ").append(toIndentedString(active)).append("\n");
    sb.append("    bccEmailAddress: ").append(toIndentedString(bccEmailAddress)).append("\n");
    sb.append("    ccEmailAddress: ").append(toIndentedString(ccEmailAddress)).append("\n");
    sb.append("    ccEmailType: ").append(toIndentedString(ccEmailType)).append("\n");
    sb.append("    description: ").append(toIndentedString(description)).append("\n");
    sb.append("    emailBody: ").append(toIndentedString(emailBody)).append("\n");
    sb.append("    emailSubject: ").append(toIndentedString(emailSubject)).append("\n");
    sb.append("    encodingType: ").append(toIndentedString(encodingType)).append("\n");
    sb.append("    eventCategory: ").append(toIndentedString(eventCategory)).append("\n");
    sb.append("    eventTypeName: ").append(toIndentedString(eventTypeName)).append("\n");
    sb.append("    eventTypeNamespace: ").append(toIndentedString(eventTypeNamespace)).append("\n");
    sb.append("    fromEmailAddress: ").append(toIndentedString(fromEmailAddress)).append("\n");
    sb.append("    fromEmailType: ").append(toIndentedString(fromEmailType)).append("\n");
    sb.append("    fromName: ").append(toIndentedString(fromName)).append("\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    isHtml: ").append(toIndentedString(isHtml)).append("\n");
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    replyToEmailAddress: ").append(toIndentedString(replyToEmailAddress)).append("\n");
    sb.append("    replyToEmailType: ").append(toIndentedString(replyToEmailType)).append("\n");
    sb.append("    toEmailAddress: ").append(toIndentedString(toEmailAddress)).append("\n");
    sb.append("    toEmailType: ").append(toIndentedString(toEmailType)).append("\n");
    sb.append("    additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }


  public static HashSet openapiFields;
  public static HashSet openapiRequiredFields;

  static {
    // a set of all properties/fields (JSON key names)
    openapiFields = new HashSet();
    openapiFields.add("active");
    openapiFields.add("bccEmailAddress");
    openapiFields.add("ccEmailAddress");
    openapiFields.add("ccEmailType");
    openapiFields.add("description");
    openapiFields.add("emailBody");
    openapiFields.add("emailSubject");
    openapiFields.add("encodingType");
    openapiFields.add("eventCategory");
    openapiFields.add("eventTypeName");
    openapiFields.add("eventTypeNamespace");
    openapiFields.add("fromEmailAddress");
    openapiFields.add("fromEmailType");
    openapiFields.add("fromName");
    openapiFields.add("id");
    openapiFields.add("isHtml");
    openapiFields.add("name");
    openapiFields.add("replyToEmailAddress");
    openapiFields.add("replyToEmailType");
    openapiFields.add("toEmailAddress");
    openapiFields.add("toEmailType");

    // a set of required properties/fields (JSON key names)
    openapiRequiredFields = new HashSet();
    openapiRequiredFields.add("emailBody");
    openapiRequiredFields.add("emailSubject");
    openapiRequiredFields.add("fromEmailType");
    openapiRequiredFields.add("name");
    openapiRequiredFields.add("toEmailType");
  }

  /**
   * Validates the JSON Element and throws an exception if issues found
   *
   * @param jsonElement JSON Element
   * @throws IOException if the JSON Element is invalid with respect to PostCreateOrUpdateEmailTemplateRequestFormat
   */
  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
      if (jsonElement == null) {
        if (!PostCreateOrUpdateEmailTemplateRequestFormat.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
          throw new IllegalArgumentException(String.format("The required field(s) %s in PostCreateOrUpdateEmailTemplateRequestFormat is not found in the empty JSON string", PostCreateOrUpdateEmailTemplateRequestFormat.openapiRequiredFields.toString()));
        }
      }

      // check to make sure all required properties/fields are present in the JSON string
      for (String requiredField : PostCreateOrUpdateEmailTemplateRequestFormat.openapiRequiredFields) {
        if (jsonElement.getAsJsonObject().get(requiredField) == null) {
          throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString()));
        }
      }
        JsonObject jsonObj = jsonElement.getAsJsonObject();
      if ((jsonObj.get("bccEmailAddress") != null && !jsonObj.get("bccEmailAddress").isJsonNull()) && !jsonObj.get("bccEmailAddress").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `bccEmailAddress` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bccEmailAddress").toString()));
      }
      if ((jsonObj.get("ccEmailAddress") != null && !jsonObj.get("ccEmailAddress").isJsonNull()) && !jsonObj.get("ccEmailAddress").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `ccEmailAddress` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ccEmailAddress").toString()));
      }
      // validate the optional field `ccEmailType`
      if (jsonObj.get("ccEmailType") != null && !jsonObj.get("ccEmailType").isJsonNull()) {
        PostCreateOrUpdateEmailTemplateRequestFormatCcEmailType.validateJsonElement(jsonObj.get("ccEmailType"));
      }
      if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
      }
      if (!jsonObj.get("emailBody").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `emailBody` to be a primitive type in the JSON string but got `%s`", jsonObj.get("emailBody").toString()));
      }
      if (!jsonObj.get("emailSubject").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `emailSubject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("emailSubject").toString()));
      }
      // validate the optional field `encodingType`
      if (jsonObj.get("encodingType") != null && !jsonObj.get("encodingType").isJsonNull()) {
        PostCreateOrUpdateEmailTemplateRequestFormatEncodingType.validateJsonElement(jsonObj.get("encodingType"));
      }
      if ((jsonObj.get("eventTypeName") != null && !jsonObj.get("eventTypeName").isJsonNull()) && !jsonObj.get("eventTypeName").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `eventTypeName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventTypeName").toString()));
      }
      if ((jsonObj.get("eventTypeNamespace") != null && !jsonObj.get("eventTypeNamespace").isJsonNull()) && !jsonObj.get("eventTypeNamespace").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `eventTypeNamespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventTypeNamespace").toString()));
      }
      if ((jsonObj.get("fromEmailAddress") != null && !jsonObj.get("fromEmailAddress").isJsonNull()) && !jsonObj.get("fromEmailAddress").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `fromEmailAddress` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fromEmailAddress").toString()));
      }
      // validate the required field `fromEmailType`
      PostCreateOrUpdateEmailTemplateRequestFormatFromEmailType.validateJsonElement(jsonObj.get("fromEmailType"));
      if ((jsonObj.get("fromName") != null && !jsonObj.get("fromName").isJsonNull()) && !jsonObj.get("fromName").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `fromName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fromName").toString()));
      }
      if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
      }
      if (!jsonObj.get("name").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
      }
      if ((jsonObj.get("replyToEmailAddress") != null && !jsonObj.get("replyToEmailAddress").isJsonNull()) && !jsonObj.get("replyToEmailAddress").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `replyToEmailAddress` to be a primitive type in the JSON string but got `%s`", jsonObj.get("replyToEmailAddress").toString()));
      }
      // validate the optional field `replyToEmailType`
      if (jsonObj.get("replyToEmailType") != null && !jsonObj.get("replyToEmailType").isJsonNull()) {
        PostCreateOrUpdateEmailTemplateRequestFormatReplyToEmailType.validateJsonElement(jsonObj.get("replyToEmailType"));
      }
      if ((jsonObj.get("toEmailAddress") != null && !jsonObj.get("toEmailAddress").isJsonNull()) && !jsonObj.get("toEmailAddress").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `toEmailAddress` to be a primitive type in the JSON string but got `%s`", jsonObj.get("toEmailAddress").toString()));
      }
      // validate the required field `toEmailType`
      PostCreateOrUpdateEmailTemplateRequestFormatToEmailType.validateJsonElement(jsonObj.get("toEmailType"));
  }

  public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
    @SuppressWarnings("unchecked")
    @Override
    public  TypeAdapter create(Gson gson, TypeToken type) {
       if (!PostCreateOrUpdateEmailTemplateRequestFormat.class.isAssignableFrom(type.getRawType())) {
         return null; // this class only serializes 'PostCreateOrUpdateEmailTemplateRequestFormat' and its subtypes
       }
       final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
       final TypeAdapter thisAdapter
                        = gson.getDelegateAdapter(this, TypeToken.get(PostCreateOrUpdateEmailTemplateRequestFormat.class));

       return (TypeAdapter) new TypeAdapter() {
           @Override
           public void write(JsonWriter out, PostCreateOrUpdateEmailTemplateRequestFormat value) throws IOException {
             JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
             obj.remove("additionalProperties");

             // support null values
             out.beginObject();
             Iterator iterator = obj.entrySet().iterator();
             while(iterator.hasNext()) {
                 Map.Entry e = (Map.Entry) iterator.next();
                 out.name((String)e.getKey());
                 elementAdapter.write(out, e.getValue());
             }

             // end

             // serialize additional properties
             if (value.getAdditionalProperties() != null) {
               // support null values
               boolean oldSerializeNulls = out.getSerializeNulls();
               out.setSerializeNulls(true); //force serialize
               // end
               for (Map.Entry entry : value.getAdditionalProperties().entrySet()) {
                 if (entry.getValue() instanceof String)
                   obj.addProperty(entry.getKey(), (String) entry.getValue());
                 else if (entry.getValue() instanceof Number)
                   obj.addProperty(entry.getKey(), (Number) entry.getValue());
                 else if (entry.getValue() instanceof Boolean)
                   obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
                 else if (entry.getValue() instanceof Character)
                   obj.addProperty(entry.getKey(), (Character) entry.getValue());
                 else if (entry.getValue() == null)
                    obj.add(entry.getKey(), null);
                 else {
                   JsonElement jsonElement = gson.toJsonTree(entry.getValue());
                   if (jsonElement.isJsonArray()) {
                     obj.add(entry.getKey(), jsonElement.getAsJsonArray());
                   } else {
                     obj.add(entry.getKey(), jsonElement.getAsJsonObject());
                   }
                 }
                 out.name((String)entry.getKey());
                 elementAdapter.write(out, obj.get(entry.getKey()));
               }
               out.setSerializeNulls(oldSerializeNulls); //restore
             }
             out.endObject();

           }

           @Override
           public PostCreateOrUpdateEmailTemplateRequestFormat read(JsonReader in) throws IOException {
             JsonElement jsonElement = elementAdapter.read(in);
             validateJsonElement(jsonElement);
             JsonObject jsonObj = jsonElement.getAsJsonObject();
             // store additional fields in the deserialized instance
             PostCreateOrUpdateEmailTemplateRequestFormat instance = thisAdapter.fromJsonTree(jsonObj);
             for (Map.Entry entry : jsonObj.entrySet()) {
               if (!openapiFields.contains(entry.getKey())) {
                 if (entry.getValue().isJsonPrimitive()) { // primitive type
                   if (entry.getValue().getAsJsonPrimitive().isString())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
                   else if (entry.getValue().getAsJsonPrimitive().isNumber())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
                   else if (entry.getValue().getAsJsonPrimitive().isBoolean())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
                   else
                     throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
                 } else if (entry.getValue().isJsonArray()) {
                     instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
                 } else { // JSON object
                     instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
                 }
               }
             }
             return instance;
           }

       }.nullSafe();
    }
  }

  /**
   * Create an instance of PostCreateOrUpdateEmailTemplateRequestFormat given an JSON string
   *
   * @param jsonString JSON string
   * @return An instance of PostCreateOrUpdateEmailTemplateRequestFormat
   * @throws IOException if the JSON string is invalid with respect to PostCreateOrUpdateEmailTemplateRequestFormat
   */
  public static PostCreateOrUpdateEmailTemplateRequestFormat fromJson(String jsonString) throws IOException {
    return JSON.getGson().fromJson(jsonString, PostCreateOrUpdateEmailTemplateRequestFormat.class);
  }

  /**
   * Convert an instance of PostCreateOrUpdateEmailTemplateRequestFormat to an JSON string
   *
   * @return JSON string
   */
  public String toJson() {
    return JSON.getGson().toJson(this);
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy