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 zsBuyOrderListing(params: TradeRequest<Proto.ZSBuyOrderListingReq, Proto.ZSBuyOrderListingRsp>) {
    return tradeServerRequest('ZSBuyOrderListingReq', 'ZSBuyOrderListingRsp', params, Market.GZ);
}

/**
 * 钻石卖挂牌
 */
export function zsSellOrderListing(params: TradeRequest<Proto.ZSSellOrderListingReq, Proto.ZSSellOrderListingRsp>) {
    return tradeServerRequest('ZSSellOrderListingReq', 'ZSSellOrderListingRsp', params, Market.GZ);
}

/**
 * 钻石买摘牌
 */
export function zsBuyOrderDesting(params: TradeRequest<Proto.ZSBuyOrderDestingReq, Proto.ZSBuyOrderDestingRsp>) {
    return tradeServerRequest('ZSBuyOrderDestingReq', 'ZSBuyOrderDestingRsp', params, Market.GZ);
}

/**
 * 钻石买摘牌询价
 */
export function zsBuyOrderDestingNegPrice(params: TradeRequest<Proto.ZSBuyOrderDestingNegPriceReq, Proto.ZSBuyOrderDestingNegPriceRsp>) {
    return tradeServerRequest('ZSBuyOrderDestingNegPriceReq', 'ZSBuyOrderDestingNegPriceRsp', params, Market.GZ);
}

/**
 * 钻石卖摘牌申请
 */
export function zsSellOrderDestingApply(params: TradeRequest<Proto.ZSSellOrderDestingApplyReq, Proto.ZSSellOrderDestingApplyRsp>) {
    return tradeServerRequest('ZSSellOrderDestingApplyReq', 'ZSSellOrderDestingApplyRsp', params, Market.GZ);
}

/**
 * 钻石买询价操作
 */
export function zsBuyOrderDestingNegPriceOperate(params: TradeRequest<Proto.ZSBuyOrderDestingNegPriceOperateReq, Proto.ZSBuyOrderDestingNegPriceOperateRsp>) {
    return tradeServerRequest('ZSBuyOrderDestingNegPriceOperateReq', 'ZSBuyOrderDestingNegPriceOperateRsp', params, Market.GZ);
}

/**
 * 钻石卖询价操作
 */
export function zsSellOrderDestingApplyOperate(params: TradeRequest<Proto.ZSSellOrderDestingApplyOperateReq, Proto.ZSSellOrderDestingApplyOperateRsp>) {
    return tradeServerRequest('ZSSellOrderDestingApplyOperateReq', 'ZSSellOrderDestingApplyOperateRsp', params, Market.GZ);
}

/**
 * 钻石挂牌撤单
 */
export function wrListingCancelOrder(params: TradeRequest<Proto.WRListingCancelOrderReq, Proto.WRListingCancelOrderRsp>) {
    return tradeServerRequest('WRListingCancelOrderReq', 'WRListingCancelOrderRsp', params, Market.GZ);
}

/**
 * 查询求购大厅委托单
 */
export function queryBuyOrder(params: HttpRequest<{ req: Ermcp.BuyOrderReq, rsp: Ermcp.BuyOrderRsp[] }>) {
    return httpRequest('/Guangzuan/QueryBuyOrder', 'get', params);
}

/**
 * 查询我的求购
 */
export function queryMyBuyOrder(params: HttpRequest<{ req: Ermcp.MyBuyOrderReq, rsp: Ermcp.MyBuyOrderRsp[] }>) {
    return httpRequest('/Guangzuan/QueryMyBuyOrder', 'get', params);
}

/**
 * 搜索出售大厅委托单
 */
export function searchSellOrder(params: HttpRequest<{ req: Ermcp.SellOrderSearchReq, rsp: Ermcp.SellOrderSearchRsp[] }>) {
    return httpRequest('/Guangzuan/QueryDiamond', 'post', params);
}

/**
 * 查询出售大厅委托单
 */
export function querySellOrder(params: HttpRequest<{ req: Ermcp.SellOrderReq, rsp: Ermcp.SellOrderRsp[] }>) {
    return httpRequest('/Guangzuan/QuerySellOrder', 'get', params);
}

/**
 * 查询我的出售
 */
export function queryMySellOrder(params: HttpRequest<{ req: Ermcp.MySellOrderReq, rsp: Ermcp.MySellOrderRsp[] }>) {
    return httpRequest('/Guangzuan/QueryMySellOrder', 'get', params);
}

/**
 * 查询我的摘牌
 */
export function queryMyDeListing(params: HttpRequest<{ req: Ermcp.MyDeListingReq, rsp: Ermcp.MyDeListingRsp[] }>) {
    return httpRequest('/Guangzuan/QueryMyDeListing', 'get', params);
}

/**
 * 查询询价-求购
 */
export function queryMyBargainApply(params: HttpRequest<{ req: Ermcp.MyBargainApplyReq, rsp: Ermcp.MyBargainApplyRsp[] }>) {
    return httpRequest('/Guangzuan/QueryMyBargainApply', 'get', params);
}

/**
 * 查询询价-出售
 */
export function queryMyDelistingApply(params: HttpRequest<{ req: Ermcp.MyDelistingApplyReq, rsp: Ermcp.MyDelistingApplyRsp[] }>) {
    return httpRequest('/Guangzuan/QueryMyDelistingApply', 'get', params);
}