import { logger } from '../utils/logger.js';
import { startCalendarNotificationCron, startOneHourBeforeNotificationCron, startEveningNotificationCron, triggerEventNotifications, triggerSingleEventNotification } from './calendar/index.js';
import { startAuditCleanupCron, cleanupOldAuditLogs } from './cleanupAuditLogs.js';

/**
 * Start all cron jobs
 */
export const startAllCronJobs = () => {
  // Calendar event notifications (morning - configurable time)
  const calendarJob = startCalendarNotificationCron();
  logger.info(`Cron: ${calendarJob.name}`);

  // 1-hour-before notifications (every hour)
  const oneHourJob = startOneHourBeforeNotificationCron();
  logger.info(`Cron: ${oneHourJob.name}`);

  // Evening notifications at 18:00 for tomorrow's events
  const eveningJob = startEveningNotificationCron();
  logger.info(`Cron: ${eveningJob.name}`);

  // Audit logs cleanup
  const auditJob = startAuditCleanupCron();
  logger.info(`Cron: ${auditJob.name}`);
};

// Export individual functions for testing/manual triggers
export { triggerEventNotifications, triggerSingleEventNotification, cleanupOldAuditLogs };
