package com.samsung.batch.excutor;

import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

import com.samsung.batch.MboBatchService;

import lombok.extern.log4j.Log4j2;

@Component
@Log4j2
public class MboBatchExecutor extends QuartzJobBean {

	@Value("${node-id}")
	private String nodeId;

	@Autowired
	private MboBatchService mboBatchService;

	@Override
	protected void executeInternal(JobExecutionContext jobExecutionContext) {
		JobDetail jobDetail = jobExecutionContext.getJobDetail();
		String jobName = jobDetail.getKey().getName();
		log.info(new StringBuilder().append("nodeId : ").append(nodeId).append(", ").append("jobName : ")
				.append(jobName).append(", ").append("description : ").append(jobDetail.getDescription()));

		// batcMboTest
		switch (jobName) {
		case "batchMboTest" -> mboBatchService.execMboTest();
		default -> {
		}
		
		}

	}
}
