package nft.buy;

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

public class QueryPriceUpdateResult {
    String platformPubKey;
    String taskId;

    public QueryPriceUpdateResult() {
    }

    public QueryPriceUpdateResult(String taskId) {
        this.taskId = taskId;
    }

    public PriceUpdateResult query() throws Exception {
        this.setPlatformPubKey(Config.platformPubKey);

        Resp resp = HttpUtil.apiGetJsonX(Config.baseUrl + "/api/v1/nft/price/update/result", Tools.getJson(this), ZxlSDKUtil.generateApiSign());
        if (resp.getRetCode() != Constant.ZXL_OK) {
            throw new ZXChainException(resp.getRetMsg());
        }

        return resp.getData(PriceUpdateResult.class);
    }

    public String getPlatformPubKey() {
        return platformPubKey;
    }

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

    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }
}
