import { request } from '@/api/request'

/**
 * 用户列表项接口
 */
export interface UserItem {
  id: number;
  name: string;
  username?: string;
  email?: string;
  phone?: string;
  status?: string;
  created_at?: string;
  updated_at?: string;
}

/**
 * 用户列表响应接口
 */
export interface UserListResponse {
  code: number;
  message: string;
  data?: UserItem[] | { data?: UserItem[] };
  details?: UserItem[] | { data?: UserItem[] };
}

/**
 * 获取用户列表
 */
export const fetchUserList = async (data: any) => {
  return request.post<UserListResponse>('/rbac2/v1/user/list', data, { needWorkspace: true });
};
