package nft.info;

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

public class QueryTradeList {
    String nftId;
    long offset;
    long limit;

    public QueryTradeList() {
    }

    public QueryTradeList(String nftId, long offset, long limit) {
        this.nftId = nftId;
        this.offset = offset;
        this.limit = limit;
    }

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

        return resp.getData(TransList.class);
    }

    public String getNftId() {
        return nftId;
    }

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

    public long getOffset() {
        return offset;
    }

    public void setOffset(long offset) {
        this.offset = offset;
    }

    public long getLimit() {
        return limit;
    }

    public void setLimit(long limit) {
        this.limit = limit;
    }
}
