package nft.point;

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

public class Query {
    String addr;
    String platformPubKey;

    public Query() {
    }

    public Query(String addr) {
        this.addr = addr;
    }

    public long pointQuery() throws Exception {
        // todo 参数校验
        this.setPlatformPubKey(Config.platformPubKey);
        Resp resp = HttpUtil.apiGetJsonX(Config.baseUrl + "/api/v1/nft/point/query", Tools.getJson(this), ZxlSDKUtil.generateApiSign());
        if (resp.getRetCode() != 0) {
            throw new ZXChainException(resp.getRetMsg());
        }

        return (long) resp.getData().get("count");
    }

    public String getAddr() {
        return addr;
    }

    public void setAddr(String addr) {
        this.addr = addr;
    }

    public String getPlatformPubKey() {
        return platformPubKey;
    }

    public void setPlatformPubKey(String platformPubKey) {
        this.platformPubKey = platformPubKey;
    }
}
