package com.samsung.config;

import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.CronTriggerFactoryBean;

import com.samsung.batch.excutor.MboBatchExecutor;
import com.samsung.embo.api.config.GhrpConfig;

import lombok.extern.log4j.Log4j2;

@Configuration

public class MboBatchConfig {

	private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(MboBatchConfig.class);


	@Value("${batch.mbo001.cron}")
	private String batchMbo001Cron;

	@Bean
	public JobDetail batchMbo001Job() {
		return JobBuilder.newJob(MboBatchExecutor.class).withIdentity("batchMboTest")
				.withDescription("Mbo Test Batch").storeDurably(true).build();

	}

	@Bean
    public CronTriggerFactoryBean batchMbo001JobTrigger() {

		log.info("=================================================== batchMbo001JobTrigger =================================================== ");

		CronTriggerFactoryBean trigger = new CronTriggerFactoryBean();
		trigger.setJobDetail(batchMbo001Job());
		trigger.setCronExpression(batchMbo001Cron);
		return trigger;

	}

}
