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

const userStore = useUserStore()

/**
 * 报表管理-->经纪会员报表
 */
export function orgReportQuery(options: CommonFetchOptions<{ request: Partial<Model.OrgReportQueryReq>; response: Model.OrgReportQueryRsp[]; }>) {
    options.data = {
        orgztypes: userStore.userInfo.orgztypes,
        ...options.data
    }
    return httpClient.commonRequest('/reportForm/orgReportQuery', 'get', options)
}


/**
 * 报表管理-->经纪会员报表-->导出 
 */
export function orgReportQueryExport(options: CommonFetchOptions<{ request: Model.OrgReportQueryExportReq; }>) {
    return httpClient.commonRequest('/reportForm/orgReportQueryExport', 'get', options)
}

/**
 * 报表管理-->推荐成交报表-->推荐人信息
 */
export function queryRefUserSelect(options: CommonFetchOptions<{ request: Model.RefUserSelectReq; response: Model.RefUserSelectRsp[]; }>) {
    return httpClient.commonRequest('/reportForm/queryRefUserSelect', 'get', options)
}

/**
 * 报表管理-->分润报表(机构)
 */
export function shareAmountQuery(options: CommonFetchOptions<{ request: Partial<Model.ShareAmountQueryReq>; response: Model.ShareAmountQueryRsp[]; }>) {
    options.data = {
        orgztypes: userStore.userInfo.orgztypes,
        ...options.data
    }
    return httpClient.commonRequest('/reportForm/shareAmountQuery', 'get', options)
}

/**
 * 报表管理-->分润报表(平台)
 */
export function shareAmountQueryPlat(options: CommonFetchOptions<{ request: Partial<Model.ShareAmountQueryPlatReq>; response: Model.ShareAmountQueryPlatRsp[]; }>) {
    options.data = {
        orgztypes: userStore.userInfo.orgztypes,
        ...options.data
    }
    return httpClient.commonRequest('/reportForm/shareAmountQueryPlat', 'get', options)
}

/**
 * 报表管理-->分润报表(机构)-->机构明细
 */
export function queryDODPage(options: CommonFetchOptions<{ request: Partial<Model.DODPageReq>; response: Model.DODPageRsp[]; }>) {
    options.data = {
        orgztypes: userStore.userInfo.orgztypes,
        ...options.data
    }
    return httpClient.commonRequest('/reportForm/queryDODPage', 'get', options)
}

/**
 * 报表管理-->推荐成交报表
 */
export function queryTrade(options: CommonFetchOptions<{ request: Model.TradeReq; response: Model.TradeRsp[]; }>) {
    return httpClient.commonRequest('/reportForm/trade', 'get', options)
}

/**
 * 报表管理-->资金账户报表-->资金账户下拉列表
 */
export function queryTAAccountChildrenSelect(options: CommonFetchOptions<{ request: Model.TAAccountChildrenSelectReq; response: Model.TAAccountChildrenSelectRsp[]; }>) {
    return httpClient.commonRequest('/reportForm/queryTAAccountChildrenSelect', 'get', options)
}

/**
 * 报表管理-->资金账户报表-->资金信息
 */
export function taaccountReportQuery(options: CommonFetchOptions<{ request: Model.TaaccountReportReq; response: Model.TaaccountReportRsp; }>) {
    return httpClient.commonRequest('/reportForm/taaccountReportQuery', 'get', options)
}

/**
 * 报表管理-->资金账户报表-->持仓汇总表
 */
export function holderTotalQuery(options: CommonFetchOptions<{ request: Model.TaaccountReportReq; response: Model.HolderTotalRsp[]; }>) {
    return httpClient.commonRequest('/reportForm/holdertotalquery', 'get', options)
}

/**
 * 报表管理-->资金账户报表-->仓单汇总表
 */
export function wrPositionQuery(options: CommonFetchOptions<{ request: Model.TaaccountReportReq; response: Model.WrPositionRsp[]; }>) {
    return httpClient.commonRequest('/reportForm/wrpositionquery', 'get', options)
}

/**
 * 报表管理-->资金账户报表-->成交汇总表
 */
export function tradeQuery(options: CommonFetchOptions<{ request: Model.TaaccountReportReq; response: Model.TradeQueryRsp[]; }>) {
    return httpClient.commonRequest('/reportForm/tradequery', 'get', options)
}

/**
 * 报表管理-->资金账户报表-->履约汇总表
 */
export function accountppQuery(options: CommonFetchOptions<{ request: Model.TaaccountReportReq; response: Model.AccountppRsp; }>) {
    return httpClient.commonRequest('/reportForm/accountppquery', 'get', options)
}

/**
 * 报表管理-->交易商资金报表/机构资金报表
 */
export function investorReportQuery(options: CommonFetchOptions<{ request: Partial<Model.InvestorReportReq>; response: Model.InvestorReportRsp; }>) {
    options.data = {
        orgztypes: userStore.userInfo.orgztypes,
        ...options.data
    }
    return httpClient.commonRequest('/reportForm/investorReportQuery', 'get', options)
}

/**
 * 报表管理-->银行资金报表
 */
export function cusbankReportQuery(options: CommonFetchOptions<{ request: Partial<Model.CusbankReportReq>; response: Model.CusbankReportRsp[]; }>) {
    return httpClient.commonRequest('/reportForm/cusbank', 'get', options)
}

/**
 * 报表管理-->银行资金报表-->导出 
 */
export function cusbankReportQueryExport(options: CommonFetchOptions<{ request: Model.CusbankReportExportReq; }>) {
    return httpClient.commonRequest('/reportForm/cusbankexport', 'get', options)
}

/**
 * 报表管理-->商品交易报表
 */
export function dayGoodsCountReportQuery(options: CommonFetchOptions<{ request: Partial<Model.DayGoodsCountReportReq>; response: Model.DayGoodsCountReportRsp; }>) {
    return httpClient.commonRequest('/reportForm/daygoodscount', 'get', options)
}

/**
 * 报表管理-->商品交易报表-->导出
 */
export function dayGoodsCountExport(options: CommonFetchOptions<{ request: Model.DayGoodsCountReportExportReq; }>) {
    return httpClient.commonRequest('/reportForm/goodscountexport', 'get', options)
}

/**
 * 报表管理-->交易商资金报表 --> 导出
 */
export function investorReportExport(options: CommonFetchOptions<{ request: Model.InvestorReportExportReq; }>) {
    return httpClient.commonRequest('/reportForm/investorReportExport', 'get', options)
}

/**
 * 报表管理-->机构资金报表 --> 导出
 */
export function investorReportOrgExport(options: CommonFetchOptions<{ request: Model.InvestorReportOrgExportReq; }>) {
    return httpClient.commonRequest('/reportForm/investorReportOrgExport', 'get', options)
}

/**
 * 报表管理-->服务费分润报表
 */
export function manageDivReportQuery(options: CommonFetchOptions<{ request: Partial<Model.ManageDivReq>; response: Model.ManageDivRsp[]; }>) {
    return httpClient.commonRequest('/reportForm/managediv', 'get', options)
}

/**
 * 报表管理-->服务费分润报表 --> 导出
 */
export function manageDivExport(options: CommonFetchOptions<{ request: Partial<Model.ManageDivExportReq>; }>) {
    return httpClient.commonRequest('/reportForm/managedivexport', 'get', options)
}

/**
 * 报表管理-->报表重算
 */
export function rerun(options: CommonFetchOptions<{ request: Partial<Model.ReturnReq>; }>) {
    return httpClient.commonRequest('/reportForm/rerun', 'get', options)
}