package com.style24.batch.biz.job.display;

import java.util.ArrayList;
import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.style24.batch.biz.job.TsbAbstractJob;
import com.style24.batch.biz.service.TsbDisplayService;
import com.style24.persistence.domain.CategoryStock;

import lombok.extern.slf4j.Slf4j;

/**
 * 전시 JOB
 *
 * @author gagamel
 * @since 2021. 4. 7
 */
@Component
@Slf4j
public class TsbDisplayJob extends TsbAbstractJob<Collection<CategoryStock>, Collection<CategoryStock>, Collection<CategoryStock>> {

	@Autowired
	private TsbDisplayService displayService;

	private int succCnt = 0;
	private int failCnt = 0;

	@Override
	public Collection<CategoryStock> read() throws Exception {
		Collection<CategoryStock> categoryStockList = new ArrayList<CategoryStock>();
		return categoryStockList;
	}

	@Override
	public Collection<CategoryStock> process(Collection<CategoryStock> categoryStockList) throws Exception {
		displayService.refreshCate4srch();
		return categoryStockList;
	}

	@Override
	public Collection<CategoryStock> write(Collection<CategoryStock> categoryStockList) throws Exception {
		return categoryStockList;
	}

	@Override
	public void notify(Collection<CategoryStock> categoryStockList) throws Exception {
		log.info("--------------------------------------------------------------------------------");
		log.info("[배치] 카테고리 4SRCH ");
		log.info("--------------------------------------------------------------------------------");
		super.printResult(succCnt, failCnt);
	}
}
