import request from '@/utils/request'

// 查询中介黑名单列表
export function listIntermediary(query) {
  return request({
    url: '/ccdi/intermediary/list',
    method: 'get',
    params: query
  })
}

// 查询个人中介详细
export function getPersonIntermediary(bizId) {
  return request({
    url: '/ccdi/intermediary/person/' + bizId,
    method: 'get'
  })
}

// 查询实体中介详细
export function getEntityIntermediary(socialCreditCode) {
  return request({
    url: '/ccdi/intermediary/entity/' + socialCreditCode,
    method: 'get'
  })
}

// 新增个人中介黑名单
export function addPersonIntermediary(data) {
  return request({
    url: '/ccdi/intermediary/person',
    method: 'post',
    data: data
  })
}

// 新增机构中介黑名单
export function addEntityIntermediary(data) {
  return request({
    url: '/ccdi/intermediary/entity',
    method: 'post',
    data: data
  })
}

// 修改中介黑名单
export function updateIntermediary(data) {
  return request({
    url: '/ccdi/intermediary',
    method: 'put',
    data: data
  })
}

// 修改个人中介黑名单
export function updatePersonIntermediary(data) {
  return request({
    url: '/ccdi/intermediary/person',
    method: 'put',
    data: data
  })
}

// 修改机构中介黑名单
export function updateEntityIntermediary(data) {
  return request({
    url: '/ccdi/intermediary/entity',
    method: 'put',
    data: data
  })
}

// 删除中介黑名单
export function delIntermediary(intermediaryIds) {
  return request({
    url: '/ccdi/intermediary/' + intermediaryIds,
    method: 'delete'
  })
}

// 下载导入模板（已废弃，保留以兼容旧代码）
export function importTemplate() {
  return request({
    url: '/ccdi/intermediary/importTemplate',
    method: 'post'
  })
}

// 导入中介黑名单
export function importData(data, updateSupport) {
  return request({
    url: '/ccdi/intermediary/importData?updateSupport=' + updateSupport,
    method: 'post',
    data: data
  })
}

// 下载个人中介导入模板
export function importPersonTemplate() {
  return request({
    url: '/ccdi/intermediary/importPersonTemplate',
    method: 'post'
  })
}

// 下载机构中介导入模板
export function importEntityTemplate() {
  return request({
    url: '/ccdi/intermediary/importEntityTemplate',
    method: 'post'
  })
}

// 导入个人中介黑名单
export function importPersonData(data, updateSupport) {
  return request({
    url: '/ccdi/intermediary/importPersonData?updateSupport=' + updateSupport,
    method: 'post',
    data: data
  })
}

// 导入机构中介黑名单
export function importEntityData(data, updateSupport) {
  return request({
    url: '/ccdi/intermediary/importEntityData?updateSupport=' + updateSupport,
    method: 'post',
    data: data
  })
}
