import request from '@/utils/request';
import type { OnlineUserResponse, OnlineUserQuery, OnlineStatistics } from './types';
import { Page } from '@/types/base';

const BASE_URL = '/api/v1/online';

// 获取在线用户列表(分页)
export const getOnlineUsers = (params?: OnlineUserQuery) => 
    request.get<Page<OnlineUserResponse>>(`${BASE_URL}/users`, { params });

// 获取在线统计
export const getOnlineStatistics = () => 
    request.get<OnlineStatistics>(`${BASE_URL}/statistics`);

// 强制用户下线
export const kickUser = (userId: number) => 
    request.delete(`${BASE_URL}/kick/${userId}`);
