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

import com.style24.batch.biz.job.TsbAbstractJob;
import com.style24.batch.biz.service.TsbCustomerService;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * 개인정보 이용내역 안내 발송
 *
 * @author jsshin
 * @since 2021.05.06
 */
@Component
@Slf4j
public class TsbPrivacyPolicyNoticeJob extends TsbAbstractJob<String, String, String> {

	@Autowired
	TsbCustomerService customerService;

	private int kkoCnt = 0;
	private int emailCnt = 0;

	@Override
	public String read() throws Exception {
		return "OK";
	}

	@Override
	public String process(String result) throws Exception {
		kkoCnt = customerService.sendPrivacyPolicyNoticeKko();
		emailCnt = customerService.sendPrivacyPolicyNoticeEmail();
		return result;
	}

	@Override
	public String write(String result) throws Exception {
		return result;
	}

	@Override
	public void notify(String resultItem) throws Exception {
		log.info("--------------------------------------------------------------------------------");
		log.info("개인정보 안내 알림톡 : {}건, 개인정보 안내 이메일: {}건", kkoCnt, emailCnt);
		log.info("--------------------------------------------------------------------------------");
	}
}
