import http from '@/services/http'
import tradeServer from '@/services/socket/trade'

/**
 * 钻石买挂牌
 */
export function zsBuyOrderListing(params: Proto.ZSBuyOrderListingReq) {
    return tradeServer.sendMessage<Proto.ZSBuyOrderListingRsp>({
        params,
        reqName: 'ZSBuyOrderListingReq',
        rspName: 'ZSBuyOrderListingRsp',
        marketId: 67201
    })
}

/**
 * 钻石卖挂牌
 */
export function zsSellOrderListing(params: Proto.ZSSellOrderListingReq) {
    return tradeServer.sendMessage<Proto.ZSSellOrderListingRsp>({
        params,
        reqName: 'ZSSellOrderListingReq',
        rspName: 'ZSSellOrderListingRsp',
        marketId: 67201
    })
}

/**
 * 钻石买摘牌
 */
export function zsBuyOrderDesting(params: Proto.ZSBuyOrderDestingReq) {
    return tradeServer.sendMessage<Proto.ZSBuyOrderDestingRsp>({
        params,
        reqName: 'ZSBuyOrderDestingReq',
        rspName: 'ZSBuyOrderDestingRsp',
        marketId: 67201
    })
}

/**
 * 钻石买摘牌询价
 */
export function zsBuyOrderDestingNegPrice(params: Proto.ZSBuyOrderDestingNegPriceReq) {
    return tradeServer.sendMessage<Proto.ZSBuyOrderDestingNegPriceRsp>({
        params,
        reqName: 'ZSBuyOrderDestingNegPriceReq',
        rspName: 'ZSBuyOrderDestingNegPriceRsp',
        marketId: 67201
    })
}

/**
 * 钻石卖摘牌申请
 */
export function zsSellOrderDestingApply(params: Proto.ZSSellOrderDestingApplyReq) {
    return tradeServer.sendMessage<Proto.ZSSellOrderDestingApplyRsp>({
        params,
        reqName: 'ZSSellOrderDestingApplyReq',
        rspName: 'ZSSellOrderDestingApplyRsp',
        marketId: 67201
    })
}

/**
 * 钻石买询价操作
 */
export function zsBuyOrderDestingNegPriceOperate(params: Proto.ZSBuyOrderDestingNegPriceOperateReq) {
    return tradeServer.sendMessage<Proto.ZSBuyOrderDestingNegPriceOperateRsp>({
        params,
        reqName: 'ZSBuyOrderDestingNegPriceOperateReq',
        rspName: 'ZSBuyOrderDestingNegPriceOperateRsp',
        marketId: 67201
    })
}

/**
 * 钻石卖询价操作
 */
export function zsSellOrderDestingApplyOperate(params: Proto.ZSSellOrderDestingApplyOperateReq) {
    return tradeServer.sendMessage<Proto.ZSSellOrderDestingApplyOperateRsp>({
        params,
        reqName: 'ZSSellOrderDestingApplyOperateReq',
        rspName: 'ZSSellOrderDestingApplyOperateRsp',
        marketId: 67201
    })
}

/**
 * 钻石挂牌撤单
 */
export function wrListingCancelOrder(params: Proto.WRListingCancelOrderReq) {
    return tradeServer.sendMessage<Proto.WRListingCancelOrderRsp>({
        params,
        reqName: 'WRListingCancelOrderReq',
        rspName: 'WRListingCancelOrderRsp',
        marketId: 67201
    })
}

/**
 * 查询求购大厅委托单
 */
export function queryBuyOrder(params: Ermcp.BuyOrderReq) {
    return http.commonRequest<Ermcp.BuyOrderRsp[]>({
        url: '/Guangzuan/QueryBuyOrder',
        params,
    })
}

/**
 * 查询我的求购
 */
export function queryMyBuyOrder(params: Ermcp.MyBuyOrderReq) {
    return http.commonRequest<Ermcp.MyBuyOrderRsp[]>({
        url: '/Guangzuan/QueryMyBuyOrder',
        params,
    })
}

/**
 * 搜索出售大厅委托单
 */
export function searchSellOrder(data: Ermcp.SellOrderSearchReq) {
    return http.commonRequest<Ermcp.SellOrderSearchRsp[]>({
        method: 'post',
        url: '/Guangzuan/QueryDiamond',
        data,
    })
}

/**
 * 查询出售大厅委托单
 */
export function querySellOrder(params: Ermcp.SellOrderReq) {
    return http.commonRequest<Ermcp.SellOrderRsp[]>({
        url: '/Guangzuan/QuerySellOrder',
        params,
    })
}

/**
 * 查询我的出售
 */
export function queryMySellOrder(params: Ermcp.MySellOrderReq) {
    return http.commonRequest<Ermcp.MySellOrderRsp[]>({
        url: '/Guangzuan/QueryMySellOrder',
        params,
    })
}

/**
 * 查询我的摘牌
 */
export function queryMyDeListing(params: Ermcp.MyDeListingReq) {
    return http.commonRequest<Ermcp.MyDeListingRsp[]>({
        url: '/Guangzuan/QueryMyDeListing',
        params,
    })
}

/**
 * 查询询价-求购
 */
export function queryMyBargainApply(params: Ermcp.MyBargainApplyReq) {
    return http.commonRequest<Ermcp.MyBargainApplyRsp[]>({
        url: '/Guangzuan/QueryMyBargainApply',
        params,
    })
}

/**
 * 查询询价-出售
 */
export function queryMyDelistingApply(params: Ermcp.MyDelistingApplyReq) {
    return http.commonRequest<Ermcp.MyDelistingApplyRsp[]>({
        url: '/Guangzuan/QueryMyDelistingApply',
        params,
    })
}