/**
 * Sessions API - Feature API Layer
 * Action 6.1.1.10: Update feature API files to use services
 * 
 * This file provides the implementation layer for session API operations.
 * Currently, there is no unified service layer for sessions.
 * 
 * TODO: Consider creating @/services/api/sessions (sessionsApi) in the future
 * to align with the service layer pattern used for tracks, auth, users, and playlists.
 * 
 * INT-ENDPOINT-001: Frontend service for GET /api/v1/sessions/stats
 */

import { apiClient } from '@/services/api/client';

/**
 * SessionStats interface aligned with backend response
 * Backend returns: { user_id: string, stats: { total_active: number, unique_users: number } }
 * After unwrapping by apiClient: response.data = { user_id: string, stats: { total_active: number, unique_users: number } }
 */
export interface SessionStats {
  user_id: string;
  stats: {
    total_active: number;
    unique_users: number;
  };
}

/**
 * Get session statistics
 * GET /api/v1/sessions/stats
 *
 * @returns Promise<SessionStats> Session statistics
 * @throws ApiError if the request fails
 */
export async function getSessionStats(): Promise<SessionStats> {
  const response = await apiClient.get<SessionStats>('/sessions/stats');
  return response.data;
}

/**
 * Sessions API object
 */
export const sessionsApi = {
  getSessionStats,
};
