import { httpRequest } from '@/services/http'
import { HttpRequest } from '@/services/http/interface'
import { tradeServerRequest } from '@/services/socket/trade'
import { TradeRequest } from '@/services/socket/trade/interface'
import { Market } from '@/constants/market'

/**
 * 查询商品列表
 */
export function queryGoodsList(params: HttpRequest<{ rsp: Ermcp.GoodsRsp[] }>) {
    return httpRequest('/goods', 'get', params);
}

/**
 * 查询钻石列表
 */
export function queryDiamondList(params: HttpRequest<{ req: Ermcp.MyWRPositionReq, rsp: Ermcp.MyWRPositionRsp[] }>) {
    return httpRequest('/Guangzuan/QueryMyWRPosition', 'get', params);
}

/**
 * 获取钻石详情
 */
export function queryDiamondDetails(params: HttpRequest<{ req: Ermcp.DiamondDetailsReq, rsp: Ermcp.DiamondDetailsRsp }>) {
    return httpRequest('/Guangzuan/GetGoods', 'get', params);
}

/**
 * 新增钻石商品
 */
export function addDiamond(params: TradeRequest<Proto.AddZSGoodsReq, Proto.AddZSGoodsRsp>) {
    return tradeServerRequest('AddZSGoodsReq', 'AddZSGoodsRsp', params, Market.GZ);
}

/**
 * 钻石出库申请
 */
export function receiptZSOutApply(params: TradeRequest<Proto.ReceiptZSOutApplyReq, Proto.ReceiptZSOutApplyRsp>) {
    return tradeServerRequest('ReceiptZSOutApplyReq', 'ReceiptZSOutApplyRsp', params, 4);
}

/**
 * 商品收藏操作
 */
export function goodsFavoriteOperate(params: TradeRequest<Proto.GoodsFavoriteOperateReq, Proto.GoodsFavoriteOperateRsp>) {
    return tradeServerRequest('GoodsFavoriteOperateReq', 'GoodsFavoriteOperateRsp', params, Market.GZ);
}