import httpClient from '@/services/http'
import { CommonFetchOptions } from '@/services/http/types'
import { useUserStore } from '@/stores'

const userStore = useUserStore()

/**
 * 委托单查询
 */
export function queryCommissionSheet(options: CommonFetchOptions<{ request: Partial<Model.CommissionSheetReq>; response: Model.CommissionSheetRsp[]; }>) {
    if (options.data) {
        options.data.orgztypes = userStore.userInfo.orgztypes
    }
    return httpClient.commonRequest('/query/commissionSheet', 'get', options)
}

/**
 * 委托单详情
 */
export function queryCommissionSheetDetail(options: CommonFetchOptions<{ request: Model.CommissionSheetDetailReq; response: Model.CommissionSheetDetailRsp; }>) {
    return httpClient.commonRequest('/query/commissionSheetDetail', 'get', options)
}

/**
 * 委托单导出
 */
export function commissionExport(options: CommonFetchOptions<{ request: Model.CommissionSheetReq; response: string; }>) {
    return httpClient.commonRequest('/query/commissionExport', 'get', options)
}

/**
 * 成交单查询
 */
export function queryContractSheet(options: CommonFetchOptions<{ request: Partial<Model.ContractSheetReq>; response: Model.ContractSheetRsp[]; }>) {
    if (options.data) {
        options.data.orgztypes = userStore.userInfo.orgztypes
    }
    return httpClient.commonRequest('/query/contractSheet', 'get', options)
}

/**
 * 成交单详情查询
 */
export function queryContractSheetDetailDetail(options: CommonFetchOptions<{ request: Model.ContractSheetDetailReq; response: Model.ContractSheetDetailRsp; }>) {
    return httpClient.commonRequest('/query/contractSheetDetail', 'get', options)
}

/**
 * 成交单导出
 */
export function contractExport(options: CommonFetchOptions<{ request: Model.ContractSheetReq; response: string; }>) {
    return httpClient.commonRequest('/query/contractExport', 'get', options)
}

/**
 * 持仓单查询
 */
export function queryPositionSheet(options: CommonFetchOptions<{ request: Partial<Model.PositionSheetReq>; response: Model.PositionSheetRsp[]; }>) {
    if (options.data) {
        options.data.orgztypes = userStore.userInfo.orgztypes
    }
    return httpClient.commonRequest('/query/positionSheet', 'get', options)
}

/**
 * 持仓单详情查询
 */
export function queryPositionSheetDetail(options: CommonFetchOptions<{ request: Model.PositionSheetDetailReq; response: Model.PositionSheetDetailRsp; }>) {
    return httpClient.commonRequest('/query/positionSheetDetail', 'get', options)
}

/**
 * 持仓单导出
 */
export function positionExport(options: CommonFetchOptions<{ request: Model.PositionSheetReq; response: string; }>) {
    return httpClient.commonRequest('/query/positionExport', 'get', options)
}

/**
 * 持仓单汇总查询
 */
export function queryPositionSumSheet(options: CommonFetchOptions<{ request: Model.PositionSumSheetReq; response: Model.PositionSumSheetRsp[]; }>) {
    return httpClient.commonRequest('/query/positionSumSheet', 'get', options)
}

/**
 * 持仓单汇总导出
 */
export function positionSumSheetExport(options: CommonFetchOptions<{ request: Model.PositionSumSheetReq; response: string; }>) {
    return httpClient.commonRequest('/query/positionSumSheetExport', 'get', options)
}

/**
 * 内部订单查询--> 商品成交汇总 --> 获取列表
 */
export function queryGoodsTrade(options: CommonFetchOptions<{ request: Model.GoodsTradeReq; response: Model.GoodsTradeRsp[]; }>) {
    return httpClient.commonRequest('/query/queryGoodsTrade', 'get', options)
}

/**
 * 内部订单查询--> 商品成交汇总 --> 导出
 */
export function queryGoodsTradeExport(options: CommonFetchOptions<{ request: Model.PositionSumSheetReq; response: string; }>) {
    return httpClient.commonRequest('/query/queryGoodsTradeExport', 'get', options)
}

/**
 * 内部订单查询--> 账户成交汇总 --> 获取列表
 */
export function accountTransactions(options: CommonFetchOptions<{ request: Model.AccountTransactionsReq; response: Model.AccountTransactionsRsp[]; }>) {
    return httpClient.commonRequest('/query/accountTransactions', 'get', options)
}

/**
 * 内部订单查询--> 账户成交汇总 --> 导出
 */
export function accountExport(options: CommonFetchOptions<{ request: Model.AaccountExportReq; response: string; }>) {
    return httpClient.commonRequest('/query/accountExport', 'get', options)
}

/**
 * 仓单查询--> 仓单汇总查询查询 --> 初始化仓单标准以及仓库
 */
export function initWarehouse(options: CommonFetchOptions<{ response: Model.InitWarehouseRsp; }>) {
    return httpClient.commonRequest('/query/initWarehouse', 'get', options)
}

/**
 * 内部订单查询--> 机构成交汇总 --> 获取列表
 */
export function queryInvestor(options: CommonFetchOptions<{ request: Model.InvestorOrderReq; response: Model.InvestorOrderRsp[]; }>) {
    return httpClient.commonRequest('/query/queryInvestor', 'get', options)
}

/**
 * 仓单类订单查询--> 成交单查询 --> 获取列表
 */
export function queryTradeOrder(options: CommonFetchOptions<{ request: Model.TradeOrderReq; response: Model.TradeOrderRsp[]; }>) {
    return httpClient.commonRequest('/query/queryTradeOrder', 'get', options)
}

/**
 * 仓单查询--> 仓单汇总查询查询 --> 获取列表
 */
export function summaryQuery(options: CommonFetchOptions<{ request: Model.SummaryQueryReq; response: Model.SummaryQueryRsp[]; }>) {
    return httpClient.commonRequest('/query/summaryQuery', 'get', options)
}

/**
 * 仓单查询--> 仓单汇总查询查询 --> 详情
 */
export function summaryQueryDetail(options: CommonFetchOptions<{ request: Model.SummaryQueryDetailReq; response: Model.SummaryQueryDetailRsp[]; }>) {
    return httpClient.commonRequest('/query/summaryQueryDetail', 'get', options)
}

/**
 * 仓单查询--> 仓单汇总查询查询 --> 详情 --> 初始化持有人
 */
export function summaryQueryInit(options: CommonFetchOptions<{ response: Model.SummaryQueryInitRsp[]; }>) {
    return httpClient.commonRequest('/query/summaryQueryInit', 'get', options)
}

/**
 * 仓单类订单查询--> 成交单查询 --> 导出
 */
export function tradeOrderExport(options: CommonFetchOptions<{ request: Model.TradeOrderExportReq; response: string; }>) {
    return httpClient.commonRequest('/query/tradeOrderExport', 'get', options)
}

/**
 * 仓单类订单查询--> 委托单查询 --> 详情
 */
export function tradeOrderView(options: CommonFetchOptions<{ request: Model.TradeOrderViewReq; response: Model.TradeOrderViewRsp; }>) {
    return httpClient.commonRequest('/query/tradeOrderView', 'get', options)
}

/**
 * 仓单类订单查询--> 成交单查询 --> 详情
 */
export function tradeTradedView(options: CommonFetchOptions<{ request: Model.TradeTradedViewReq; response: Model.TradeTradedViewRsp; }>) {
    return httpClient.commonRequest('/query/tradeTradedView', 'get', options)
}

/**
 * 仓单类订单查询--> 委托单查询 --> 导出
 */
export function warehouseExport(options: CommonFetchOptions<{ request: Model.WarehouseExportReq; response: string; }>) {
    return httpClient.commonRequest('/query/warehouseExport', 'get', options)
}

/**
 * 仓单类订单查询--> 委托单查询 --> 获取列表
 */
export function warehouseQuery(options: CommonFetchOptions<{ request: Model.WarehouseQueryReq; response: Model.WarehouseQueryRsp[]; }>) {
    return httpClient.commonRequest('/query/warehouseQuery', 'get', options)
}

/**
 * 内部订单查询--> 成交汇总查询 --> 获取列表
 */
export function queryTradeSum(options: CommonFetchOptions<{ request: Model.TradeSumReq; response: Model.TradeSumRsp[]; }>) {
    return httpClient.commonRequest('/query/queryTradeSum', 'get', options)
}

/**
 * 内部订单查询--> 成交汇总查询 --> 导出列表
 */
export function exportTradeSum(options: CommonFetchOptions<{ request: Model.TradeSumReq; response: string; }>) {
    return httpClient.commonRequest('/query/exportTradeSum', 'get', options)
}

/**
 * 内部订单查询--> 交收委托查询 --> 获取列表
 */
export function queryDeliveryOrder(options: CommonFetchOptions<{ request: Model.DeliveryOrderReq; response: Model.DeliveryOrderRsp[]; }>) {
    return httpClient.commonRequest('/query/queryDeliveryOrder', 'get', options)
}

/**
 * 内部订单查询--> 交收委托查询 --> 交收委托详情
 */
export function queryDeliveryOrderDetail(options: CommonFetchOptions<{ request: Model.DeliveryOrderDetailReq; response: Model.DeliveryOrderDetailRsp; }>) {
    return httpClient.commonRequest('/query/deliveryOrderDetail', 'get', options)
}

/**
 * 内部订单查询--> 交收成交 --> 获取列表
 */
export function querySettlementDeal(options: CommonFetchOptions<{ request: Model.SettlementDealReq; response: Model.SettlementDealRsp[]; }>) {
    return httpClient.commonRequest('/query/querySettlementDeal', 'get', options)
}

/**
 * 内部订单查询--> 交收成交 --> 交收成交详情
 */
export function querySettlementDealDetail(options: CommonFetchOptions<{ request: Model.SettlementDealDetailReq; response: Model.SettlementDealDetailRsp; }>) {
    return httpClient.commonRequest('/query/settlementDealDetail', 'get', options)
}

/**
 * 内部订单查询--> 线下交收单查询 --> 获取列表
 */
export function queryOffline(options: CommonFetchOptions<{ request: Model.OfflineReq; response: Model.OfflineRsp[]; }>) {
    return httpClient.commonRequest('/query/queryoffline', 'get', options)
}

/**
 * 内部订单查询--> 线下交收单查询 --> 详情
 */
export function queryOfflineDetail(options: CommonFetchOptions<{ request: Model.OfflineDetailReq; response: Model.OfflineDetailRsp; }>) {
    return httpClient.commonRequest('/query/offlinedetail', 'get', options)
}

/**
 * 内部订单查询--> 线下交收单查询 --> 导出
 */
export function offlineExport(options: CommonFetchOptions<{ request: Model.OfflineReq; response: string; }>) {
    return httpClient.commonRequest('/query/offlineexport', 'get', options)
}

/**
 * 内部订单查询--> 线下交收单查询 --> 确认交收
 */
export function offlineClose(options: CommonFetchOptions<{ request: Model.OfflineCloseReq; }>) {
    return httpClient.commonRequest('/query/offlineclose', 'get', options)
}

/**
 * 内部订单查询--> 线下交收单查询 --> 交收失败
 */
export function offlineFail(options: CommonFetchOptions<{ request: Model.OfflineFailReq; }>) {
    return httpClient.commonRequest('/query/offlinefail', 'get', options)
}

/**
 * 内部订单查询--> 线下交收单查询 --> 交收付款
 */
export function sellGoods(options: CommonFetchOptions<{ request: Model.SellGoodsReq; }>) {
    return httpClient.commonRequest('/query/sellGoods', 'get', options)
}

/**
 * 订单管理--> 订单监控 --> 获取列表
 */
export function monitorddjk(options: CommonFetchOptions<{ request: Model.MonitorddjkReq; response: Model.MonitorddjkRsp[]; }>) {
    return httpClient.commonRequest('/queryOrder/monitorddjk', 'get', options)
}

/**
 * 订单管理--> 订单监控 --> 获取总数居
 */
export function monitorddjkCount(options: CommonFetchOptions<{ request: Omit<Model.MonitorddjkReq, 'pageNum' | 'pageSize'>; response: Model.MonitorddjkCountRsp; }>) {
    return httpClient.commonRequest('/queryOrder/monitorddjkCount', 'get', options)
}

/**
 * 订单管理--> 订单查询 --> 获取列表
 */
export function queryOrder(options: CommonFetchOptions<{ request: Model.OrderReq; response: Model.OrderRsp[]; }>) {
    return httpClient.commonRequest('/queryOrder/query', 'get', options)
}

/**
 * 订单管理--> 订单查询 --> 获取详情
 */
export function queryOrderDetail(options: CommonFetchOptions<{ request: Model.OrderDetailReq; response: Model.OrderDetailRsp; }>) {
    return httpClient.commonRequest('/queryOrder/queryDetail', 'get', options)
}

/**
 * 订单管理--> 订单查询 --> 导出
 */
export function orderExport(options: CommonFetchOptions<{ request: Model.OrderReq; response: string; }>) {
    return httpClient.commonRequest('/queryOrder/export', 'get', options)
}

/**
 * 订单管理--> 终止单查询 --> 获取列表
 */
export function queryTerOrder(options: CommonFetchOptions<{ request: Model.TerOrderReq; response: Model.TerOrderRsp[]; }>) {
    return httpClient.commonRequest('/queryOrder/queryTerOrder', 'get', options)
}

/**
 * 订单管理--> 终止单查询 --> 获取列表
 */
export function terOrderExport(options: CommonFetchOptions<{ request: Model.TerOrderReq; response: string; }>) {
    return httpClient.commonRequest('/queryOrder/terOrderExport', 'get', options)
}

/**
 * 订单管理--> 强制终止单 --> 获取列表
 */
export function queryForcedOrder(options: CommonFetchOptions<{ request: Model.ForcedOrderReq; response: Model.ForcedOrderRsp[]; }>) {
    return httpClient.commonRequest('/queryOrder/queryForcedOrder', 'get', options)
}

/**
 * 订单管理--> 强制终止单 --> 斩仓恢复
 */
export function forcedOrderRecover(options: CommonFetchOptions<{ request: Model.ForcedOrderRecoverReq; }>) {
    return httpClient.commonRequest('/queryOrder/forcedOrderRecover', 'get', options)
}

/**
 * 订单管理--> 强制终止单 --> 导出
 */
export function forcedOrderExport(options: CommonFetchOptions<{ request: Model.ForcedOrderReq; response: string; }>) {
    return httpClient.commonRequest('/queryOrder/forcedOrderExport', 'get', options)
}

/**
 * 订单管理--> 交收单管理 --> 获取列表
 */
export function queryDeliveryOrderList(options: CommonFetchOptions<{ request: Model.DeliveryOrderListReq; response: Model.DeliveryOrderListRsp[]; }>) {
    return httpClient.commonRequest('/queryOrder/queryDeliveryOrder', 'get', options)
}

/**
 * 订单管理--> 交收单管理 --> 获取详情
 */
export function queryDeliveryOrderListDetail(options: CommonFetchOptions<{ request: Model.DeliveryOrderListDetailReq; response: Model.DeliveryOrderListDetailRsp; }>) {
    return httpClient.commonRequest('/queryOrder/deliveryOrderDetail', 'get', options)
}

/**
 * 订单管理--> 交收单管理 --> 导出
 */
export function deliveryOrderListExport(options: CommonFetchOptions<{ request: Model.DeliveryOrderListReq; response: string; }>) {
    return httpClient.commonRequest('/queryOrder/deliveryOrderExport', 'get', options)
}

/**
 * 订单管理--> 订单日报表 --> 获取列表
 */
export function queryOrderDate(options: CommonFetchOptions<{ request: Model.OrderDateReq; response: Model.OrderDateRsp[]; }>) {
    return httpClient.commonRequest('/queryOrder/queryOrderDate', 'get', options)
}

/**
 * 订单管理--> 订单日报表 --> 导出
 */
export function orderDateExport(options: CommonFetchOptions<{ request: Model.OrderDateReq; response: string; }>) {
    return httpClient.commonRequest('/queryOrder/orderDateExport', 'get', options)
}

/**
 * 其他查询--> 交易商资金查询、机构资金查询--> 获取列表
 */
export function queryinvestor(options: CommonFetchOptions<{ request: Model.InvestorReq; response: Model.InvestorRsp[]; }>) {
    return httpClient.commonRequest('/query/queryinvestor', 'get', options)
}