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

const userStore = useUserStore()

/**
 * 资金账户管理查询
 */
export function queryTaAccount(options: CommonFetchOptions<{ request: Model.TaAccountReq; response: Model.TaAccountRsp[]; }> = {}) {
    return httpClient.commonRequest('/taAccount/query', 'get', options)
}

/**
 * 资金账户详情信息
 */
export function queryTaAccountDetail(options: CommonFetchOptions<{ request: Model.TaAccountDetailReq; response: Model.TaAccountDetailRsp; }> = {}) {
    return httpClient.commonRequest('/taAccount/queryDetail', 'get', options)
}

/**
 * 资金账户管理-->资金账户信息修改--> 初始化
 */
export function updateTaAccountInit(options: CommonFetchOptions<{ request: Model.UpdateTaAccountInitReq; response: Model.UpdateTaAccountInitRsp; }>) {
    if (options.data) {
        options.data.orgztypes = userStore.userInfo.orgztypes
    }
    return httpClient.commonRequest('/taAccount/updateTaAccountInit', 'get', options)
}

/**
 * 资金账户管理-->资金账户信息修改
 */
export function updateTaAccount(options: CommonFetchOptions<{ request: Partial<Model.UpdateTaAccountReq>; }>) {
    return httpClient.commonRequest('/taAccount/updateTaAccount', 'post', options)
}

/**
 * 资金账户管理->银行签约-->初始化托管银行
 */
export function dealAccountSignInit(options: CommonFetchOptions<{ request: Model.DealAccountSignInitReq; response: Model.DealAccountSignInitRsp[]; }> = {}) {
    return httpClient.commonRequest('/accountSign/dealAccountSignInit', 'get', options)
}

/**
 * 资金账户修改密码
 */
export function updateTaAccountPwd(options: CommonFetchOptions<{ request: Model.TaAccountPwdReq; }> = {}) {
    return httpClient.commonRequest('/taAccount/updatePwd', 'post', options)
}

/**
 * 资金流水信息列表查询
 */
export function queryAmountStream(options: CommonFetchOptions<{ request: Model.AmountStreamReq; response: Model.AmountStreamRsp[]; }>) {
    return httpClient.commonRequest('/taAccount/queryAmountStream', 'get', options)
}

/**
 * 资金流水信息导出
 */
export function queryAmountStreamExport(options: CommonFetchOptions<{ response: string; }>) {
    return httpClient.commonRequest('/taAccount/queryAmountStreamExport', 'get', options)
}

/**
 * 出入金查询
 */
export function queryPutOrIn(options: CommonFetchOptions<{ request: Model.PutOrInReq; response: Model.PutOrInRsp[]; }>) {
    return httpClient.commonRequest('/accountSign/queryPutOrIn', 'get', options)
}

/**
 * 出入金查询详情
 */
export function queryPutOrInDetail(options: CommonFetchOptions<{ request: Model.PutOrInDetailReq; response: Model.PutOrInDetailRsp[]; }>) {
    return httpClient.commonRequest('/accountSign/queryPutOrInDetail', 'get', options)
}

/**
 * 处理银行签约
 */
export function dealAccountSign(options: CommonFetchOptions<{ request: Partial<Model.DealAccountSignReq>; }>) {
    return httpClient.commonRequest('/accountSign/dealAccountSign', 'post', options)
}

/**
 * 获取签约银行详细信息
 */
export function getSignBankById(options: CommonFetchOptions<{ request: Model.SignBankByIdReq; response: Model.SignBankByIdRsp; }>) {
    return httpClient.commonRequest('/accountSign/getSignBankById', 'get', options)
}

/**
 * 银行签约信息/签解约管理列表
 */
export function queryAccountSign(options: CommonFetchOptions<{ request: Model.AccountSignReq; response: Model.AccountSignRsp[]; }>) {
    return httpClient.commonRequest('/accountSign/query', 'get', options)
}

/**
 * 通用枚举判断信息展示查询
 */
export function queryCommonFlag(options: CommonFetchOptions<{ request: Model.CommonFlagReq; response: Model.CommonFlagRsp; }>) {
    return httpClient.commonRequest('/common/queryCommonFlag', 'get', options)
}

/**
 * 网上出入金申请
 */
export function inOrOutAmount(options: CommonFetchOptions<{ request: Model.InOrOutAmountReq; }>) {
    return httpClient.commonRequest('/taAccount/inOrOutAmount', 'post', options)
}

/**
 * 内部订单查询--> 电子协议管理 --> 获取列表
 */
export function queryesignrecord(options: CommonFetchOptions<{ request: Model.SignRecordReq; response: Model.SignRecordRsp[] }>) {
    return httpClient.commonRequest('/query/queryesignrecord', 'get', options)
}

/**
 * 账号管理-->交易账号管理-->获取列表
 */
export function queryTradingAcc(options: CommonFetchOptions<{ request: Model.TradingAccReq; response: Model.TradingAccRsp; }>) {
    return httpClient.commonRequest('/tradingAcc/query', 'get', options)
}

/**
 * 账号管理-->交易账号管理-->新增
 */
export function tradingAccAdd(options: CommonFetchOptions<{ request: Model.TradingAccAddReq; }>) {
    return httpClient.commonRequest('/tradingAcc/add', 'post', options)
}

/**
 * 账号管理-->交易账号管理-->修改
 */
export function tradingAccEdit(options: CommonFetchOptions<{ request: Model.TradingAccAddReq; }>) {
    return httpClient.commonRequest('/tradingAcc/edit', 'post', options)
}

/**
 * 账号管理-->交易账号管理-->新增-->初始化登录账户及授权资金账户
 */
export function tradingAccInitAdd(options: CommonFetchOptions<{ response: Model.TradingAccInitAddRsp; }>) {
    return httpClient.commonRequest('/tradingAcc/initAdd', 'get', options)
}

/**
 * 账号管理-->交易账号管理-->详情
 */
export function tradingAccView(options: CommonFetchOptions<{ request: Model.TradingAccViewReq; response: Model.TradingAccViewRsp; }>) {
    return httpClient.commonRequest('/tradingAcc/view', 'get', options)
}

/**
 * 账号管理-->交易账号管理-->重置密码
 */
export function tradingAccResetPwd(options: CommonFetchOptions<{ request: Model.TradingAccResetPwdReq; }>) {
    return httpClient.commonRequest('/tradingAcc/resetPwd', 'get', options)
}

/**
 * 账号管理-->交易账号管理-->锁定
 */
export function tradingAccLockAccount(options: CommonFetchOptions<{ request: Model.TradingAccLockAccountReq; }>) {
    return httpClient.commonRequest('/tradingAcc/lockAccount', 'get', options)
}

/**
 * 账号管理-->交易账号管理-->注销
 */
export function tradingAccDelAccount(options: CommonFetchOptions<{ request: Model.TradingAccDelAccountReq; }>) {
    return httpClient.commonRequest('/tradingAcc/delAccount', 'get', options)
}

/**
 * 账号管理-->交易账号管理-->恢复
 */
export function tradingAccUndelAccount(options: CommonFetchOptions<{ request: Model.TradingAccUndelAccountReq; }>) {
    return httpClient.commonRequest('/tradingAcc/undelAccount', 'get', options)
}