/**
 * TAT (Turnaround Time) Configuration
 * 
 * This file re-exports TAT-related configuration from the centralized system config
 * Kept for backward compatibility
 */

import { SYSTEM_CONFIG } from './system.config';

export const TAT_CONFIG = {
  // Working hours configuration (from system config)
  WORK_START_HOUR: SYSTEM_CONFIG.WORKING_HOURS.START_HOUR,
  WORK_END_HOUR: SYSTEM_CONFIG.WORKING_HOURS.END_HOUR,
  
  // Working days (1 = Monday, 5 = Friday)
  WORK_START_DAY: SYSTEM_CONFIG.WORKING_HOURS.START_DAY,
  WORK_END_DAY: SYSTEM_CONFIG.WORKING_HOURS.END_DAY,
  
  // TAT notification thresholds (percentage)
  THRESHOLD_50_PERCENT: SYSTEM_CONFIG.TAT.THRESHOLD_50_PERCENT,
  THRESHOLD_75_PERCENT: SYSTEM_CONFIG.TAT.THRESHOLD_75_PERCENT,
  THRESHOLD_100_PERCENT: SYSTEM_CONFIG.TAT.THRESHOLD_100_PERCENT,
  
  // Testing mode
  TEST_MODE: SYSTEM_CONFIG.TAT.TEST_MODE,
  TEST_TIME_MULTIPLIER: SYSTEM_CONFIG.TAT.TEST_TIME_MULTIPLIER,
  
  // Redis configuration
  REDIS_URL: SYSTEM_CONFIG.REDIS.URL,
  
  // Queue configuration
  QUEUE_CONCURRENCY: SYSTEM_CONFIG.REDIS.QUEUE_CONCURRENCY,
  QUEUE_RATE_LIMIT_MAX: SYSTEM_CONFIG.REDIS.RATE_LIMIT_MAX,
  QUEUE_RATE_LIMIT_DURATION: SYSTEM_CONFIG.REDIS.RATE_LIMIT_DURATION,
  
  // Retry configuration
  MAX_RETRY_ATTEMPTS: 3,
  RETRY_BACKOFF_DELAY: 2000,
};

/**
 * Get TAT time in appropriate units based on test mode
 * @param hours - TAT hours
 * @returns Adjusted time for test mode
 */
export function getTatTime(hours: number): number {
  return hours * TAT_CONFIG.TEST_TIME_MULTIPLIER;
}

/**
 * Get display name for time unit based on test mode
 */
export function getTimeUnitName(): string {
  return TAT_CONFIG.TEST_MODE ? 'minutes' : 'hours';
}

/**
 * Check if TAT system is in test mode
 */
export function isTestMode(): boolean {
  return TAT_CONFIG.TEST_MODE;
}

/**
 * Log TAT configuration on startup
 */
export function logTatConfig(): void {
  // TAT config logging disabled - use environment variables to verify settings
}

export default TAT_CONFIG;

