/*
 * @Author: asmalltownboy asmalltownboy@hotmail.com
 * @Date: 2022-06-11 16:02:54
 * @LastEditors: asmalltownboy asmalltownboy@hotmail.com
 * @LastEditTime: 2022-06-11 16:20:32
 * @FilePath: \MTP2.0_WEB\src\services\proto\hedgedItem\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { protoMiddleware } from '@/services/socket/protobuf/buildReq';
import { HeadEnum } from '@/services/socket/protobuf/protoHeader';
import { HedgedItemAddReq, HedgedItemAddRsp, HedgedItemOperateReq, HedgedItemOperateRsp, HedgedItemEndReq, HedgedItemEndRsp, ContractRelatedHedgedItemReq, ContractRelatedHedgedItemRsp, HedgedItemRelatedPlanReq, HedgedItemRelatedPlanRsp, InnerTradeLinkReq, InnerTradeLinkRsp, ManageAmendOrderReq, ManageAmendOrderRsp } from './interface';

/**
 * 新增套期项目请求
 */
export const hedgedItemAdd = (param: HedgedItemAddReq): Promise<HedgedItemAddRsp> => {
    return protoMiddleware(param, 'HedgedItemAddReq', 'HedgedItemAddRsp', 2);
};

/**
 * 套期项目操作请求
 */
export const hedgedItemOperate = (param: HedgedItemOperateReq): Promise<HedgedItemOperateRsp> => {
    return protoMiddleware(param, 'HedgedItemOperateReq', 'HedgedItemOperateRsp', 2);
};

/**
 * 套期项目结束请求
 */
export const hedgedItemEnd = (param: HedgedItemEndReq): Promise<HedgedItemEndRsp> => {
    return protoMiddleware(param, 'HedgedItemEndReq', 'HedgedItemEndRsp', 2);
};

/**
 * 合同关联项目请求
 */
export const contractRelatedHedgedItem = (param: ContractRelatedHedgedItemReq): Promise<ContractRelatedHedgedItemRsp> => {
    return protoMiddleware(param, 'ContractRelatedHedgedItemReq', 'ContractRelatedHedgedItemRsp', 2);
};

/**
 * 项目关联计划请求
 */
export const hedgedItemRelatedPlan = (param: HedgedItemRelatedPlanReq): Promise<HedgedItemRelatedPlanRsp> => {
    return protoMiddleware(param, 'HedgedItemRelatedPlanReq', 'HedgedItemRelatedPlanRsp', 2);
};

/**
 * 内部成交单关联请求
 */
export const innerTradeLink = (param: InnerTradeLinkReq): Promise<InnerTradeLinkRsp> => {
    return protoMiddleware(param, 'InnerTradeLinkReq', 'InnerTradeLinkRsp', 2);
};

/**
 * 补录内部成交单请求
 */
export const manageAmendOrder = (param: ManageAmendOrderReq): Promise<ManageAmendOrderRsp> => {
    return protoMiddleware(param, 'ManageAmendOrderReq', 'ManageAmendOrderRsp', HeadEnum.MarketID15101);
};
