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

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

The newest version!
/*
 * 支付宝开放平台API
 * 支付宝开放平台v3协议文档
 *
 * The version of the OpenAPI document: 2024-08-30
 * 
 *
 * 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.InvoiceItemContent;
import com.alipay.v3.model.InvoiceTitleModel;
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;

/**
 * InvoiceModelContent
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class InvoiceModelContent {
  public static final String SERIALIZED_NAME_APPLY_ID = "apply_id";
  @SerializedName(SERIALIZED_NAME_APPLY_ID)
  private String applyId;

  public static final String SERIALIZED_NAME_EXTEND_FIELDS = "extend_fields";
  @SerializedName(SERIALIZED_NAME_EXTEND_FIELDS)
  private String extendFields;

  public static final String SERIALIZED_NAME_FILE_DOWNLOAD_TYPE = "file_download_type";
  @SerializedName(SERIALIZED_NAME_FILE_DOWNLOAD_TYPE)
  private String fileDownloadType;

  public static final String SERIALIZED_NAME_FILE_DOWNLOAD_URL = "file_download_url";
  @SerializedName(SERIALIZED_NAME_FILE_DOWNLOAD_URL)
  private String fileDownloadUrl;

  public static final String SERIALIZED_NAME_FINANCIAL_ELECTRONIC_TYPE = "financial_electronic_type";
  @SerializedName(SERIALIZED_NAME_FINANCIAL_ELECTRONIC_TYPE)
  private String financialElectronicType;

  public static final String SERIALIZED_NAME_INVOICE_AMOUNT = "invoice_amount";
  @SerializedName(SERIALIZED_NAME_INVOICE_AMOUNT)
  private String invoiceAmount;

  public static final String SERIALIZED_NAME_INVOICE_CODE = "invoice_code";
  @SerializedName(SERIALIZED_NAME_INVOICE_CODE)
  private String invoiceCode;

  public static final String SERIALIZED_NAME_INVOICE_CONTENT = "invoice_content";
  @SerializedName(SERIALIZED_NAME_INVOICE_CONTENT)
  private List invoiceContent = null;

  public static final String SERIALIZED_NAME_INVOICE_DATE = "invoice_date";
  @SerializedName(SERIALIZED_NAME_INVOICE_DATE)
  private String invoiceDate;

  public static final String SERIALIZED_NAME_INVOICE_FAKE_CODE = "invoice_fake_code";
  @SerializedName(SERIALIZED_NAME_INVOICE_FAKE_CODE)
  private String invoiceFakeCode;

  public static final String SERIALIZED_NAME_INVOICE_FILE_DATA = "invoice_file_data";
  @SerializedName(SERIALIZED_NAME_INVOICE_FILE_DATA)
  private String invoiceFileData;

  public static final String SERIALIZED_NAME_INVOICE_IMG_URL = "invoice_img_url";
  @SerializedName(SERIALIZED_NAME_INVOICE_IMG_URL)
  private String invoiceImgUrl;

  public static final String SERIALIZED_NAME_INVOICE_NO = "invoice_no";
  @SerializedName(SERIALIZED_NAME_INVOICE_NO)
  private String invoiceNo;

  public static final String SERIALIZED_NAME_INVOICE_OPERATOR = "invoice_operator";
  @SerializedName(SERIALIZED_NAME_INVOICE_OPERATOR)
  private String invoiceOperator;

  public static final String SERIALIZED_NAME_INVOICE_TITLE = "invoice_title";
  @SerializedName(SERIALIZED_NAME_INVOICE_TITLE)
  private InvoiceTitleModel invoiceTitle;

  public static final String SERIALIZED_NAME_INVOICE_TYPE = "invoice_type";
  @SerializedName(SERIALIZED_NAME_INVOICE_TYPE)
  private String invoiceType;

  public static final String SERIALIZED_NAME_OPEN_ID = "open_id";
  @SerializedName(SERIALIZED_NAME_OPEN_ID)
  private String openId;

  public static final String SERIALIZED_NAME_ORIGINAL_BLUE_INVOICE_CODE = "original_blue_invoice_code";
  @SerializedName(SERIALIZED_NAME_ORIGINAL_BLUE_INVOICE_CODE)
  private String originalBlueInvoiceCode;

  public static final String SERIALIZED_NAME_ORIGINAL_BLUE_INVOICE_NO = "original_blue_invoice_no";
  @SerializedName(SERIALIZED_NAME_ORIGINAL_BLUE_INVOICE_NO)
  private String originalBlueInvoiceNo;

  public static final String SERIALIZED_NAME_OUT_BIZ_NO = "out_biz_no";
  @SerializedName(SERIALIZED_NAME_OUT_BIZ_NO)
  private String outBizNo;

  public static final String SERIALIZED_NAME_OUT_INVOICE_ID = "out_invoice_id";
  @SerializedName(SERIALIZED_NAME_OUT_INVOICE_ID)
  private String outInvoiceId;

  public static final String SERIALIZED_NAME_REGISTER_ADDRESS = "register_address";
  @SerializedName(SERIALIZED_NAME_REGISTER_ADDRESS)
  private String registerAddress;

  public static final String SERIALIZED_NAME_REGISTER_BANK_ACCOUNT = "register_bank_account";
  @SerializedName(SERIALIZED_NAME_REGISTER_BANK_ACCOUNT)
  private String registerBankAccount;

  public static final String SERIALIZED_NAME_REGISTER_BANK_NAME = "register_bank_name";
  @SerializedName(SERIALIZED_NAME_REGISTER_BANK_NAME)
  private String registerBankName;

  public static final String SERIALIZED_NAME_REGISTER_NAME = "register_name";
  @SerializedName(SERIALIZED_NAME_REGISTER_NAME)
  private String registerName;

  public static final String SERIALIZED_NAME_REGISTER_NO = "register_no";
  @SerializedName(SERIALIZED_NAME_REGISTER_NO)
  private String registerNo;

  public static final String SERIALIZED_NAME_REGISTER_PHONE_NO = "register_phone_no";
  @SerializedName(SERIALIZED_NAME_REGISTER_PHONE_NO)
  private String registerPhoneNo;

  public static final String SERIALIZED_NAME_SUM_AMOUNT = "sum_amount";
  @SerializedName(SERIALIZED_NAME_SUM_AMOUNT)
  private String sumAmount;

  public static final String SERIALIZED_NAME_TAX_AMOUNT = "tax_amount";
  @SerializedName(SERIALIZED_NAME_TAX_AMOUNT)
  private String taxAmount;

  public static final String SERIALIZED_NAME_TAX_TYPE = "tax_type";
  @SerializedName(SERIALIZED_NAME_TAX_TYPE)
  private String taxType;

  public static final String SERIALIZED_NAME_USER_ID = "user_id";
  @SerializedName(SERIALIZED_NAME_USER_ID)
  private String userId;

  public InvoiceModelContent() { 
  }

  public InvoiceModelContent applyId(String applyId) {
    
    this.applyId = applyId;
    return this;
  }

   /**
   * 支付宝端的申请id。如果在开票过程中,是通过支付宝提交的申请到机构端,支付宝会带上开票申请在支付宝生成的申请id,机构在回传发票的时候只需要回传这个申请id,不用获取用户的uid,支付宝可以根据申请id将发票归集到对应的用户名下
   * @return applyId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2016112800152005000000000239", value = "支付宝端的申请id。如果在开票过程中,是通过支付宝提交的申请到机构端,支付宝会带上开票申请在支付宝生成的申请id,机构在回传发票的时候只需要回传这个申请id,不用获取用户的uid,支付宝可以根据申请id将发票归集到对应的用户名下")

  public String getApplyId() {
    return applyId;
  }


  public void setApplyId(String applyId) {
    this.applyId = applyId;
  }


  public InvoiceModelContent extendFields(String extendFields) {
    
    this.extendFields = extendFields;
    return this;
  }

   /**
   * key=value,每组键值对以回车分割
   * @return extendFields
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "shortPlatform=POS  abx=xxx  eee=ccc", value = "key=value,每组键值对以回车分割")

  public String getExtendFields() {
    return extendFields;
  }


  public void setExtendFields(String extendFields) {
    this.extendFields = extendFields;
  }


  public InvoiceModelContent fileDownloadType(String fileDownloadType) {
    
    this.fileDownloadType = fileDownloadType;
    return this;
  }

   /**
   * 下载的发票文件类型,可选值: pdf(发票原文件) ofd(发票原文件) jpg(发票原文件缩略图)
   * @return fileDownloadType
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "pdf", value = "下载的发票文件类型,可选值: pdf(发票原文件) ofd(发票原文件) jpg(发票原文件缩略图)")

  public String getFileDownloadType() {
    return fileDownloadType;
  }


  public void setFileDownloadType(String fileDownloadType) {
    this.fileDownloadType = fileDownloadType;
  }


  public InvoiceModelContent fileDownloadUrl(String fileDownloadUrl) {
    
    this.fileDownloadUrl = fileDownloadUrl;
    return this;
  }

   /**
   * 发票原文件下载地址 1.当tax_type=PLAIN、ALL_ELECTRONIC_GENERAL或ALL_ELECTRONIC_SPECIAL时, file_download_url必传 且file_download_type取值范围为pdf或ofd; 2.当tax_type=SPECIAL时, file_download_url必传 file_download_type可以传入pdf,ofd,jpg 3.当其他票种时,file_download_url可以不传
   * @return fileDownloadUrl
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "http://xxx.com", value = "发票原文件下载地址 1.当tax_type=PLAIN、ALL_ELECTRONIC_GENERAL或ALL_ELECTRONIC_SPECIAL时, file_download_url必传 且file_download_type取值范围为pdf或ofd; 2.当tax_type=SPECIAL时, file_download_url必传 file_download_type可以传入pdf,ofd,jpg 3.当其他票种时,file_download_url可以不传")

  public String getFileDownloadUrl() {
    return fileDownloadUrl;
  }


  public void setFileDownloadUrl(String fileDownloadUrl) {
    this.fileDownloadUrl = fileDownloadUrl;
  }


  public InvoiceModelContent financialElectronicType(String financialElectronicType) {
    
    this.financialElectronicType = financialElectronicType;
    return this;
  }

   /**
   * 财政电子票据子类型,当tax_type=FINANCIAL_ELECTRONIC_BILL时要求必填 可选值如下: 01:非税收入通用票据  02:非税收入专用票据 03:非税收入一般缴款书 04:资金往来结算票据 05:公益事业捐赠票据 06:医疗收费票据 07:社会团体会费票据 08:社会保险基金票据 09:工会经费收入票据 99:其他财政票据
   * @return financialElectronicType
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "MEDICAL_ELECTRONIC_BILL", value = "财政电子票据子类型,当tax_type=FINANCIAL_ELECTRONIC_BILL时要求必填 可选值如下: 01:非税收入通用票据  02:非税收入专用票据 03:非税收入一般缴款书 04:资金往来结算票据 05:公益事业捐赠票据 06:医疗收费票据 07:社会团体会费票据 08:社会保险基金票据 09:工会经费收入票据 99:其他财政票据")

  public String getFinancialElectronicType() {
    return financialElectronicType;
  }


  public void setFinancialElectronicType(String financialElectronicType) {
    this.financialElectronicType = financialElectronicType;
  }


  public InvoiceModelContent invoiceAmount(String invoiceAmount) {
    
    this.invoiceAmount = invoiceAmount;
    return this;
  }

   /**
   * 发票金额,大于0且精确到小数点两位,以元为单位  需要传入税价合计金额
   * @return invoiceAmount
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "200.00", value = "发票金额,大于0且精确到小数点两位,以元为单位  需要传入税价合计金额")

  public String getInvoiceAmount() {
    return invoiceAmount;
  }


  public void setInvoiceAmount(String invoiceAmount) {
    this.invoiceAmount = invoiceAmount;
  }


  public InvoiceModelContent invoiceCode(String invoiceCode) {
    
    this.invoiceCode = invoiceCode;
    return this;
  }

   /**
   * 发票代码,为国税局生成的唯一值,全电票时为空,其他情况不可为空
   * @return invoiceCode
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2328742873", value = "发票代码,为国税局生成的唯一值,全电票时为空,其他情况不可为空")

  public String getInvoiceCode() {
    return invoiceCode;
  }


  public void setInvoiceCode(String invoiceCode) {
    this.invoiceCode = invoiceCode;
  }


  public InvoiceModelContent invoiceContent(List invoiceContent) {
    
    this.invoiceContent = invoiceContent;
    return this;
  }

  public InvoiceModelContent addInvoiceContentItem(InvoiceItemContent invoiceContentItem) {
    if (this.invoiceContent == null) {
      this.invoiceContent = new ArrayList<>();
    }
    this.invoiceContent.add(invoiceContentItem);
    return this;
  }

   /**
   * 发票内容项
   * @return invoiceContent
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "发票内容项")

  public List getInvoiceContent() {
    return invoiceContent;
  }


  public void setInvoiceContent(List invoiceContent) {
    this.invoiceContent = invoiceContent;
  }


  public InvoiceModelContent invoiceDate(String invoiceDate) {
    
    this.invoiceDate = invoiceDate;
    return this;
  }

   /**
   * 发票日期,用户填写,目前精确到日
   * @return invoiceDate
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2016-07-19", value = "发票日期,用户填写,目前精确到日")

  public String getInvoiceDate() {
    return invoiceDate;
  }


  public void setInvoiceDate(String invoiceDate) {
    this.invoiceDate = invoiceDate;
  }


  public InvoiceModelContent invoiceFakeCode(String invoiceFakeCode) {
    
    this.invoiceFakeCode = invoiceFakeCode;
    return this;
  }

   /**
   * 发票防伪码
   * @return invoiceFakeCode
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "-", value = "发票防伪码")

  public String getInvoiceFakeCode() {
    return invoiceFakeCode;
  }


  public void setInvoiceFakeCode(String invoiceFakeCode) {
    this.invoiceFakeCode = invoiceFakeCode;
  }


  public InvoiceModelContent invoiceFileData(String invoiceFileData) {
    
    this.invoiceFileData = invoiceFileData;
    return this;
  }

   /**
   * 原始发票PDF/OFD文件流
   * @return invoiceFileData
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "01010010101", value = "原始发票PDF/OFD文件流")

  public String getInvoiceFileData() {
    return invoiceFileData;
  }


  public void setInvoiceFileData(String invoiceFileData) {
    this.invoiceFileData = invoiceFileData;
  }


  public InvoiceModelContent invoiceImgUrl(String invoiceImgUrl) {
    
    this.invoiceImgUrl = invoiceImgUrl;
    return this;
  }

   /**
   * 发票原始文件jpg文件地址
   * @return invoiceImgUrl
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "http://xxx.com", value = "发票原始文件jpg文件地址")

  public String getInvoiceImgUrl() {
    return invoiceImgUrl;
  }


  public void setInvoiceImgUrl(String invoiceImgUrl) {
    this.invoiceImgUrl = invoiceImgUrl;
  }


  public InvoiceModelContent invoiceNo(String invoiceNo) {
    
    this.invoiceNo = invoiceNo;
    return this;
  }

   /**
   * 发票号码,国税局生成的唯一号码,不可为空串;  使用时请注意,invoice_no+invoice_code唯一,不能重复
   * @return invoiceNo
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "237428768", value = "发票号码,国税局生成的唯一号码,不可为空串;  使用时请注意,invoice_no+invoice_code唯一,不能重复")

  public String getInvoiceNo() {
    return invoiceNo;
  }


  public void setInvoiceNo(String invoiceNo) {
    this.invoiceNo = invoiceNo;
  }


  public InvoiceModelContent invoiceOperator(String invoiceOperator) {
    
    this.invoiceOperator = invoiceOperator;
    return this;
  }

   /**
   * 发票开具操作人
   * @return invoiceOperator
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "张某某", value = "发票开具操作人")

  public String getInvoiceOperator() {
    return invoiceOperator;
  }


  public void setInvoiceOperator(String invoiceOperator) {
    this.invoiceOperator = invoiceOperator;
  }


  public InvoiceModelContent invoiceTitle(InvoiceTitleModel invoiceTitle) {
    
    this.invoiceTitle = invoiceTitle;
    return this;
  }

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

  public InvoiceTitleModel getInvoiceTitle() {
    return invoiceTitle;
  }


  public void setInvoiceTitle(InvoiceTitleModel invoiceTitle) {
    this.invoiceTitle = invoiceTitle;
  }


  public InvoiceModelContent invoiceType(String invoiceType) {
    
    this.invoiceType = invoiceType;
    return this;
  }

   /**
   * 发票类型,按照可选值只传入英文部分,该字段严格要求大小写  可选值:  blue(蓝票)  red(红票)
   * @return invoiceType
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "blue", value = "发票类型,按照可选值只传入英文部分,该字段严格要求大小写  可选值:  blue(蓝票)  red(红票)")

  public String getInvoiceType() {
    return invoiceType;
  }


  public void setInvoiceType(String invoiceType) {
    this.invoiceType = invoiceType;
  }


  public InvoiceModelContent openId(String openId) {
    
    this.openId = openId;
    return this;
  }

   /**
   * 支付宝用户id,支付宝端的申请id存在的时候也不需要传,其他情况下,当同步的是蓝票时,必传,红票时不需传。
   * @return openId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "074a1CcTG1LelxKe4xQC0zgNdId0nxi95b5lsNpazWYoCo5", value = "支付宝用户id,支付宝端的申请id存在的时候也不需要传,其他情况下,当同步的是蓝票时,必传,红票时不需传。")

  public String getOpenId() {
    return openId;
  }


  public void setOpenId(String openId) {
    this.openId = openId;
  }


  public InvoiceModelContent originalBlueInvoiceCode(String originalBlueInvoiceCode) {
    
    this.originalBlueInvoiceCode = originalBlueInvoiceCode;
    return this;
  }

   /**
   * 仅用于同步红票,原始蓝票发票代码,同步红票时必传(全电票时为空)
   * @return originalBlueInvoiceCode
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2328742873", value = "仅用于同步红票,原始蓝票发票代码,同步红票时必传(全电票时为空)")

  public String getOriginalBlueInvoiceCode() {
    return originalBlueInvoiceCode;
  }


  public void setOriginalBlueInvoiceCode(String originalBlueInvoiceCode) {
    this.originalBlueInvoiceCode = originalBlueInvoiceCode;
  }


  public InvoiceModelContent originalBlueInvoiceNo(String originalBlueInvoiceNo) {
    
    this.originalBlueInvoiceNo = originalBlueInvoiceNo;
    return this;
  }

   /**
   * 仅用于同步红票,原始蓝票发票号码,同步红票时必传
   * @return originalBlueInvoiceNo
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "9288277173", value = "仅用于同步红票,原始蓝票发票号码,同步红票时必传")

  public String getOriginalBlueInvoiceNo() {
    return originalBlueInvoiceNo;
  }


  public void setOriginalBlueInvoiceNo(String originalBlueInvoiceNo) {
    this.originalBlueInvoiceNo = originalBlueInvoiceNo;
  }


  public InvoiceModelContent outBizNo(String outBizNo) {
    
    this.outBizNo = outBizNo;
    return this;
  }

   /**
   * 商户交易流水号,不可为空串;  传入红票时请注意,此字段的值要和蓝票保持一致
   * @return outBizNo
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2016010139992003", value = "商户交易流水号,不可为空串;  传入红票时请注意,此字段的值要和蓝票保持一致")

  public String getOutBizNo() {
    return outBizNo;
  }


  public void setOutBizNo(String outBizNo) {
    this.outBizNo = outBizNo;
  }


  public InvoiceModelContent outInvoiceId(String outInvoiceId) {
    
    this.outInvoiceId = outInvoiceId;
    return this;
  }

   /**
   * 商户唯一开票申请业务流水号,同一个isv下不能重复
   * @return outInvoiceId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "20160707399929991001", value = "商户唯一开票申请业务流水号,同一个isv下不能重复")

  public String getOutInvoiceId() {
    return outInvoiceId;
  }


  public void setOutInvoiceId(String outInvoiceId) {
    this.outInvoiceId = outInvoiceId;
  }


  public InvoiceModelContent registerAddress(String registerAddress) {
    
    this.registerAddress = registerAddress;
    return this;
  }

   /**
   * 开票单位地址
   * @return registerAddress
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "天目山路黄龙时代广场B座", value = "开票单位地址")

  public String getRegisterAddress() {
    return registerAddress;
  }


  public void setRegisterAddress(String registerAddress) {
    this.registerAddress = registerAddress;
  }


  public InvoiceModelContent registerBankAccount(String registerBankAccount) {
    
    this.registerBankAccount = registerBankAccount;
    return this;
  }

   /**
   * 开票单位开户行账号
   * @return registerBankAccount
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "6332000023949993", value = "开票单位开户行账号")

  public String getRegisterBankAccount() {
    return registerBankAccount;
  }


  public void setRegisterBankAccount(String registerBankAccount) {
    this.registerBankAccount = registerBankAccount;
  }


  public InvoiceModelContent registerBankName(String registerBankName) {
    
    this.registerBankName = registerBankName;
    return this;
  }

   /**
   * 开票单位开户行名称
   * @return registerBankName
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "西湖区建行", value = "开票单位开户行名称")

  public String getRegisterBankName() {
    return registerBankName;
  }


  public void setRegisterBankName(String registerBankName) {
    this.registerBankName = registerBankName;
  }


  public InvoiceModelContent registerName(String registerName) {
    
    this.registerName = registerName;
    return this;
  }

   /**
   * 开票单位
   * @return registerName
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "支付宝(杭州)信息技术有限公司", value = "开票单位")

  public String getRegisterName() {
    return registerName;
  }


  public void setRegisterName(String registerName) {
    this.registerName = registerName;
  }


  public InvoiceModelContent registerNo(String registerNo) {
    
    this.registerNo = registerNo;
    return this;
  }

   /**
   * 纳税人识别号,不可为空串
   * @return registerNo
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "J8374LK29387", value = "纳税人识别号,不可为空串")

  public String getRegisterNo() {
    return registerNo;
  }


  public void setRegisterNo(String registerNo) {
    this.registerNo = registerNo;
  }


  public InvoiceModelContent registerPhoneNo(String registerPhoneNo) {
    
    this.registerPhoneNo = registerPhoneNo;
    return this;
  }

   /**
   * 开票人电话,支持座机和手机两种格式
   * @return registerPhoneNo
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "13200029932", value = "开票人电话,支持座机和手机两种格式")

  public String getRegisterPhoneNo() {
    return registerPhoneNo;
  }


  public void setRegisterPhoneNo(String registerPhoneNo) {
    this.registerPhoneNo = registerPhoneNo;
  }


  public InvoiceModelContent sumAmount(String sumAmount) {
    
    this.sumAmount = sumAmount;
    return this;
  }

   /**
   * 价税合计
   * @return sumAmount
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2000.00", value = "价税合计")

  public String getSumAmount() {
    return sumAmount;
  }


  public void setSumAmount(String sumAmount) {
    this.sumAmount = sumAmount;
  }


  public InvoiceModelContent taxAmount(String taxAmount) {
    
    this.taxAmount = taxAmount;
    return this;
  }

   /**
   * 税额
   * @return taxAmount
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "1000.00", value = "税额")

  public String getTaxAmount() {
    return taxAmount;
  }


  public void setTaxAmount(String taxAmount) {
    this.taxAmount = taxAmount;
  }


  public InvoiceModelContent taxType(String taxType) {
    
    this.taxType = taxType;
    return this;
  }

   /**
   * 税种 可选值: PLAIN:增值税电子普通发票 ALL_ELECTRONIC_GENERAL:电子发票(普通发票) ALL_ELECTRONIC_SPECIAL:电子发票(增值税专用发票) SPECIAL:增值税专用发票 PLAIN_INVOICE:增值税普通发票 FINANCIAL_ELECTRONIC_BILL:财政电子票据
   * @return taxType
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "PLAIN", value = "税种 可选值: PLAIN:增值税电子普通发票 ALL_ELECTRONIC_GENERAL:电子发票(普通发票) ALL_ELECTRONIC_SPECIAL:电子发票(增值税专用发票) SPECIAL:增值税专用发票 PLAIN_INVOICE:增值税普通发票 FINANCIAL_ELECTRONIC_BILL:财政电子票据")

  public String getTaxType() {
    return taxType;
  }


  public void setTaxType(String taxType) {
    this.taxType = taxType;
  }


  public InvoiceModelContent userId(String userId) {
    
    this.userId = userId;
    return this;
  }

   /**
   * 支付宝用户id,支付宝端的申请id存在的时候也不需要传,其他情况下,当同步的是蓝票时,必传,红票时不需传。
   * @return userId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2088399922382233", value = "支付宝用户id,支付宝端的申请id存在的时候也不需要传,其他情况下,当同步的是蓝票时,必传,红票时不需传。")

  public String getUserId() {
    return userId;
  }


  public void setUserId(String userId) {
    this.userId = userId;
  }

  /**
   * 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 InvoiceModelContent instance itself
   */
  public InvoiceModelContent 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;
    }
    InvoiceModelContent invoiceModelContent = (InvoiceModelContent) o;
    return Objects.equals(this.applyId, invoiceModelContent.applyId) &&
        Objects.equals(this.extendFields, invoiceModelContent.extendFields) &&
        Objects.equals(this.fileDownloadType, invoiceModelContent.fileDownloadType) &&
        Objects.equals(this.fileDownloadUrl, invoiceModelContent.fileDownloadUrl) &&
        Objects.equals(this.financialElectronicType, invoiceModelContent.financialElectronicType) &&
        Objects.equals(this.invoiceAmount, invoiceModelContent.invoiceAmount) &&
        Objects.equals(this.invoiceCode, invoiceModelContent.invoiceCode) &&
        Objects.equals(this.invoiceContent, invoiceModelContent.invoiceContent) &&
        Objects.equals(this.invoiceDate, invoiceModelContent.invoiceDate) &&
        Objects.equals(this.invoiceFakeCode, invoiceModelContent.invoiceFakeCode) &&
        Objects.equals(this.invoiceFileData, invoiceModelContent.invoiceFileData) &&
        Objects.equals(this.invoiceImgUrl, invoiceModelContent.invoiceImgUrl) &&
        Objects.equals(this.invoiceNo, invoiceModelContent.invoiceNo) &&
        Objects.equals(this.invoiceOperator, invoiceModelContent.invoiceOperator) &&
        Objects.equals(this.invoiceTitle, invoiceModelContent.invoiceTitle) &&
        Objects.equals(this.invoiceType, invoiceModelContent.invoiceType) &&
        Objects.equals(this.openId, invoiceModelContent.openId) &&
        Objects.equals(this.originalBlueInvoiceCode, invoiceModelContent.originalBlueInvoiceCode) &&
        Objects.equals(this.originalBlueInvoiceNo, invoiceModelContent.originalBlueInvoiceNo) &&
        Objects.equals(this.outBizNo, invoiceModelContent.outBizNo) &&
        Objects.equals(this.outInvoiceId, invoiceModelContent.outInvoiceId) &&
        Objects.equals(this.registerAddress, invoiceModelContent.registerAddress) &&
        Objects.equals(this.registerBankAccount, invoiceModelContent.registerBankAccount) &&
        Objects.equals(this.registerBankName, invoiceModelContent.registerBankName) &&
        Objects.equals(this.registerName, invoiceModelContent.registerName) &&
        Objects.equals(this.registerNo, invoiceModelContent.registerNo) &&
        Objects.equals(this.registerPhoneNo, invoiceModelContent.registerPhoneNo) &&
        Objects.equals(this.sumAmount, invoiceModelContent.sumAmount) &&
        Objects.equals(this.taxAmount, invoiceModelContent.taxAmount) &&
        Objects.equals(this.taxType, invoiceModelContent.taxType) &&
        Objects.equals(this.userId, invoiceModelContent.userId)&&
        Objects.equals(this.additionalProperties, invoiceModelContent.additionalProperties);
  }

  @Override
  public int hashCode() {
    return Objects.hash(applyId, extendFields, fileDownloadType, fileDownloadUrl, financialElectronicType, invoiceAmount, invoiceCode, invoiceContent, invoiceDate, invoiceFakeCode, invoiceFileData, invoiceImgUrl, invoiceNo, invoiceOperator, invoiceTitle, invoiceType, openId, originalBlueInvoiceCode, originalBlueInvoiceNo, outBizNo, outInvoiceId, registerAddress, registerBankAccount, registerBankName, registerName, registerNo, registerPhoneNo, sumAmount, taxAmount, taxType, userId, additionalProperties);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class InvoiceModelContent {\n");
    sb.append("    applyId: ").append(toIndentedString(applyId)).append("\n");
    sb.append("    extendFields: ").append(toIndentedString(extendFields)).append("\n");
    sb.append("    fileDownloadType: ").append(toIndentedString(fileDownloadType)).append("\n");
    sb.append("    fileDownloadUrl: ").append(toIndentedString(fileDownloadUrl)).append("\n");
    sb.append("    financialElectronicType: ").append(toIndentedString(financialElectronicType)).append("\n");
    sb.append("    invoiceAmount: ").append(toIndentedString(invoiceAmount)).append("\n");
    sb.append("    invoiceCode: ").append(toIndentedString(invoiceCode)).append("\n");
    sb.append("    invoiceContent: ").append(toIndentedString(invoiceContent)).append("\n");
    sb.append("    invoiceDate: ").append(toIndentedString(invoiceDate)).append("\n");
    sb.append("    invoiceFakeCode: ").append(toIndentedString(invoiceFakeCode)).append("\n");
    sb.append("    invoiceFileData: ").append(toIndentedString(invoiceFileData)).append("\n");
    sb.append("    invoiceImgUrl: ").append(toIndentedString(invoiceImgUrl)).append("\n");
    sb.append("    invoiceNo: ").append(toIndentedString(invoiceNo)).append("\n");
    sb.append("    invoiceOperator: ").append(toIndentedString(invoiceOperator)).append("\n");
    sb.append("    invoiceTitle: ").append(toIndentedString(invoiceTitle)).append("\n");
    sb.append("    invoiceType: ").append(toIndentedString(invoiceType)).append("\n");
    sb.append("    openId: ").append(toIndentedString(openId)).append("\n");
    sb.append("    originalBlueInvoiceCode: ").append(toIndentedString(originalBlueInvoiceCode)).append("\n");
    sb.append("    originalBlueInvoiceNo: ").append(toIndentedString(originalBlueInvoiceNo)).append("\n");
    sb.append("    outBizNo: ").append(toIndentedString(outBizNo)).append("\n");
    sb.append("    outInvoiceId: ").append(toIndentedString(outInvoiceId)).append("\n");
    sb.append("    registerAddress: ").append(toIndentedString(registerAddress)).append("\n");
    sb.append("    registerBankAccount: ").append(toIndentedString(registerBankAccount)).append("\n");
    sb.append("    registerBankName: ").append(toIndentedString(registerBankName)).append("\n");
    sb.append("    registerName: ").append(toIndentedString(registerName)).append("\n");
    sb.append("    registerNo: ").append(toIndentedString(registerNo)).append("\n");
    sb.append("    registerPhoneNo: ").append(toIndentedString(registerPhoneNo)).append("\n");
    sb.append("    sumAmount: ").append(toIndentedString(sumAmount)).append("\n");
    sb.append("    taxAmount: ").append(toIndentedString(taxAmount)).append("\n");
    sb.append("    taxType: ").append(toIndentedString(taxType)).append("\n");
    sb.append("    userId: ").append(toIndentedString(userId)).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("apply_id");
    openapiFields.add("extend_fields");
    openapiFields.add("file_download_type");
    openapiFields.add("file_download_url");
    openapiFields.add("financial_electronic_type");
    openapiFields.add("invoice_amount");
    openapiFields.add("invoice_code");
    openapiFields.add("invoice_content");
    openapiFields.add("invoice_date");
    openapiFields.add("invoice_fake_code");
    openapiFields.add("invoice_file_data");
    openapiFields.add("invoice_img_url");
    openapiFields.add("invoice_no");
    openapiFields.add("invoice_operator");
    openapiFields.add("invoice_title");
    openapiFields.add("invoice_type");
    openapiFields.add("open_id");
    openapiFields.add("original_blue_invoice_code");
    openapiFields.add("original_blue_invoice_no");
    openapiFields.add("out_biz_no");
    openapiFields.add("out_invoice_id");
    openapiFields.add("register_address");
    openapiFields.add("register_bank_account");
    openapiFields.add("register_bank_name");
    openapiFields.add("register_name");
    openapiFields.add("register_no");
    openapiFields.add("register_phone_no");
    openapiFields.add("sum_amount");
    openapiFields.add("tax_amount");
    openapiFields.add("tax_type");
    openapiFields.add("user_id");

    // 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 InvoiceModelContent
  */
  public static void validateJsonObject(JsonObject jsonObj) throws IOException {
      if (jsonObj == null) {
        if (InvoiceModelContent.openapiRequiredFields.isEmpty()) {
          return;
        } else { // has required fields
          throw new IllegalArgumentException(String.format("The required field(s) %s in InvoiceModelContent is not found in the empty JSON string", InvoiceModelContent.openapiRequiredFields.toString()));
        }
      }
      if (jsonObj.get("apply_id") != null && !jsonObj.get("apply_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `apply_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("apply_id").toString()));
      }
      if (jsonObj.get("extend_fields") != null && !jsonObj.get("extend_fields").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `extend_fields` to be a primitive type in the JSON string but got `%s`", jsonObj.get("extend_fields").toString()));
      }
      if (jsonObj.get("file_download_type") != null && !jsonObj.get("file_download_type").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `file_download_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("file_download_type").toString()));
      }
      if (jsonObj.get("file_download_url") != null && !jsonObj.get("file_download_url").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `file_download_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("file_download_url").toString()));
      }
      if (jsonObj.get("financial_electronic_type") != null && !jsonObj.get("financial_electronic_type").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `financial_electronic_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("financial_electronic_type").toString()));
      }
      if (jsonObj.get("invoice_amount") != null && !jsonObj.get("invoice_amount").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `invoice_amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoice_amount").toString()));
      }
      if (jsonObj.get("invoice_code") != null && !jsonObj.get("invoice_code").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `invoice_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoice_code").toString()));
      }
      JsonArray jsonArrayinvoiceContent = jsonObj.getAsJsonArray("invoice_content");
      if (jsonArrayinvoiceContent != null) {
        // ensure the json data is an array
        if (!jsonObj.get("invoice_content").isJsonArray()) {
          throw new IllegalArgumentException(String.format("Expected the field `invoice_content` to be an array in the JSON string but got `%s`", jsonObj.get("invoice_content").toString()));
        }

        // validate the optional field `invoice_content` (array)
        for (int i = 0; i < jsonArrayinvoiceContent.size(); i++) {
          InvoiceItemContent.validateJsonObject(jsonArrayinvoiceContent.get(i).getAsJsonObject());
        };
      }
      if (jsonObj.get("invoice_date") != null && !jsonObj.get("invoice_date").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `invoice_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoice_date").toString()));
      }
      if (jsonObj.get("invoice_fake_code") != null && !jsonObj.get("invoice_fake_code").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `invoice_fake_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoice_fake_code").toString()));
      }
      if (jsonObj.get("invoice_file_data") != null && !jsonObj.get("invoice_file_data").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `invoice_file_data` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoice_file_data").toString()));
      }
      if (jsonObj.get("invoice_img_url") != null && !jsonObj.get("invoice_img_url").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `invoice_img_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoice_img_url").toString()));
      }
      if (jsonObj.get("invoice_no") != null && !jsonObj.get("invoice_no").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `invoice_no` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoice_no").toString()));
      }
      if (jsonObj.get("invoice_operator") != null && !jsonObj.get("invoice_operator").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `invoice_operator` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoice_operator").toString()));
      }
      // validate the optional field `invoice_title`
      if (jsonObj.getAsJsonObject("invoice_title") != null) {
        InvoiceTitleModel.validateJsonObject(jsonObj.getAsJsonObject("invoice_title"));
      }
      if (jsonObj.get("invoice_type") != null && !jsonObj.get("invoice_type").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `invoice_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoice_type").toString()));
      }
      if (jsonObj.get("open_id") != null && !jsonObj.get("open_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `open_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("open_id").toString()));
      }
      if (jsonObj.get("original_blue_invoice_code") != null && !jsonObj.get("original_blue_invoice_code").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `original_blue_invoice_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("original_blue_invoice_code").toString()));
      }
      if (jsonObj.get("original_blue_invoice_no") != null && !jsonObj.get("original_blue_invoice_no").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `original_blue_invoice_no` to be a primitive type in the JSON string but got `%s`", jsonObj.get("original_blue_invoice_no").toString()));
      }
      if (jsonObj.get("out_biz_no") != null && !jsonObj.get("out_biz_no").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `out_biz_no` to be a primitive type in the JSON string but got `%s`", jsonObj.get("out_biz_no").toString()));
      }
      if (jsonObj.get("out_invoice_id") != null && !jsonObj.get("out_invoice_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `out_invoice_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("out_invoice_id").toString()));
      }
      if (jsonObj.get("register_address") != null && !jsonObj.get("register_address").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `register_address` to be a primitive type in the JSON string but got `%s`", jsonObj.get("register_address").toString()));
      }
      if (jsonObj.get("register_bank_account") != null && !jsonObj.get("register_bank_account").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `register_bank_account` to be a primitive type in the JSON string but got `%s`", jsonObj.get("register_bank_account").toString()));
      }
      if (jsonObj.get("register_bank_name") != null && !jsonObj.get("register_bank_name").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `register_bank_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("register_bank_name").toString()));
      }
      if (jsonObj.get("register_name") != null && !jsonObj.get("register_name").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `register_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("register_name").toString()));
      }
      if (jsonObj.get("register_no") != null && !jsonObj.get("register_no").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `register_no` to be a primitive type in the JSON string but got `%s`", jsonObj.get("register_no").toString()));
      }
      if (jsonObj.get("register_phone_no") != null && !jsonObj.get("register_phone_no").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `register_phone_no` to be a primitive type in the JSON string but got `%s`", jsonObj.get("register_phone_no").toString()));
      }
      if (jsonObj.get("sum_amount") != null && !jsonObj.get("sum_amount").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `sum_amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sum_amount").toString()));
      }
      if (jsonObj.get("tax_amount") != null && !jsonObj.get("tax_amount").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `tax_amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tax_amount").toString()));
      }
      if (jsonObj.get("tax_type") != null && !jsonObj.get("tax_type").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `tax_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tax_type").toString()));
      }
      if (jsonObj.get("user_id") != null && !jsonObj.get("user_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `user_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("user_id").toString()));
      }
  }

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

       return (TypeAdapter) new TypeAdapter() {
           @Override
           public void write(JsonWriter out, InvoiceModelContent 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 InvoiceModelContent read(JsonReader in) throws IOException {
             JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
             validateJsonObject(jsonObj);
             // store additional fields in the deserialized instance
             InvoiceModelContent 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 InvoiceModelContent given an JSON string
  *
  * @param jsonString JSON string
  * @return An instance of InvoiceModelContent
  * @throws IOException if the JSON string is invalid with respect to InvoiceModelContent
  */
  public static InvoiceModelContent fromJson(String jsonString) throws IOException {
    return JSON.getGson().fromJson(jsonString, InvoiceModelContent.class);
  }

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy