import request from '@/utils/request'

// 查询利率定价流程列表
export function listWorkflow(query) {
  return request({
    url: '/loanPricing/workflow/list',
    method: 'get',
    params: query
  })
}

// 查询利率定价流程详情
export function getWorkflow(serialNum) {
  return request({
    url: '/loanPricing/workflow/' + serialNum,
    method: 'get'
  })
}

// 查询利率定价流程编辑数据
export function getWorkflowEdit(serialNum) {
  return request({
    url: '/loanPricing/workflow/' + serialNum + '/edit',
    method: 'get'
  })
}

// 创建个人客户利率定价流程
export function createPersonalWorkflow(data) {
  return request({
    url: '/loanPricing/workflow/create/personal',
    method: 'post',
    data: data
  })
}

// 编辑个人客户利率定价流程
export function updatePersonalWorkflow(serialNum, data) {
  return request({
    url: '/loanPricing/workflow/' + serialNum + '/personal',
    method: 'put',
    data: data
  })
}

// 创建企业客户利率定价流程
export function createCorporateWorkflow(data) {
  return request({
    url: '/loanPricing/workflow/create/corporate',
    method: 'post',
    data: data
  })
}

// 编辑企业客户利率定价流程
export function updateCorporateWorkflow(serialNum, data) {
  return request({
    url: '/loanPricing/workflow/' + serialNum + '/corporate',
    method: 'put',
    data: data
  })
}

// 查询个人客户号映射
export function queryPersonalCustomerMap(custId) {
  return request({
    url: '/loanPricing/workflow/customer-map/personal',
    method: 'get',
    params: { custId: custId }
  })
}

// 查询企业客户号映射
export function queryCorporateCustomerMap(custId) {
  return request({
    url: '/loanPricing/workflow/customer-map/corporate',
    method: 'get',
    params: { custId: custId }
  })
}

// 查询历史贷款合同
export function queryHistoryContracts(custIsn) {
  return request({
    url: '/loanPricing/workflow/history-contract',
    method: 'get',
    params: { custIsn: custIsn }
  })
}

// 设定执行利率
export function setExecuteRate(serialNum, executeRate) {
  return request({
    url: '/loanPricing/workflow/' + serialNum + '/executeRate',
    method: 'put',
    data: { executeRate: executeRate }
  })
}
