import { Market } from '@/constants/market'
import { httpRequest } from '@/services/http'
import { tradeServerRequest } from '@/services/socket/trade'
import { TradeParams } from '@/services/socket/trade/interface'
import { loginStore } from '@/stores'

const { userId } = loginStore.$mapGetters()

/**
 * 查询我的积分流水
 */
export function queryUserScoreLog(params: Model.UserScoreLogReq) {
    params.userid = userId.value
    return httpRequest<Model.UserScoreLogRsp[]>('/Ferroalloy/QueryUserScoreLog', 'get', params);
}

/**
 * 查询积分配置
 */
export function queryTHJScoreConfig(params?: Model.THJScoreConfigReq) {
    return httpRequest<Model.THJScoreConfigRsp[]>('/Ferroalloy/QueryTHJScoreConfig', 'get', params);
}

/**
 * 铁合金抽奖
 */
export function thjRedPacketLottery(params: TradeParams<Proto.THJRedPacketLotteryReq, Proto.THJRedPacketLotteryRsp>) {
    return tradeServerRequest('THJRedPacketLotteryReq', 'THJRedPacketLotteryRsp', params, Market.THJ_Listing);
}