package cn.superdesk.uniorder.openapicall.thirdpart.szhtxx.paperInvoice.dto.request.SID4ToInvalid;

import cn.superdesk.uniorder.common.json.AnJsonUtils;
import cn.superdesk.uniorder.openapicall.thirdpart.szhtxx.paperInvoice.dto.request._SzhtxxPaperInvoiceBaseRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.io.UnsupportedEncodingException;

/**
 * @Description: 4. 发票作废 SID=4
 * 在金税卡及防伪开票数据中作废已开发票。
 * @Author: linjinyu
 * @CreateDate: 2022/4/27 7:02 下午
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/4/27 7:02 下午
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@SuperBuilder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SID4ToInvalidRequestBody extends _SzhtxxPaperInvoiceBaseRequest {

    @ApiModelProperty("明文")
    private SID4ToInvalidRequestBodyStructVo structVo;

    public SID4ToInvalidRequestBody packing() {

        try {
            this.SIDParam = this.base64EncodeAndReplace(AnJsonUtils.toJson(structVo));
        } catch (UnsupportedEncodingException unsupportedEncodingException) {
            unsupportedEncodingException.printStackTrace();
            this.SIDParam = "ERROR";
        }

        return this;

    }
}
