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 QueryEvCert {
    String evId;

    public QueryEvCert() {
    }

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

    public QueryEvCertResp query() throws Exception {
        Resp resp = HttpUtil.apiGetJsonX(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(QueryEvCertResp.class);
    }

    @Override
    public String toString() {
        return "QueryEvCertReq{" +
                "evId='" + evId + '\'' +
                '}';
    }

    public String getEvId() {
        return evId;
    }

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