import request from '@/utils/request'

// 查询银行机构列表
export function listBankInstitution(query) {
  return request({
    url: '/credit/bank-institution/list',
    method: 'get',
    params: query
  })
}

// 查询银行机构详细
export function getBankInstitution(bankId) {
  return request({
    url: '/credit/bank-institution/' + bankId,
    method: 'get'
  })
}

// 新增银行机构
export function addBankInstitution(data) {
  return request({
    url: '/credit/bank-institution',
    method: 'post',
    data: data
  })
}

// 修改银行机构
export function updateBankInstitution(data) {
  return request({
    url: '/credit/bank-institution',
    method: 'put',
    data: data
  })
}

// 删除银行机构
export function delBankInstitution(bankId) {
  return request({
    url: '/credit/bank-institution/' + bankId,
    method: 'delete'
  })
}

// 查询活跃的银行机构列表
export function getActiveBankInstitutions() {
  return request({
    url: '/credit/bank-institution/active',
    method: 'get'
  })
}

// 根据贷款条件匹配银行机构
export function matchBankInstitutions(loanAmount, loanTermMonths) {
  return request({
    url: '/credit/bank-institution/match',
    method: 'get',
    params: {
      loanAmount: loanAmount,
      loanTermMonths: loanTermMonths
    }
  })
}

// 导出银行机构
export function exportBankInstitution(query) {
  return request({
    url: '/credit/bank-institution/export',
    method: 'post',
    data: query
  })
}