import { apiRequest } from "@/shared/api/request";
import { API_ENDPOINTS, API_OPERATIONS, apiEndpointPath } from "@/shared/api/generated/endpoints";
import type { ApiList, PageQuery, RegionDto } from "@/shared/api/types";

export function listRegions(query: PageQuery = {}): Promise<ApiList<RegionDto>> {
  const endpoint = API_ENDPOINTS.listRegions;
  return apiRequest<ApiList<RegionDto>>(apiEndpointPath(API_OPERATIONS.listRegions), {
    method: endpoint.method,
    query
  });
}
