package ev;

import common.Constant;
import common.Resp;
import config.Config;
import exception.ZXChainException;
import util.HttpUtil;
import util.Tools;
import util.ZxlSDKUtil;

public class CreateEvCert {
    String evId;

    public CreateEvCert() {
    }

    public CreateEvCert(String evId) {
        this.evId = evId;
    }

    public CreateEvCertResp createEvCert() throws Exception {
        //调用接口
        Resp resp = HttpUtil.apiPostJsonX(Config.baseUrl + "/api/v1/ev/cert", Tools.getJson(this), ZxlSDKUtil.generateApiSign());
        if (resp.getRetCode() != Constant.ZXL_OK) {
            throw new ZXChainException(resp.getRetMsg());
        }

        return resp.getData(CreateEvCertResp.class);
    }
    @Override
    public String toString() {
        return "CreateEvCertReq{" +
                "evId='" + evId + '\'' +
                '}';
    }

    public String getEvId() {
        return evId;
    }

    public void setEvId(String evId) {
        this.evId = evId;
    }
}
