import {RouteResult} from './promptRouter';
import {buildSalesTemplate} from './templates/sales';
import {buildStoresTemplate} from './templates/stores';
import {buildRewardsTemplate} from './templates/rewards';
import {buildStaffTemplate} from './templates/staff';
import {buildInventoryTemplate} from './templates/inventory';
import {buildAnalyticsTemplate} from './templates/analytics';
import {buildGeneralTemplate} from './templates/general';
import type {ReportPart} from '@/features/loyaly-ai/types/chat';

export function generateReportResponse(route: RouteResult): ReportPart {
  const {intent, entities} = route;

  switch (intent) {
    case 'sales':
      return buildSalesTemplate(entities);
    case 'stores':
      return buildStoresTemplate(entities);
    case 'rewards':
      return buildRewardsTemplate(entities);
    case 'staff':
      return buildStaffTemplate(entities);
    case 'inventory':
      return buildInventoryTemplate(entities);
    case 'retention':
    case 'analytics':
      return buildAnalyticsTemplate(entities);
    case 'billing':
    case 'security':
    case 'general':
    default:
      return buildGeneralTemplate(entities);
  }
}
