/**
 * Popular Requests API functions.
 *
 * Pure functions — each takes an `ApiClient` as a parameter (dependency
 * injection). No React hooks, no context, no side effects.
 *
 * @module
 */

import type { ApiClient } from "@/shared/api/client.js";
import type { PopularRequest } from "./types.js";

/**
 * Fetch popular requests from the API.
 * Maps to: `GET /Requests/1/getpopular`
 *
 * Angular equivalent: `PopularRequestsApiService.getPopularRequests()`
 * which called `endpointService.buildCommonURL('getpopular', '1', 'Requests')`
 */
export async function getPopularRequests(
  client: ApiClient,
): Promise<PopularRequest[]> {
  return client.get<PopularRequest[]>("Requests/1/getpopular");
}
