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

const prefix = 'user/';
/**
 * 分页查询用户列表
 * @param data
 */
export async function getUserListApi(data: any) {
  return requestClient.get<any>(`${prefix}list`, { params: data });
}

/**
 * 获取用户下拉列表
 */
export async function getUserOptionApi() {
  return requestClient.get<any>(`${prefix}option`);
}

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

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

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

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