import { useServerSuspenseQuery } from "@/lib/tanstack-query/hooks";
import { searchActivities } from "./server";
import { ActivitySearchParams } from "./types";

export const activityKeys = {
  search: (params: ActivitySearchParams) => ['activities', 'search', params] as const,
};

export const activityQueries = {
  search: (params: ActivitySearchParams = {}) => ({
    queryKey: activityKeys.search(params),
    queryFn: () => searchActivities({ data: params }),
  }),
};

export const useActivities = (params: ActivitySearchParams = {}) =>
  useServerSuspenseQuery(activityQueries.search(params));
