package nft.info;

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

public class QueryNftSeries {
    String seriesId;

    public QueryNftSeries(String seriesId) {
        this.seriesId = seriesId;
    }

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

        return Tools.toJavaClass(resp.getData().get("seriesInfo"), NftSeriesInfo.class);
    }

    public String getSeriesId() {
        return seriesId;
    }

    public void setSeriesId(String seriesId) {
        this.seriesId = seriesId;
    }
}
