import { httpRequest } from '@/services/http'
import { HttpRequest } from '@/services/http/interface'
import { tradeServerRequest } from '@/services/socket/trade'
import { TradeRequest } from '@/services/socket/trade/interface'

/**
 * 履约违约申请
 */
export function performanceContractedApply(params: TradeRequest<Proto.PerformanceContractedApplyReq, Proto.PerformanceContractedApplyRsp>) {
    return tradeServerRequest('PerformanceContractedApplyReq', 'PerformanceContractedApplyRsp', params);
}

/**
 * 履约延期申请
 */
export function performanceDelayApply(params: TradeRequest<Proto.PerformanceDelayApplyReq, Proto.PerformanceDelayApplyRsp>) {
    return tradeServerRequest('PerformanceDelayApplyReq', 'PerformanceDelayApplyRsp', params);
}

/**
 * 履约手动申请
 */
export function performanceManualConfirm(params: TradeRequest<Proto.PerformanceManualConfirmReq, Proto.PerformanceManualConfirmRsp>) {
    return tradeServerRequest('PerformanceManualConfirmReq', 'PerformanceManualConfirmRsp', params);
}

/**
 * 履约修改联络信息
 */
export function performanceModifyContact(params: TradeRequest<Proto.PerformanceModifyContactReq, Proto.PerformanceModifyContactRsp>) {
    return tradeServerRequest('PerformanceModifyContactReq', 'PerformanceModifyContactRsp', params);
}

/**
 * 查询我的履约
 */
export function queryMyPerformance(params: HttpRequest<{ req: Ermcp.MyPerformancReq, rsp: Ermcp.MyPerformancRsp[] }>) {
    return httpRequest('/Guangzuan/QueryMyPerformanc', 'get', params);
}

/**
 * 查询履约模板
 */
export function queryPermancePlanTmp(params: HttpRequest<{ req: Ermcp.PermancePlanTmpReq, rsp: Ermcp.PermancePlanTmpRsp[] }>) {
    return httpRequest('/WrTrade2/QueryPermancePlanTmp', 'get', params);
}

/**
 * 查询履约步骤枚举
 */
export function queryWrPerformanceStepType(params: HttpRequest<{ rsp: Ermcp.WrPerformanceStepTypeRsp[] }>) {
    return httpRequest('/WrTrade2/QueryWrPerformanceStepType', 'get', params);
}

/**
 * 查询履约信息详情
 */
export function queryWrPerformancePlanStep(params: HttpRequest<{ req: Ermcp.WrPerformancePlanStepReq, rsp: Ermcp.WrPerformancePlanStepRsp[] }>) {
    return httpRequest('/WrTrade2/QueryWrPerformancePlanStep', 'get', params);
}