import { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';

/**
 * Navigate to a feature hub with a deep-link to open a specific entity.
 * e.g. navigateToFeatureHub(router, 'forecasts', eventId, 'rainwire')
 * → /forecasts?open={eventId}&source=rainwire
 */
export function navigateToFeatureHub(
  router: AppRouterInstance,
  feature: string,
  entityId: string,
  source: string
) {
  router.push(`/${feature}?open=${encodeURIComponent(entityId)}&source=${encodeURIComponent(source)}`);
}
