/**
 * 中医字典 API（疾病 / 治法 / 证候）
 */
import { requestClient } from '#/api/request';

const prefix = 'tcm-dict/';

export type TcmDictType = 'diseases' | 'method' | 'syndrome';

export async function getTcmDictList(data: {
  type: TcmDictType;
  page?: number;
  pageSize?: number;
  keyword?: string;
}) {
  return requestClient.get<any>(`${prefix}list`, { params: data });
}

export async function createTcmDict(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}create`, data);
}

export async function updateTcmDict(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}update`, data);
}

export async function deleteTcmDict(data: { type: TcmDictType; ids: number[] }) {
  return requestClient.post<any>(`${prefix}delete`, data);
}

/** 手动同步空拼音首拼 */
export async function syncTcmDictPinyin(type: TcmDictType) {
  return requestClient.post<any>(`${prefix}sync-pinyin`, { type });
}
