import type { EmployeeSettingsModel } from './model';

import type { BaseResult } from '#/api/base-result';

import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

// API路径常量枚举
enum Api {
  // 导出
  export = '/sysEvaluation/evaluation/export',
  // 列表查询
  list = '/sysEvaluation/evaluation/list',
  // 基础路径
  root = '/sysEvaluation/evaluation',
}

/**
 * 查询员工评价项设置列表
 * @param params 查询参数
 * @returns 分页结果
 */
export function employeeSettingsList(params: any) {
  return requestClient.get<BaseResult<EmployeeSettingsModel[]>>(Api.list, {
    params,
  });
}

/**
 * 获取员工评价项设置详细信息
 * @param id 员工评价项设置ID
 * @returns 员工评价项设置详情
 */
export function getEmployeeSettingsDetail(id: number) {
  return requestClient.get<EmployeeSettingsModel>(`${Api.root}/${id}`);
}

/**
 * 新增员工评价项设置
 * @param data 员工评价项设置数据
 * @returns 操作结果
 */
export function addEmployeeSettings(data: EmployeeSettingsModel) {
  return requestClient.post(Api.root, data, {
    successMessageMode: 'message',
  });
}

/**
 * 修改员工评价项设置
 * @param data 员工评价项设置数据
 * @returns 操作结果
 */
export function updateEmployeeSettings(data: EmployeeSettingsModel) {
  return requestClient.put(Api.root, data, {
    successMessageMode: 'message',
  });
}

/**
 * 删除员工评价项设置
 * @param ids 员工评价项设置ID数组
 * @returns 操作结果
 */
export function deleteEmployeeSettings(ids: number[]) {
  return requestClient.delete(`${Api.root}/${ids.join(',')}`, {
    successMessageMode: 'message',
  });
}

/**
 * 导出员工评价项设置列表
 * @param data 导出参数
 * @returns 导出结果
 */
export function exportEmployeeSettings(data: Partial<EmployeeSettingsModel>) {
  return commonExport(Api.export, data);
}
