/**
* useKeyStats Hook
*
* TanStack Query hook for fetching integration key statistics for a tenant.
*
* Features:
* - Automatic caching with 1-minute stale time (stats update frequently)
* - Background refetching
* - Request deduplication
*
* @layer Presentation - TanStack Query Hook
*/
import { useQuery } from '@tanstack/react-query';
import { queryKeys } from '@/lib/query-keys';
import { integrationKeysApi } from '@/infrastructure/http/api/integration-keys/api';
interface KeyStats {
total: number;
active: number;
revoked: number;
expired: number;
}
interface UseKeyStatsOptions {
enabled?: boolean;
}
/**
* Fetches integration key statistics for a tenant
*
* @param tenantId - Tenant ID to get statistics for
* @param options - Query options (enabled, etc.)
* @returns TanStack Query result with statistics
*
* @example
* ```typescript
* const { data: stats, isLoading, error } = useKeyStats('tenant-123');
*
* if (isLoading) return