package cn.superdesk.uniorder.openapicall.thirdpart.szhtxx.paperInvoice.dto.response.SID121TaxInfo;

import cn.superdesk.uniorder.common.json.AnJsonUtils;
import cn.superdesk.uniorder.openapicall.thirdpart.szhtxx.paperInvoice.dto.response._SzhtxxPaperInvoiceBaseResponse;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import lombok.extern.slf4j.Slf4j;

import java.io.UnsupportedEncodingException;

/**
 * @Description: 10. 获取金税盘状态接口 SID=121
 * 获取金税盘是否开启金税盘。
 * @Author: linjinyu
 * @CreateDate: 2022/5/7 2:56 下午
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/5/7 2:56 下午
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Slf4j
@JsonIgnoreProperties(ignoreUnknown = true)
@SuperBuilder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SID121TaxInfoResponseBody extends _SzhtxxPaperInvoiceBaseResponse {

    @ApiModelProperty("密文-解密-反序列化")
    private SID121TaxInfoResponseBodyEncmsgVo encmsgVo;

    public SID121TaxInfoResponseBody unPacking() {

        try {
            String jsonStr = this.base64ReplaceAndDecode(this.ENCMSG);
            log.info("\nunPacking\n{}\n{}", this.ENCMSG, jsonStr);
            encmsgVo = AnJsonUtils.toObject(jsonStr, SID121TaxInfoResponseBodyEncmsgVo.class);
        } catch (UnsupportedEncodingException unsupportedEncodingException) {
            unsupportedEncodingException.printStackTrace();
        }

        return this;
    }
}
