import request from '@/utils/request'

// ==================== 员工库管理 ====================

// 查询员工库列表 (重新导出credit/employee.js中的函数)
export { listEmployeeLibraries as listEmployeeLibrary } from '@/api/credit/employee'

// 查询员工库详情 (重新导出credit/employee.js中的函数)
export { getEmployeeLibrary } from '@/api/credit/employee'

// 新增员工库 (重新导出credit/employee.js中的函数)
export { createEmployeeLibrary as addEmployeeLibrary } from '@/api/credit/employee'

// 修改员工库 (重新导出credit/employee.js中的函数)
export { updateEmployeeLibrary } from '@/api/credit/employee'

// 删除员工库 (重新导出credit/employee.js中的函数)
export { deleteEmployeeLibrary as delEmployeeLibrary } from '@/api/credit/employee'

// ==================== 员工库导入导出 ====================

// 批量导入ERP格式员工数据 (重新导出credit/employee.js中的函数)
export { importErpFile as importEmployeesFromERP } from '@/api/credit/employee'

// 导出员工库数据
export function exportEmployeeLibrary(libraryId, format) {
  return request({
    url: `/credit/employee-library/${libraryId}/export`,
    method: 'get',
    params: { format: format },
    responseType: 'blob'
  })
}

// 下载员工导入模板
export function downloadEmployeeTemplate(format) {
  return request({
    url: `/credit/employee-library/template`,
    method: 'get',
    params: { format: format },
    responseType: 'blob'
  })
}

// ==================== 员工库统计 ====================

// 获取员工库统计信息
export function getEmployeeLibraryStats(libraryId) {
  return request({
    url: `/credit/employee-library/${libraryId}/stats`,
    method: 'get'
  })
}

// 获取员工库中的员工列表 (重新导出credit/employee.js中的函数)
export { getEmployeesByLibrary as getEmployeesInLibrary } from '@/api/credit/employee'

// ==================== 员工库验证 ====================

// 验证员工库数据
export function validateEmployeeLibraryData(data) {
  return request({
    url: '/credit/employee-library/validate',
    method: 'post',
    data: data
  })
}

// 检查员工库状态
export function checkEmployeeLibraryStatus(libraryId) {
  return request({
    url: `/credit/employee-library/${libraryId}/status`,
    method: 'get'
  })
}

// ==================== 员工库权限管理 ====================

// 获取员工库访问权限
export function getEmployeeLibraryPermissions(libraryId) {
  return request({
    url: `/credit/employee-library/${libraryId}/permissions`,
    method: 'get'
  })
}

// 设置员工库访问权限
export function setEmployeeLibraryPermissions(libraryId, permissions) {
  return request({
    url: `/credit/employee-library/${libraryId}/permissions`,
    method: 'post',
    data: permissions
  })
}