import request from '@/utils/request'
import type { UserPageRequest, User } from '@/types/user'
import type { ApiResponse, PageResult } from '@/types/common'

// 分页查询用户
export function getUserPage(params: UserPageRequest) {
  return request<ApiResponse<PageResult<User>>>({
    url: '/user/page',
    method: 'get',
    params
  })
}

// 根据ID获取用户
export function getUserById(id: string) {
  return request<ApiResponse<User>>({
    url: '/user/detail',
    method: 'get',
    params: { id }
  })
}

// 更新用户状态
export function updateUserStatus(id: string, status: number) {
  return request<ApiResponse<void>>({
    url: '/user/updateStatus',
    method: 'put',
    data: { id, status }
  })
}
