package com.liquidnet.service.galaxy.router.zxin.service;

import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.galaxy.constant.GalaxyEnum;
import com.liquidnet.service.galaxy.dto.param.*;
import com.liquidnet.service.galaxy.router.strategy.IGalaxyRouterStrategyTrade;
import com.liquidnet.service.galaxy.router.strategy.annotation.StrategyGalaxyRouterTradeHandler;
import com.liquidnet.service.galaxy.router.zxin.biz.ZxinTradeBiz;
import com.liquidnet.service.galaxy.utils.QueueUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author AnJiabin <anjiabin@zhengzai.tv>
 * @version V1.0
 * @Description: TODO
 * @class: PayChannelStrategyAlipayImpl
 * @Package com.liquidnet.service.dragon.channel.strategy.impl
 * @Copyright: LightNet @ Copyright (c) 2021
 * @date 2022/3/18 13:06
 */
@Slf4j
@Component
@StrategyGalaxyRouterTradeHandler(GalaxyEnum.RouterTypeEnum.ZXINCHAIN)
public class GalaxyRouterStrategyZxlTradeImpl implements IGalaxyRouterStrategyTrade {
    @Autowired
    private ZxinTradeBiz zxinTradeBiz;

    @Autowired
    private QueueUtil queueUtil;

    @Override
    public ResponseDto<GalaxyNftPublishAndBuyRespDto> nftPublishAndBuy(GalaxyNftPublishAndBuyReqDto reqDto) {
        //测试发送队列
        ResponseDto<GalaxyNftPublishAndBuyRespDto> responseDto = zxinTradeBiz.nftPublishAndBuy(reqDto);
        if(!responseDto.isSuccess()){
            queueUtil.sendMsgByRedis(MQConst.GalaxyQueue.JSON_NFT_PUBLISH_AND_BUY.getKey(), JsonUtils.toJson(reqDto));
        }
        return ResponseDto.success();
    }

    @Deprecated
    @Override
    public ResponseDto<GalaxyNftBuyResultQueryRespDto> nftBuyResultQuery(GalaxyNftBuyResultQueryReqDto reqDto) {
        return zxinTradeBiz.nftBuyResultQuery(reqDto);
    }

    @Deprecated
    @Override
    public ResponseDto<GalaxyNftBuyPayResultQueryRespDto> nftBuyPayResultQuery(GalaxyNftBuyPayResultQueryReqDto reqDto) {
        return zxinTradeBiz.nftBuyPayResultQuery(reqDto);
    }

    @Override
    public ResponseDto<GalaxyNftPublishAndBuyResultQueryRespDto> nftPublishAndBuyResultQuery(GalaxyNftPublishAndBuyResultQueryReqDto reqDto) {
        return zxinTradeBiz.nftPublishAndBuyResultQuery(reqDto);
    }

    @Deprecated
    @Override
    public ResponseDto<GalaxyNftPublishAndBuyRouterBatchQueryRespDto> nftPublishAndBuyResultBatchQuery(GalaxyNftPublishAndBuyRouterBatchQueryReqDto reqDto) {
        return zxinTradeBiz.nftPublishAndBuyResultBatchQuery(reqDto);
    }

    @Deprecated
    @Override
    public ResponseDto<GalaxyNftBuyRespDto> nftBuy(GalaxyNftBuyReqDto reqDto) {
        return zxinTradeBiz.nftBuy(reqDto);
    }

    @Override
    public ResponseDto<GalaxyNftTransferRespDto> nftTransfer(GalaxyNftTransferReqDto reqDto) {
        return null;
    }

    @Override
    public ResponseDto<GalaxyNftTransferQueryRespDto> nftTransferQuery(GalaxyNftTransferQueryReqDto reqDto) {
        return null;
    }
}
