import type { SensitiveWordVO, SensitiveWordForm, SensitiveWordQuery } from './model';

import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';

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

/**
* 查询敏感词列表
* @param params
* @returns 敏感词列表
*/
export function sensitiveWordList(params?: SensitiveWordQuery) {
  return requestClient.get<PageResult<SensitiveWordVO>>('/im/sensitiveWord/list', { params });
}

/**
 * 导出敏感词列表
 * @param params
 * @returns 敏感词列表
 */
export function sensitiveWordExport(params?: SensitiveWordQuery) {
  return commonExport('/im/sensitiveWord/export', params ?? {});
}

/**
 * 查询敏感词详情
 * @param id id
 * @returns 敏感词详情
 */
export function sensitiveWordInfo(id: ID) {
  return requestClient.get<SensitiveWordVO>(`/im/sensitiveWord/${id}`);
}

/**
 * 新增敏感词
 * @param data
 * @returns void
 */
export function sensitiveWordAdd(data: SensitiveWordForm) {
  return requestClient.postWithMsg<void>('/im/sensitiveWord', data);
}

/**
 * 更新敏感词
 * @param data
 * @returns void
 */
export function sensitiveWordUpdate(data: SensitiveWordForm) {
  return requestClient.putWithMsg<void>('/im/sensitiveWord', data);
}

/**
 * 删除敏感词
 * @param id id
 * @returns void
 */
export function sensitiveWordRemove(id: ID | IDS) {
  return requestClient.deleteWithMsg<void>(`/im/sensitiveWord/${id}`);
}
