package salidasautomaticas.main;

import java.util.logging.Level;
import java.util.logging.Logger;
import static org.quartz.CronScheduleBuilder.cronSchedule;
import org.quartz.CronTrigger;
import static org.quartz.JobBuilder.newJob;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import static org.quartz.TriggerBuilder.newTrigger;
import org.quartz.impl.StdSchedulerFactory;
import salidasautomaticas.schedule.Planificador;
import salidasautomaticas.schedule.ProgramarSalidasJob;

public class Main {

    public static void main(String[] args) {
        SchedulerFactory sf = Planificador.getInstance().getSchedulerFactory();
        Scheduler scheduler;
        try {
            scheduler = sf.getScheduler();
            JobDetail job = newJob(ProgramarSalidasJob.class).withIdentity("job1", "group1").build();
            
            CronTrigger trigger = newTrigger().withIdentity("trigger1", "group1").withSchedule(cronSchedule("0 43 15 * * ?"))
                    .build();

            scheduler.scheduleJob(job, trigger);
            
            scheduler.start();
        } catch (SchedulerException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
}
