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

const prefix = 'drug-categories/';

/**
 * 获取分类列表
 * @param data
 */
export async function getDrugCategoriesList(data: any) {
  return requestClient.get<any>(`${prefix}list`, { params: data });
}

/**
 * 获取分类树（用于下拉选择）
 * @param data
 */
export async function getDrugCategoriesTree(data?: any) {
  return requestClient.get<any>(`${prefix}tree`, { params: data });
}

/**
 * 获取分类详情
 * @param id
 */
export async function getDrugCategoriesDetail(id: number) {
  return requestClient.get<any>(`${prefix}detail`, { params: { id } });
}

/**
 * 新增分类
 * @param data
 */
export async function createDrugCategories(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}create`, data);
}

/**
 * 编辑分类
 * @param data
 */
export async function updateDrugCategories(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}update`, data);
}

/**
 * 删除分类
 * @param data
 */
export async function deleteDrugCategories(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}delete`, data);
}

/**
 * 获取专区下拉选项
 */
export async function getZoneOptions() {
  return requestClient.get<any>(`${prefix}zone-options`);
}

