package com.MedInsuranceV2.Version20;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

@Configuration
@EnableScheduling // Enable Spring's scheduling capabilities
public class SchedulerConfig {
    @Bean
    public ThreadPoolTaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
        scheduler.setPoolSize(5); // Adjust pool size as needed
        scheduler.setThreadNamePrefix("DailyReportScheduler-");
        scheduler.initialize(); // Important for proper lifecycle management
        return scheduler;
    }
}
