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

com.alipay.v3.model.KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel Maven / Gradle / Ivy

There is a newer version: 3.1.6.ALL
Show newest version
/*
 * 支付宝开放平台API
 * 支付宝开放平台v3协议文档
 *
 * The version of the OpenAPI document: 2024-01-12
 * 
 *
 * 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.alipay.v3.model;

import java.util.Objects;
import java.util.Arrays;
import com.alipay.v3.model.MerchantActivityVoucherInfo;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

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 java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import com.alipay.v3.JSON;

/**
 * KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel {
  public static final String SERIALIZED_NAME_ACTIVITY_ID = "activity_id";
  @SerializedName(SERIALIZED_NAME_ACTIVITY_ID)
  private String activityId;

  public static final String SERIALIZED_NAME_CAMP_ID = "camp_id";
  @SerializedName(SERIALIZED_NAME_CAMP_ID)
  private String campId;

  public static final String SERIALIZED_NAME_COUNT_LIMIT = "count_limit";
  @SerializedName(SERIALIZED_NAME_COUNT_LIMIT)
  private Integer countLimit;

  public static final String SERIALIZED_NAME_COUNT_LIMIT_PER_DAY = "count_limit_per_day";
  @SerializedName(SERIALIZED_NAME_COUNT_LIMIT_PER_DAY)
  private Integer countLimitPerDay;

  public static final String SERIALIZED_NAME_COUNT_LIMIT_PER_USER = "count_limit_per_user";
  @SerializedName(SERIALIZED_NAME_COUNT_LIMIT_PER_USER)
  private Integer countLimitPerUser;

  public static final String SERIALIZED_NAME_COUNT_LIMIT_PER_USER_PER_DAY = "count_limit_per_user_per_day";
  @SerializedName(SERIALIZED_NAME_COUNT_LIMIT_PER_USER_PER_DAY)
  private Integer countLimitPerUserPerDay;

  public static final String SERIALIZED_NAME_CROWD = "crowd";
  @SerializedName(SERIALIZED_NAME_CROWD)
  private String crowd;

  public static final String SERIALIZED_NAME_DEDUCT_AMOUNT = "deduct_amount";
  @SerializedName(SERIALIZED_NAME_DEDUCT_AMOUNT)
  private String deductAmount;

  public static final String SERIALIZED_NAME_EXTERNAL_UNIQUE_ID = "external_unique_id";
  @SerializedName(SERIALIZED_NAME_EXTERNAL_UNIQUE_ID)
  private String externalUniqueId;

  public static final String SERIALIZED_NAME_GMT_END = "gmt_end";
  @SerializedName(SERIALIZED_NAME_GMT_END)
  private String gmtEnd;

  public static final String SERIALIZED_NAME_GMT_START = "gmt_start";
  @SerializedName(SERIALIZED_NAME_GMT_START)
  private String gmtStart;

  public static final String SERIALIZED_NAME_ITEM_IDS = "item_ids";
  @SerializedName(SERIALIZED_NAME_ITEM_IDS)
  private List itemIds = null;

  public static final String SERIALIZED_NAME_MEMO = "memo";
  @SerializedName(SERIALIZED_NAME_MEMO)
  private String memo;

  public static final String SERIALIZED_NAME_MIN_COST = "min_cost";
  @SerializedName(SERIALIZED_NAME_MIN_COST)
  private String minCost;

  public static final String SERIALIZED_NAME_OBTAIN_MANUALLY = "obtain_manually";
  @SerializedName(SERIALIZED_NAME_OBTAIN_MANUALLY)
  private Boolean obtainManually;

  public static final String SERIALIZED_NAME_VOUCHER_INFO = "voucher_info";
  @SerializedName(SERIALIZED_NAME_VOUCHER_INFO)
  private MerchantActivityVoucherInfo voucherInfo;

  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel() { 
  }

  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel activityId(String activityId) {
    
    this.activityId = activityId;
    return this;
  }

   /**
   * 活动Id
   * @return activityId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2018xxxx", value = "活动Id")

  public String getActivityId() {
    return activityId;
  }


  public void setActivityId(String activityId) {
    this.activityId = activityId;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel campId(String campId) {
    
    this.campId = campId;
    return this;
  }

   /**
   * 营销活动id
   * @return campId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2018xxxx", value = "营销活动id")

  public String getCampId() {
    return campId;
  }


  public void setCampId(String campId) {
    this.campId = campId;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel countLimit(Integer countLimit) {
    
    this.countLimit = countLimit;
    return this;
  }

   /**
   * 活动优惠次数限制
   * @return countLimit
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "99", value = "活动优惠次数限制")

  public Integer getCountLimit() {
    return countLimit;
  }


  public void setCountLimit(Integer countLimit) {
    this.countLimit = countLimit;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel countLimitPerDay(Integer countLimitPerDay) {
    
    this.countLimitPerDay = countLimitPerDay;
    return this;
  }

   /**
   * 活动优惠单日次数限制
   * @return countLimitPerDay
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "99", value = "活动优惠单日次数限制")

  public Integer getCountLimitPerDay() {
    return countLimitPerDay;
  }


  public void setCountLimitPerDay(Integer countLimitPerDay) {
    this.countLimitPerDay = countLimitPerDay;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel countLimitPerUser(Integer countLimitPerUser) {
    
    this.countLimitPerUser = countLimitPerUser;
    return this;
  }

   /**
   * 活动单用户限次
   * @return countLimitPerUser
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "99", value = "活动单用户限次")

  public Integer getCountLimitPerUser() {
    return countLimitPerUser;
  }


  public void setCountLimitPerUser(Integer countLimitPerUser) {
    this.countLimitPerUser = countLimitPerUser;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel countLimitPerUserPerDay(Integer countLimitPerUserPerDay) {
    
    this.countLimitPerUserPerDay = countLimitPerUserPerDay;
    return this;
  }

   /**
   * 活动单用户单日限次
   * @return countLimitPerUserPerDay
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "99", value = "活动单用户单日限次")

  public Integer getCountLimitPerUserPerDay() {
    return countLimitPerUserPerDay;
  }


  public void setCountLimitPerUserPerDay(Integer countLimitPerUserPerDay) {
    this.countLimitPerUserPerDay = countLimitPerUserPerDay;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel crowd(String crowd) {
    
    this.crowd = crowd;
    return this;
  }

   /**
   * 人群规则  DEFAULT:全部用户  ONLINE_NEWCOMER:在线购买新人  MEMBER:会员
   * @return crowd
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "DEFAULT", value = "人群规则  DEFAULT:全部用户  ONLINE_NEWCOMER:在线购买新人  MEMBER:会员")

  public String getCrowd() {
    return crowd;
  }


  public void setCrowd(String crowd) {
    this.crowd = crowd;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel deductAmount(String deductAmount) {
    
    this.deductAmount = deductAmount;
    return this;
  }

   /**
   * 代金券面额
   * @return deductAmount
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "5.00", value = "代金券面额")

  public String getDeductAmount() {
    return deductAmount;
  }


  public void setDeductAmount(String deductAmount) {
    this.deductAmount = deductAmount;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel externalUniqueId(String externalUniqueId) {
    
    this.externalUniqueId = externalUniqueId;
    return this;
  }

   /**
   * 外部Id
   * @return externalUniqueId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "xxxxxxx", value = "外部Id")

  public String getExternalUniqueId() {
    return externalUniqueId;
  }


  public void setExternalUniqueId(String externalUniqueId) {
    this.externalUniqueId = externalUniqueId;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel gmtEnd(String gmtEnd) {
    
    this.gmtEnd = gmtEnd;
    return this;
  }

   /**
   * 活动结束时间  格式为:yyyy-MM-dd HH:mm:ss
   * @return gmtEnd
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2017-12-26 21:07:23", value = "活动结束时间  格式为:yyyy-MM-dd HH:mm:ss")

  public String getGmtEnd() {
    return gmtEnd;
  }


  public void setGmtEnd(String gmtEnd) {
    this.gmtEnd = gmtEnd;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel gmtStart(String gmtStart) {
    
    this.gmtStart = gmtStart;
    return this;
  }

   /**
   * 活动开始时间,格式为:yyyy-MM-dd HH:mm:ss
   * @return gmtStart
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2017-12-26 21:07:23", value = "活动开始时间,格式为:yyyy-MM-dd HH:mm:ss")

  public String getGmtStart() {
    return gmtStart;
  }


  public void setGmtStart(String gmtStart) {
    this.gmtStart = gmtStart;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel itemIds(List itemIds) {
    
    this.itemIds = itemIds;
    return this;
  }

  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel addItemIdsItem(String itemIdsItem) {
    if (this.itemIds == null) {
      this.itemIds = new ArrayList<>();
    }
    this.itemIds.add(itemIdsItem);
    return this;
  }

   /**
   * 商品列表
   * @return itemIds
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "[\"2018xxxx\",\"2018xxxx\"]", value = "商品列表")

  public List getItemIds() {
    return itemIds;
  }


  public void setItemIds(List itemIds) {
    this.itemIds = itemIds;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel memo(String memo) {
    
    this.memo = memo;
    return this;
  }

   /**
   * 备注
   * @return memo
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "备注", value = "备注")

  public String getMemo() {
    return memo;
  }


  public void setMemo(String memo) {
    this.memo = memo;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel minCost(String minCost) {
    
    this.minCost = minCost;
    return this;
  }

   /**
   * 使用门槛,满X元可用,使用门槛必须大于券面额
   * @return minCost
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "5.00", value = "使用门槛,满X元可用,使用门槛必须大于券面额")

  public String getMinCost() {
    return minCost;
  }


  public void setMinCost(String minCost) {
    this.minCost = minCost;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel obtainManually(Boolean obtainManually) {
    
    this.obtainManually = obtainManually;
    return this;
  }

   /**
   * 是否手动领取,本期只支持true
   * @return obtainManually
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "true", value = "是否手动领取,本期只支持true")

  public Boolean getObtainManually() {
    return obtainManually;
  }


  public void setObtainManually(Boolean obtainManually) {
    this.obtainManually = obtainManually;
  }


  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel voucherInfo(MerchantActivityVoucherInfo voucherInfo) {
    
    this.voucherInfo = voucherInfo;
    return this;
  }

   /**
   * Get voucherInfo
   * @return voucherInfo
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")

  public MerchantActivityVoucherInfo getVoucherInfo() {
    return voucherInfo;
  }


  public void setVoucherInfo(MerchantActivityVoucherInfo voucherInfo) {
    this.voucherInfo = voucherInfo;
  }

  /**
   * 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 KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel instance itself
   */
  public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel 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;
    }
    KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel koubeiMarketingCampaignItemMerchantactivityQueryResponseModel = (KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel) o;
    return Objects.equals(this.activityId, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.activityId) &&
        Objects.equals(this.campId, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.campId) &&
        Objects.equals(this.countLimit, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.countLimit) &&
        Objects.equals(this.countLimitPerDay, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.countLimitPerDay) &&
        Objects.equals(this.countLimitPerUser, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.countLimitPerUser) &&
        Objects.equals(this.countLimitPerUserPerDay, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.countLimitPerUserPerDay) &&
        Objects.equals(this.crowd, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.crowd) &&
        Objects.equals(this.deductAmount, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.deductAmount) &&
        Objects.equals(this.externalUniqueId, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.externalUniqueId) &&
        Objects.equals(this.gmtEnd, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.gmtEnd) &&
        Objects.equals(this.gmtStart, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.gmtStart) &&
        Objects.equals(this.itemIds, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.itemIds) &&
        Objects.equals(this.memo, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.memo) &&
        Objects.equals(this.minCost, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.minCost) &&
        Objects.equals(this.obtainManually, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.obtainManually) &&
        Objects.equals(this.voucherInfo, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.voucherInfo)&&
        Objects.equals(this.additionalProperties, koubeiMarketingCampaignItemMerchantactivityQueryResponseModel.additionalProperties);
  }

  @Override
  public int hashCode() {
    return Objects.hash(activityId, campId, countLimit, countLimitPerDay, countLimitPerUser, countLimitPerUserPerDay, crowd, deductAmount, externalUniqueId, gmtEnd, gmtStart, itemIds, memo, minCost, obtainManually, voucherInfo, additionalProperties);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel {\n");
    sb.append("    activityId: ").append(toIndentedString(activityId)).append("\n");
    sb.append("    campId: ").append(toIndentedString(campId)).append("\n");
    sb.append("    countLimit: ").append(toIndentedString(countLimit)).append("\n");
    sb.append("    countLimitPerDay: ").append(toIndentedString(countLimitPerDay)).append("\n");
    sb.append("    countLimitPerUser: ").append(toIndentedString(countLimitPerUser)).append("\n");
    sb.append("    countLimitPerUserPerDay: ").append(toIndentedString(countLimitPerUserPerDay)).append("\n");
    sb.append("    crowd: ").append(toIndentedString(crowd)).append("\n");
    sb.append("    deductAmount: ").append(toIndentedString(deductAmount)).append("\n");
    sb.append("    externalUniqueId: ").append(toIndentedString(externalUniqueId)).append("\n");
    sb.append("    gmtEnd: ").append(toIndentedString(gmtEnd)).append("\n");
    sb.append("    gmtStart: ").append(toIndentedString(gmtStart)).append("\n");
    sb.append("    itemIds: ").append(toIndentedString(itemIds)).append("\n");
    sb.append("    memo: ").append(toIndentedString(memo)).append("\n");
    sb.append("    minCost: ").append(toIndentedString(minCost)).append("\n");
    sb.append("    obtainManually: ").append(toIndentedString(obtainManually)).append("\n");
    sb.append("    voucherInfo: ").append(toIndentedString(voucherInfo)).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("activity_id");
    openapiFields.add("camp_id");
    openapiFields.add("count_limit");
    openapiFields.add("count_limit_per_day");
    openapiFields.add("count_limit_per_user");
    openapiFields.add("count_limit_per_user_per_day");
    openapiFields.add("crowd");
    openapiFields.add("deduct_amount");
    openapiFields.add("external_unique_id");
    openapiFields.add("gmt_end");
    openapiFields.add("gmt_start");
    openapiFields.add("item_ids");
    openapiFields.add("memo");
    openapiFields.add("min_cost");
    openapiFields.add("obtain_manually");
    openapiFields.add("voucher_info");

    // a set of required properties/fields (JSON key names)
    openapiRequiredFields = new HashSet();
  }

 /**
  * Validates the JSON Object and throws an exception if issues found
  *
  * @param jsonObj JSON Object
  * @throws IOException if the JSON Object is invalid with respect to KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel
  */
  public static void validateJsonObject(JsonObject jsonObj) throws IOException {
      if (jsonObj == null) {
        if (KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel.openapiRequiredFields.isEmpty()) {
          return;
        } else { // has required fields
          throw new IllegalArgumentException(String.format("The required field(s) %s in KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel is not found in the empty JSON string", KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel.openapiRequiredFields.toString()));
        }
      }
      if (jsonObj.get("activity_id") != null && !jsonObj.get("activity_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `activity_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("activity_id").toString()));
      }
      if (jsonObj.get("camp_id") != null && !jsonObj.get("camp_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `camp_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("camp_id").toString()));
      }
      if (jsonObj.get("crowd") != null && !jsonObj.get("crowd").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `crowd` to be a primitive type in the JSON string but got `%s`", jsonObj.get("crowd").toString()));
      }
      if (jsonObj.get("deduct_amount") != null && !jsonObj.get("deduct_amount").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `deduct_amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deduct_amount").toString()));
      }
      if (jsonObj.get("external_unique_id") != null && !jsonObj.get("external_unique_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `external_unique_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("external_unique_id").toString()));
      }
      if (jsonObj.get("gmt_end") != null && !jsonObj.get("gmt_end").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `gmt_end` to be a primitive type in the JSON string but got `%s`", jsonObj.get("gmt_end").toString()));
      }
      if (jsonObj.get("gmt_start") != null && !jsonObj.get("gmt_start").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `gmt_start` to be a primitive type in the JSON string but got `%s`", jsonObj.get("gmt_start").toString()));
      }
      // ensure the json data is an array
      if (jsonObj.get("item_ids") != null && !jsonObj.get("item_ids").isJsonArray()) {
        throw new IllegalArgumentException(String.format("Expected the field `item_ids` to be an array in the JSON string but got `%s`", jsonObj.get("item_ids").toString()));
      }
      if (jsonObj.get("memo") != null && !jsonObj.get("memo").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `memo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("memo").toString()));
      }
      if (jsonObj.get("min_cost") != null && !jsonObj.get("min_cost").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `min_cost` to be a primitive type in the JSON string but got `%s`", jsonObj.get("min_cost").toString()));
      }
      // validate the optional field `voucher_info`
      if (jsonObj.getAsJsonObject("voucher_info") != null) {
        MerchantActivityVoucherInfo.validateJsonObject(jsonObj.getAsJsonObject("voucher_info"));
      }
  }

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

       return (TypeAdapter) new TypeAdapter() {
           @Override
           public void write(JsonWriter out, KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel value) throws IOException {
             JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
             obj.remove("additionalProperties");
             // serialize additonal properties
             if (value.getAdditionalProperties() != null) {
               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 {
                   obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
                 }
               }
             }
             elementAdapter.write(out, obj);
           }

           @Override
           public KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel read(JsonReader in) throws IOException {
             JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
             validateJsonObject(jsonObj);
             // store additional fields in the deserialized instance
             KoubeiMarketingCampaignItemMerchantactivityQueryResponseModel 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 { // non-primitive type
                   instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
                 }
               }
             }
             return instance;
           }

       }.nullSafe();
    }
  }

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

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy