import type * as T from './type'
import http from '@/utils/http'

const BASE_URL = '/user'

/** @desc 新增用户信息 */
export function addUserNew(data: T.UserNewAddReq) {
  return http.post<T.UserNewResp>(`${BASE_URL}`, data)
}

/** @desc 绑定角色 */
export function bindUserRole(data: T.UserBindRoleReq) {
  return http.put(`${BASE_URL}/bind-role`, data)
}

/** @desc 根据用户信息Id获取详细信息 */
export function getUserDetailNew(userId: string) {
  return http.get<T.UserNewResp>(`${BASE_URL}/detail/${userId}`)
}

/** @desc 查询用户信息列表 */
export function listUserNew(query: T.UserNewQuery) {
  return http.get<T.UserNewResp[]>(`${BASE_URL}/list`, query)
}

/** @desc 分页查询用户信息列表 */
export function pageUserNew(query: T.UserNewPageQuery) {
  return http.get<PageRes<T.UserNewResp[]>>(`${BASE_URL}/page`, query)
}

/** @desc 修改用户信息 */
export function updateUserNew(userId: string, data: T.UserNewUpdateReq) {
  return http.put(`${BASE_URL}/${userId}`, data)
}

/** @desc 删除用户信息 */
export function deleteUserNew(userId: string) {
  return http.del(`${BASE_URL}/${userId}`)
} 