"use client";
import { useQuery } from "@tanstack/react-query";
import { TeamsAPI } from "../../lib/teams/teams.api.js";
import { teamsKeys } from "../../lib/teams/teams.keys.js";
function useAdminTeams(options = {}) {
  var _a, _b, _c, _d;
  const { enabled = true, ...params } = options;
  const query = useQuery({
    queryKey: teamsKeys.adminList(params),
    queryFn: () => TeamsAPI.getAdminTeams(params),
    enabled,
    staleTime: 30 * 1e3,
    // 30 seconds
    retry: 2
  });
  return {
    /** List of teams */
    teams: ((_a = query.data) == null ? void 0 : _a.teams) ?? [],
    /** Team counts by type */
    counts: (_b = query.data) == null ? void 0 : _b.counts,
    /** Pagination info */
    pagination: (_c = query.data) == null ? void 0 : _c.pagination,
    /** Request metadata */
    metadata: (_d = query.data) == null ? void 0 : _d.metadata,
    /** Loading state */
    isLoading: query.isLoading,
    /** Fetching state (for refetches) */
    isFetching: query.isFetching,
    /** Error if any */
    error: query.error,
    /** Refetch teams */
    refetch: query.refetch
  };
}
export {
  useAdminTeams
};
