package com.style24.admin.biz.service;

import java.util.Collection;

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

import com.style24.admin.biz.dao.TsaAnswerPhaseDao;
import com.style24.admin.support.security.session.TsaSession;
import com.style24.persistence.domain.AnswerPhase;

import lombok.extern.slf4j.Slf4j;

/**
 * 답변문구 Service
 *
 * @author gagamel
 * @since 2020. 10. 29
 */
@Service
@Slf4j
public class TsaAnswerPhaseService {

	@Autowired
	private TsaAnswerPhaseDao ansPhaseDao;

	/**
	 * 답변문구 목록
	 * @param ansPhase - 답변문구 정보
	 * @return
	 * @author gagamel
	 * @since 2020. 10. 29
	 */
	public Collection<AnswerPhase> getAnswerPhaseList(AnswerPhase ansPhase) {
		return ansPhaseDao.getAnswerPhaseList(ansPhase);
	}

	/**
	 * 답변문구 등록/수정
	 * @param ansPhase - 답변문구 정보
	 * @return
	 * @author gagamel
	 * @since 2020. 10. 29
	 */
	@Transactional("shopTxnManager")
	@CacheEvict(value = "answerPhase", allEntries = true)
	public void saveAnswerPhase(AnswerPhase ansPhase) {
		ansPhase.setRegNo(TsaSession.getInfo().getUserNo());
		ansPhase.setUpdNo(TsaSession.getInfo().getUserNo());
		ansPhaseDao.saveAnswerPhase(ansPhase);
	}

}
