import { http } from "@/utils/http";

/** 用户列表（小程序用户） */
export const getUserList = (params?: object) => {
  return http.request<any>("get", "/admin-user/list", { params });
};

/** 操作员列表 */
export const getAdminUserList = (params?: object) => {
  return http.request<any>("get", "/admin-user/listAdminUser", { params });
};

/** 操作员详情 */
export const getAdminUserDetail = (id: number) => {
  return http.request<any>("get", `/admin-user/detail/${id}`);
};

/** 新增操作员 */
export const addAdminUser = (data: object) => {
  return http.request<any>("post", "/admin-user/add", { data });
};

/** 修改操作员 */
export const modifyAdminUser = (data: object) => {
  return http.request<any>("post", "/admin-user/modify", { data });
};

/** 获取角色列表（用于操作员管理） */
export const getAdminRoleList = () => {
  return http.request<any>("get", "/admin-user/listRole");
};

/** 更新用户角色 */
export const updateUserRole = (data: { userId: number; roleIdList: number[] }) => {
  return http.request<any>("post", "/admin-user/updateRole", { data });
};

/** 删除操作员 */
export const removeAdminUser = (id: number) => {
  return http.request<any>("get", `/admin-user/delete/${id}`);
};
