import { getUserId } from "@/services/bus/account";
import { getLongTypeLoginID } from "@/services/bus/login";
import {
    AuditWskhUserInfoReq, AuditWskhUserInfoRsp,
    CustomerInfoOperateReq, CustomerInfoOperateRsp,
    ErmcpBizGroupReq,
    ErmcpBizGroupRsp,
    HedgeOutMainConfigReq,
    HedgeOutMainConfigRsp,
    LoginaccountOperateReq,
    LoginaccountOperateRsp,
    ManagerRoleOperateReq,
    ManagerRoleOperateRsp,
    TaaccountOperateReq,
    TaaccountOperateRsp,
    TaaccountTransfersxmoneyReq,
    TaaccountTransfersxmoneyRsp,
    UserInfoCheckMangeReq,
    UserInfoCheckMangeRsp
} from "@/services/proto/accountinfo/interface";
import { protoMiddleware } from "@/services/socket/protobuf/buildReq";

/**
 * 客户资料审核
 * @param param
 */
export const userInfoCheck = (param: UserInfoCheckMangeReq): Promise<UserInfoCheckMangeRsp> => {
    return protoMiddleware<UserInfoCheckMangeReq>(param, 'UserInfoCheckMangeReq', 'UserInfoCheckMangeRsp', 2)
}

/**
 * 角色设置操作请求
 * @param param
 */
export const roleOperate = (param: ManagerRoleOperateReq): Promise<ManagerRoleOperateRsp> => {
    return protoMiddleware<ManagerRoleOperateReq>(param, 'ManagerRoleOperateReq', 'ManagerRoleOperateRsp', 2)
}

/**
 * 登陆账户操作请求
 * @param param
 */
export const loginAccountOperate = (param: LoginaccountOperateReq): Promise<LoginaccountOperateRsp> => {
    const obj = {
        modifierid: Number(getLongTypeLoginID()),
        areauserid: getUserId(),
    }
    Object.assign(param, obj)
    return protoMiddleware<LoginaccountOperateReq>(param, 'LoginaccountOperateReq', 'LoginaccountOperateRsp', 2)
}

/**
 * 期货账户设置请求
 * @param param
 */
export const bizGroupReq = (param: ErmcpBizGroupReq): Promise<ErmcpBizGroupRsp> => {
    return protoMiddleware<ErmcpBizGroupReq>(param, 'ErmcpBizGroupReq', 'ErmcpBizGroupRsp', 2)
}

/**
 * 期货账户新增修改请求
 * @param param
 */
export const hedgeOutMainReq = (param: HedgeOutMainConfigReq): Promise<HedgeOutMainConfigRsp> => {
    return protoMiddleware<HedgeOutMainConfigReq>(param, 'HedgeOutMainConfigReq', 'HedgeOutMainConfigRsp', 3)
}

/**
 * 期货账户注销
 * @param param
 */
export const taAccountOperateReq = (param: TaaccountOperateReq): Promise<TaaccountOperateRsp> => {
    return protoMiddleware<TaaccountOperateReq>(param, 'TaaccountOperateReq', 'TaaccountOperateRsp', 2)
}

/**
 * 期货账户授信
 * @param param
 */
export const taAccountTransfersXMoneyReq = (param: TaaccountTransfersxmoneyReq): Promise<TaaccountTransfersxmoneyRsp> => {
    return protoMiddleware<TaaccountTransfersxmoneyReq>(param, 'TaaccountTransfersxmoneyReq', 'TaaccountTransfersxmoneyRsp', 2)
}

/**
 * 添加账户信息 （新增修改账户信息）
 * @param param
 */
export const addCustomerInfoOperate = (param: CustomerInfoOperateReq): Promise<CustomerInfoOperateRsp> => {
    return protoMiddleware<CustomerInfoOperateReq>(param, 'CustomerInfoOperateReq', 'CustomerInfoOperateRsp', 2)
}

/**
 * 客户注册审核请求 （审核通过/审核拒绝）
 * @param param
 */
export const auditWskhUserInfo = (param: AuditWskhUserInfoReq): Promise<AuditWskhUserInfoRsp> => {
    return protoMiddleware<AuditWskhUserInfoReq>(param, 'AuditWskhUserInfoReq', 'AuditWskhUserInfoRsp', 2)
}



