package nft.info;

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

public class QueryInfo {
    String nftId;

    public QueryInfo() {
    }

    public QueryInfo(String nftId) {
        this.nftId = nftId;
    }

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

        return resp.getData(NftInfo.class);
    }

    public String getNftId() {
        return nftId;
    }

    public void setNftId(String nftId) {
        this.nftId = nftId;
    }
}
