import { apiRequest, type Employee } from "./_shared"; export async function listEmployees(workspaceId: string): Promise { return apiRequest("/api/v1/admin/employees", {}, workspaceId); } /** @deprecated 使用 createPlatformEmployee 代替 */ export async function createEmployee( workspaceId: string, input: { username: string; display_name: string; email?: string | null; role_code: "admin" | "developer"; password: string; }, ): Promise { return apiRequest( "/api/v1/admin/employees", { method: "POST", body: JSON.stringify(input) }, workspaceId, ); } /** @deprecated 使用 updatePlatformEmployee 代替 */ export async function updateEmployee( workspaceId: string, userId: string, input: { display_name?: string; email?: string | null; role_code?: "admin" | "developer"; status?: "active" | "disabled" | "locked"; }, ): Promise { return apiRequest( `/api/v1/admin/employees/${userId}`, { method: "PATCH", body: JSON.stringify(input) }, workspaceId, ); } /** @deprecated 使用 deletePlatformEmployee 代替 */ export async function deleteEmployee( workspaceId: string, userId: string, ): Promise<{ user_id: string; deleted: boolean }> { return apiRequest( `/api/v1/admin/employees/${userId}`, { method: "DELETE" }, workspaceId, ); } // ----------------------------------------------------------------------------