package com.style24.batch.biz.service;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.style24.batch.biz.dao.TsbReviewDao;
import com.style24.persistence.domain.ReviewGuide;

import lombok.extern.slf4j.Slf4j;

/**
 * 상품평 Service
 *
 * @author gagamel
 * @since 2021. 5. 17
 */
@Service
@Slf4j
public class TsbReviewService {

	@Autowired
	private TsbReviewDao reviewDao;

	/**
	 * 상품평등록안내발송대상건 생성
	 * @param expireDays - 상품평만료일자
	 * @return 생성건수
	 * @author gagamel
	 * @since 2021. 5. 17
	 */
	@Transactional("shopTxnManager")
	public int createReviewGuideSendObjectList(int expireDays) {
		return reviewDao.createReviewGuideSendObjectList(expireDays);
	}

	/**
	 * 상품평등록안내발송대상 목록
	 * @return
	 * @author gagamel
	 * @since 2021. 5. 17
	 */
	public Collection<ReviewGuide> getReviewGuideSendObjectList() {
		return reviewDao.getReviewGuideSendObjectList();
	}

	/**
	 * 상품평등록안내발송완료 처리
	 * @param reviewGuide - 상품평등록안내 정보
	 * @author gagamel
	 * @since 2021. 5. 17
	 */
	@Transactional("shopTxnManager")
	public void updateReviewGuideSendComplete(ReviewGuide reviewGuide) {
		reviewDao.updateReviewGuideSendComplete(reviewGuide);
	}

}
