import { request } from '@umijs/max';

/** 获取用户列表 GET /api/users */
export async function queryUserList(params: API.UserParams) {
    return request<API.UserListResult>('/api/users', {
        method: 'GET',
        params,
    });
}

/** 新增用户 POST /api/users */
export async function addUser(data: Partial<API.UserItem>) {
    return request<API.UserItem>('/api/users', {
        method: 'POST',
        data,
    });
}

/** 更新用户 PUT /api/users/:id */
export async function updateUser(id: string, data: Partial<API.UserItem>) {
    return request<API.UserItem>(`/api/users/${id}`, {
        method: 'PUT',
        data,
    });
}

/** 删除用户 DELETE /api/users/:id */
export async function deleteUser(id: string) {
    return request<void>(`/api/users/${id}`, {
        method: 'DELETE',
    });
}
