import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
import PageContainer from '@/components/layout/page-container';
import { ActivityListing } from '@/features/crm/activities/components/activity-listing';
import {
  activitiesQueryOptions,
  activityReferenceDataOptions
} from '@/features/crm/activities/api/queries';
import { getQueryClient } from '@/lib/query-client';

export default function ActivitiesPage() {
  const queryClient = getQueryClient();
  const filters = {};

  void queryClient.prefetchQuery(activitiesQueryOptions(filters));
  void queryClient.prefetchQuery(activityReferenceDataOptions());

  return (
    <PageContainer
      pageTitle='Activities'
      pageDescription='Shared operational activity foundation across CRM entities.'
    >
      <HydrationBoundary state={dehydrate(queryClient)}>
        <ActivityListing initialFilters={filters} />
      </HydrationBoundary>
    </PageContainer>
  );
}
