/**
 * System Prompts Index
 */

export { ADMIN_SYSTEM_PROMPT, generateAdminPrompt } from './admin-system-prompt';
export { SUPERVISOR_SYSTEM_PROMPT, generateSupervisorPrompt } from './supervisor-system-prompt';
export { OPERATOR_SYSTEM_PROMPT, generateOperatorPrompt } from './operator-system-prompt';
export { CUSTOMER_SYSTEM_PROMPT, generateCustomerPrompt } from './customer-system-prompt';

import { ERPRole } from '../roles/erp-roles.config';
import { generateAdminPrompt } from './admin-system-prompt';
import { generateSupervisorPrompt } from './supervisor-system-prompt';
import { generateOperatorPrompt } from './operator-system-prompt';
import { generateCustomerPrompt } from './customer-system-prompt';

export interface PromptVariables {
  businessName: string;
  currentDate?: string;
  currentBranch?: string;
  maxDiscount?: number;
  storeHours?: string;
}

/**
 * Generar system prompt para un rol
 */
export function generateSystemPrompt(role: ERPRole, variables: PromptVariables): string {
  const baseVars = {
    businessName: variables.businessName,
    currentDate: variables.currentDate || new Date().toLocaleDateString('es-MX'),
    currentBranch: variables.currentBranch || 'Principal',
    maxDiscount: variables.maxDiscount,
    storeHours: variables.storeHours,
  };

  switch (role) {
    case 'ADMIN':
      return generateAdminPrompt(baseVars);
    case 'SUPERVISOR':
      return generateSupervisorPrompt(baseVars);
    case 'OPERATOR':
      return generateOperatorPrompt(baseVars);
    case 'CUSTOMER':
      return generateCustomerPrompt(baseVars);
    default:
      return generateCustomerPrompt(baseVars);
  }
}
