import { request } from './client' // AdminUser 对应后端 adminUserDTO:比登录用的 User 多 enabled 与时间戳。 export interface AdminUser { id: string email: string display_name: string is_admin: boolean enabled: boolean created_at: string updated_at: string } export interface CreateUserBody { email: string display_name: string password: string is_admin: boolean } export interface ResetPasswordResponse { temp_password: string } const BASE = '/api/v1/admin/users' export const userAdminApi = { list: () => request(BASE), get: (id: string) => request(`${BASE}/${id}`), create: (body: CreateUserBody) => request(BASE, { method: 'POST', body }), updateProfile: (id: string, displayName: string) => request(`${BASE}/${id}`, { method: 'PATCH', body: { display_name: displayName }, }), setRole: (id: string, isAdmin: boolean) => request(`${BASE}/${id}/role`, { method: 'PATCH', body: { is_admin: isAdmin }, }), setEnabled: (id: string, enabled: boolean) => request(`${BASE}/${id}/enabled`, { method: 'PATCH', body: { enabled }, }), resetPassword: (id: string) => request(`${BASE}/${id}/reset-password`, { method: 'POST', }), remove: (id: string) => request(`${BASE}/${id}`, { method: 'DELETE' }), }