package com.style24.batch.biz.service;

import com.style24.batch.biz.dao.TsbPointDao;
import com.style24.persistence.domain.Point;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;

/**
 * 포인트 Service
 *
 * @author jsshin
 * @since 2021. 03. 05
 */
@Service
@Slf4j
public class TsbPointService {

	@Autowired
	private TsbPointDao pointDao;

	/**
	 * 자동구매확정 대상 리스트
	 *
	 * @param point - 자동구매확정 기준일, 구매확정 포인트 만료일
	 * @return Collection<Point>
	 * @author jsshin
	 * @since  2021. 04. 23
	 */
	@Transactional("shopTxnManager")
	public Collection<Point> getAutoBuyConfirmList(Point point) {
		return pointDao.getAutoBuyConfirmList(point);
	}
	
	/**
	 * 포인트 소멸 리스트
	 *
	 * @param point
	 * @return Collection<Point>
	 * @author sowon
	 * @since  2021. 04. 26
	 */
	@Transactional("shopTxnManager")
	public Collection<Point> getExpirePointList(Point point){
		return pointDao.getExpirePointList(point);
	}

	/**
	 * 포인트 hst insert
	 *
	 * @param point
	 * @return 
	 * @author sowon
	 * @since  2021. 04. 26
	 */
	@Transactional("shopTxnManager")
	public void saveExpirePointHst(Point point) {
		pointDao.saveExpirePointHst(point);
	}
	
	
	/**
	 * 포인트 만료일시 update
	 *
	 * @param point
	 * @return 
	 * @author sowon
	 * @since  2021. 04. 26
	 */
	@Transactional("shopTxnManager")
	public void updateCustPointExpire(Point point) {
		pointDao.updateCustPointExpire(point);
	}
	
	/**
	 * 포인트 기간만료 알림톡(30일) 리스트
	 *
	 * @param point
	 * @return Collection<Point>
	 * @author sowon
	 * @since  2021. 05. 28
	 */
	@Transactional("shopTxnManager")
	public Collection<Point> getSendPointExpectList(Point point){
		return pointDao.getSendPointExpectList(point);
	}
}
